Re: is None or == None ?

2009-11-06 Thread Stefan Behnel
mk, 06.11.2009 15:32: > Stefan Behnel wrote: >>class Test(object): >>def __eq__(self, other): >>return other == None >> >>print Test() == None, Test() is None > > Err, I don't want to sound daft, but what is wrong in this example? It > should work as expected: > > >>>

Re: why does "help(import)" not work?

2009-11-06 Thread Brian Quinlan
Hi Robert, help() is just a regular function that must be called with correct Python syntax and the import keyword is not allowed in an argument list. The correct syntax is: help('import') Cheers, Brian On 6 Nov 2009, at 20:56, Robert P. J. Day wrote: i'm sure there's a painfully obviou

Re: why does "help(import)" not work?

2009-11-06 Thread Chris Rebert
On Fri, Nov 6, 2009 at 1:56 AM, Robert P. J. Day wrote: >  i'm sure there's a painfully obvious answer to this, but is there a > reason i can't do: > help(import) >  File "", line 1 >    help(import) >              ^ > SyntaxError: invalid syntax > >  on the other hand, i can certainly g

Re: why does "help(import)" not work?

2009-11-06 Thread Simon Brunning
2009/11/6 Robert P. J. Day : > >  i'm sure there's a painfully obvious answer to this, but is there a > reason i can't do: > help(import) >  File "", line 1 >    help(import) >              ^ > SyntaxError: invalid syntax import is a keyword, not an object. -- Cheers, Simon B. -- http://ma

why does "help(import)" not work?

2009-11-06 Thread Robert P. J. Day
i'm sure there's a painfully obvious answer to this, but is there a reason i can't do: >>> help(import) File "", line 1 help(import) ^ SyntaxError: invalid syntax >>> on the other hand, i can certainly go into "help()" and type "import" to get that help. it seems counter

Re: list to table

2009-11-06 Thread Gabriel Genellina
En Fri, 06 Nov 2009 04:29:05 -0300, Alf P. Steinbach escribió: * Gabriel Genellina: En Thu, 05 Nov 2009 21:23:27 -0300, Alf P. Steinbach escribió: foo()[bar()] += 1 One reason was as mentioned that the C++ standard has essentially the /same wording/ about "only evaluated once" but with

Re: What is the best way to delete strings in a string list that that match certain pattern?

2009-11-06 Thread Diez B. Roggisch
Peng Yu schrieb: Suppose I have a list of strings, A. I want to compute the list (call it B) of strings that are elements of A but doesn't match a regex. I could use a for loop to do so. In a functional language, there is way to do so without using the for loop. Nonsense. For processing over ea

Re: decoding a byte array that is unicode escaped?

2009-11-06 Thread Peter Otten
sam wrote: > I have a byte stream read over the internet: > > responseByteStream = urllib.request.urlopen( httpRequest ); > responseByteArray = responseByteStream.read(); > > The characters are encoded with unicode escape sequences, for example > a copyright symbol appears in the stream as the b

decoding a byte array that is unicode escaped?

2009-11-06 Thread sam
I have a byte stream read over the internet: responseByteStream = urllib.request.urlopen( httpRequest ); responseByteArray = responseByteStream.read(); The characters are encoded with unicode escape sequences, for example a copyright symbol appears in the stream as the bytes: 5C 75 30 30 61 39

Re: Is there a function that can test if a path is in a directory or one of its sub-directory (recursively)?

2009-11-06 Thread Chris Rebert
On Thu, Nov 5, 2009 at 10:49 PM, Gabriel Genellina wrote: > En Fri, 06 Nov 2009 00:53:14 -0300, Chris Rebert > escribió: >> On Thu, Nov 5, 2009 at 7:41 PM, Peng Yu wrote: >>> I looked though the os.path manual. I don't find a function that can >>> test if a path is in a directory or its sub-dire