Re: Comparing None and ints

2012-01-16 Thread Chris Angelico
On Tue, Jan 17, 2012 at 5:55 PM, Xavier Ho wrote: > Good to see Python3 got rid of that confusion :] Yep. Obviously you can still test for equality (they're not equal, of course), but now they're non-ordered. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing None and ints

2012-01-16 Thread Xavier Ho
Good to see Python3 got rid of that confusion :] Cheers, Xav On 17 January 2012 16:50, Chris Angelico wrote: > On Tue, Jan 17, 2012 at 5:47 PM, Xavier Ho wrote: > > What was the rationale behind this design? Specifically, (None < 0) == > True > > and (None == 0) == False? > > > > Personally

Re: Comparing None and ints

2012-01-16 Thread Chris Angelico
On Tue, Jan 17, 2012 at 5:47 PM, Xavier Ho wrote: > What was the rationale behind this design?  Specifically, (None < 0) == True > and (None == 0) == False? > > Personally I would have expected an exception on all tests above. Compare with Python 3: >>> None<0 Traceback (most recent call last):

Comparing None and ints

2012-01-16 Thread Xavier Ho
Hello, I discovered this strange property by accident: Python 2.7.2 (default, Nov 21 2011, 17:25:27) [GCC 4.6.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> None < 0 True >>> None == 0 False >>> None > 0 False >>> int(None) Traceback (most recent call last

Re: pymysql only works under IDLE

2012-01-16 Thread Saul Spatz
Thanks a lot; I didn't know about sys.executable. For the record, IDLE is running pythonw.exe. I won't have a chance to test if this helps till tomorrow, unfortunately. -- http://mail.python.org/mailman/listinfo/python-list

Re: pymysql only works under IDLE

2012-01-16 Thread Chris Rebert
On Mon, Jan 16, 2012 at 4:18 PM, Saul Spatz wrote: > I've been using pymysql to connect to a database, and it has suddenly stopped > working on the one machine (a virtual server) where I really need it to work. >  I have a function with hard-coded parameters to do the connection, and now > I'm

pymysql only works under IDLE

2012-01-16 Thread Saul Spatz
I've been using pymysql to connect to a database, and it has suddenly stopped working on the one machine (a virtual server) where I really need it to work. I have a function with hard-coded parameters to do the connection, and now I'm getting an error that says, "Can't connect to MySQL server o

Re: python loggingL filter limitation, looks intentional?

2012-01-16 Thread Vinay Sajip
On Jan 16, 11:21 pm, Vinay Sajip wrote: > > I thought from an earlier comment - "rather than just the root logger where > my handlers live" - that you had your handlers attached to the root logger, > in which case it wouldn't be onerous at all. In place of those individual > handlers attached t

Re: python loggingL filter limitation, looks intentional?

2012-01-16 Thread Vinay Sajip
> Why is this? There must be some rationale for this rather than what, for me > and > others I've talked to, would seem more natural, ie: a filter on the root > logger would get messages both logged to it and any messages propagated to it > from child loggers to process. Perhaps you're right

Re: python loggingL filter limitation, looks intentional?

2012-01-16 Thread Chris Withers
Hi Vinay, On 16/01/2012 15:08, Vinay Sajip wrote: Filtering is intended to be for cases where integer level-based filtering is insufficient; ...or where you want to manipulate log messages, which is the use case I have. You are right that you would need to add a filter to all of the logge

Elementwise 0.120116 -//- beta release -//- Lazily compute functions, method calls and operations on all elements of an iterable (or graph).

2012-01-16 Thread Nathan Rice
Elementwise provides helpful proxy objects which let you perform a series of computations on every element of an iterable or graph, in a lazy manner. Docs: http://packages.python.org/elementwise/ GitHub: https://github.com/nathan-rice/Elementwise Examples: The standard ElementwiseProxy: >>>

Re: Decorated class question

2012-01-16 Thread Ian Kelly
On Mon, Jan 16, 2012 at 8:10 AM, deathweaselx86 wrote: > Pardon me if this is a silly question. > > If I decorate a class, then subclass it, does my subclass feature > whatever the decorator did to my superclass? That depends on what the decorator did. Changes made directly to the class itself,

Re: Decorated class question

2012-01-16 Thread Devin Jeanpierre
On Mon, Jan 16, 2012 at 10:10 AM, deathweaselx86 wrote: > If I decorate a class, then subclass it, does my subclass feature > whatever the decorator did to my superclass? Yes. The following two things are completely equivalent: @foo class Bar(...): ... # and class Bar(...) ... # immedi

Decorated class question

2012-01-16 Thread deathweaselx86
Pardon me if this is a silly question. If I decorate a class, then subclass it, does my subclass feature whatever the decorator did to my superclass? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Deleted System default Python on Leopard

2012-01-16 Thread Benjamin Kaplan
On Mon, Jan 16, 2012 at 7:41 AM, Francesco Zhu wrote: > Hello everyone, > > recently I've started to be try Python on my Mac OS X 10.5.8 Leopard and > I've already messed up with it... > > I was compiling a Python souce code but didn't succeed and so I decided to > install a newer version of Pytho

Re: python loggingL filter limitation, looks intentional?

2012-01-16 Thread Vinay Sajip
Hi Chris, Filtering is intended to be for cases where integer level-based filtering is insufficient; hence it applies to individual loggers and handlers, just as the integer levels do.  You are right that you would need to add a filter to all of the loggers where you want it to apply, or to all

python loggingL filter limitation, looks intentional?

2012-01-16 Thread Chris Withers
Hi Vinay, It looks like this was intentional, so why was it decided that filters would only be passed messages logged to the logger they're attached to rather than the all messages that end up getting passed to logger? For example, an app and the libraries it uses log to 'some.db.driver', 's

Deleted System default Python on Leopard

2012-01-16 Thread Francesco Zhu
Hello everyone, recently I've started to be try Python on my Mac OS X 10.5.8 Leopard and I've already messed up with it... I was compiling a Python souce code but didn't succeed and so I decided to install a newer version of Python. But before that, I did a stupid thing: I deleted manually all

Re: NaN, Null, and Sorting

2012-01-16 Thread Robert Kern
On 1/16/12 10:57 AM, Chris Angelico wrote: On Mon, Jan 16, 2012 at 9:22 PM, Eelco wrote: What you want, conceptually, is a sorted list of the sortable entries, and a seperate list of the unsorted entries. Translated into code, the most pure solution would be to filter out the nanas/nulls in the

Re: NaN, Null, and Sorting

2012-01-16 Thread Chris Angelico
On Mon, Jan 16, 2012 at 9:22 PM, Eelco wrote: > What you want, conceptually, is a > sorted list of the sortable entries, and a seperate list of the > unsorted entries. Translated into code, the most pure solution would > be to filter out the nanas/nulls in their own list first, and then > sort the

Re: NaN, Null, and Sorting

2012-01-16 Thread Eelco
On 13 jan, 20:04, Ethan Furman wrote: > With NaN, it is possible to get a list that will not properly sort: > > --> NaN = float('nan') > --> spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN] > --> sorted(spam) > [1, 2, nan, 3, nan, 4, 5, 7, nan] > > I'm constructing a Null object with the semantics that if

Re: Hash stability

2012-01-16 Thread Heiko Wundram
Am 16.01.2012 09:44, schrieb Christian Heimes: Am 16.01.2012 09:18, schrieb Peter Otten: I've taken a quick look into the suds source; the good news is that you have to change a single method, reader.Reader.mangle(), to fix the problem with hash stability. However, I didn't see any code to deal

Re: Hash stability

2012-01-16 Thread Christian Heimes
Am 16.01.2012 09:18, schrieb Peter Otten: > I've taken a quick look into the suds source; the good news is that you have > to change a single method, reader.Reader.mangle(), to fix the problem with > hash stability. > > However, I didn't see any code to deal with hash collisions at all. It sme

Re: Hash stability

2012-01-16 Thread Peter Otten
Heiko Wundram wrote: > Am 15.01.2012 13:22, schrieb Peter Otten: >> I'm curious: did you actually get false cache hits in a suds cache >> or just slower responses? > It broke the application using suds, not due to false cache hits, but > due to not getting a cache hit anymore at all. > so ba