Re: [Tutor] send issue

2013-03-23 Thread Steven D'Aprano
On 23/03/13 15:22, Lolo Lolo wrote: You can use bytes() function: bytes('%d' % 3, 'utf-8') b'3' -m thanks this has solved everything. can i ask if this is an issue only in python 3 where sockets cant send strings? the docs state the argument is a string, but i believe that was for 2.7

Re: [Tutor] Overriding equality tests in Python

2013-03-23 Thread Steven D'Aprano
On 23/03/13 15:08, Robert Sjoblom wrote: Hi list. I'll preface this by saying that I am very grateful for all of you, and thank you in advance to anyone that answers. I'm currently working on a roulette simulator, because it seemed like fun. I found out I needed a way to compare two different ou

[Tutor] Overriding equality tests in Python

2013-03-23 Thread John Steedman
It is also good to know that overriding the "comparison magic methods" in your class can be very useful if you wish to apply sorting/searching procedures available in python. If you also implement __gt__, __lt__, __ge__, __le__ in your class, then you can append each of your objects to a list an

Re: [Tutor] Overriding equality tests in Python

2013-03-23 Thread Alan Gauld
On 23/03/13 04:08, Robert Sjoblom wrote: However, if I were to create a class without the __eq__ and __ne__ definitions, what is to prevent me from doing: a.name == b.name ? Or am I missing something in my implementation of the overrides? Is there a reason why I shouldn't do .name comparisons?

Re: [Tutor] Overriding equality tests in Python

2013-03-23 Thread Dave Angel
On 03/23/2013 12:08 AM, Robert Sjoblom wrote: You already got lots of good answers. But I want to explicitly point out a bug in your code (2 places) that was only indirectly mentioned. class Outcome(): def __init__(self, name): #Ignoring odds for now self.name = name def

Re: [Tutor] send issue

2013-03-23 Thread Lolo Lolo
> Does this help?   THANKS!! Yes it definately helped. everything is so much clearer now. i always used to wonder about the u"" syntax in python 2___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.or

Re: [Tutor] Overriding equality tests in Python

2013-03-23 Thread Robert Sjoblom
> As I said, I don't really understand why a roulette outcome has a name in > the first place, but given that it does, I don't any problem with comparing > the names directly. Still, I would probably write it as an __eq__ method, > since it's easier to write a == b than a.name == b.name. I figured

Re: [Tutor] Overriding equality tests in Python

2013-03-23 Thread Dave Angel
On 03/23/2013 10:35 AM, Robert Sjoblom wrote: As I said, I don't really understand why a roulette outcome has a name in the first place, but given that it does, I don't any problem with comparing the names directly. Still, I would probably write it as an __eq__ method, since it's easier to write

Re: [Tutor] Beep sound

2013-03-23 Thread Bod Soutar
On Mar 23, 2013 2:24 AM, "Steven D'Aprano" wrote: > > On 23/03/13 12:48, Phil wrote: >> >> Just out of curiosity how can a beep sound be generated? >> >> My interest in this came about because echo -e '\a' no longer works. Also print '\a' doesn't work, presumably for the same reason. The following

[Tutor] help with installing and/or running PyNomo

2013-03-23 Thread Edythe Thompson
Using Python 2.6.5 Mac OS X version 10.6.8 I want to run the PyNomo package that uses python. I have followed the instructions shown. Install newest python (2.6.5 tested) [1] Download and install latest Numpy for python 2.6. Download and install latest Scipy Install PIL (or skip, probably you w

Re: [Tutor] help with installing and/or running PyNomo

2013-03-23 Thread Alan Gauld
On 23/03/13 22:35, Edythe Thompson wrote: Using Python 2.6.5 Mac OS X version 10.6.8 I want to run the PyNomo package that uses python. This list is for learning core Python so you are probably better off asking on a PyNomo forum or mailing list. Or at the very least the MacPython list. Ho

Re: [Tutor] Beep sound

2013-03-23 Thread Phil
On 24/03/13 03:42, Bod Soutar wrote: On Mar 23, 2013 2:24 AM, "Steven D'Aprano" mailto:st...@pearwood.info>> wrote: > > On 23/03/13 12:48, Phil wrote: >> >> Just out of curiosity how can a beep sound be generated? >> >> My interest in this came about because echo -e '\a' no longer works. A

Re: [Tutor] Beep sound

2013-03-23 Thread Steven D'Aprano
On 24/03/13 10:31, Phil wrote: Actually, I didn't think there was any need to make any guesses since "echo -e" is exclusively a Linux command. Nonsense. Not only does echo exist as a command on any Unix, including Apple Mac OS, FreeBSD, OpenBSD, Solaris and others, it also exists on Windows

[Tutor] Python based SMB 2.1/3 testing tool

2013-03-23 Thread Pankaj Agarwal
Hi, I'm looking for a tool like PySMB which can provide support for SMB 2.1. Any references will be appreciated. Thanks, Pankaj ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinf

Re: [Tutor] Beep sound

2013-03-23 Thread Phil
On 24/03/13 12:18, Steven D'Aprano wrote: On 24/03/13 10:31, Phil wrote: Actually, I didn't think there was any need to make any guesses since "echo -e" is exclusively a Linux command. Nonsense. Not only does echo exist as a command on any Unix, including Apple Mac OS, FreeBSD, OpenBSD, Solar