Re: python-2.6.2 Exception: TypeError: "'NoneType' object is not callable" in ignored

2009-06-14 Thread Poor Yorick
Terry Reedy wrote: > Poor Yorick wrote: >> The following code produces an error (python-2.6.2). > > You forgot to post the error traceback. > There was no traceback, but following John Machin's prodding, I read back through some older posts (including one of yours) whic

python-2.6.2 Exception: TypeError: "'NoneType' object is not callable" in ignored

2009-06-14 Thread Poor Yorick
The following code produces an error (python-2.6.2). Either of the following eliminates the error: . assign something besides mod1 (the newly-created module) to d1 . remove the call to shelve.open Why is there an error produced in the first place? What is the interaction between d1, m

loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Poor Yorick
In the following snippet, the loop in the global namespace takes twice as long as the loop in the function namespace. Why? limit = 5000 def f1(): counter = 0 while counter < limit: counter += 1 time1 = time.time() f1() print(time.time() - time

__future__ and compile: unrecognised flags

2008-12-13 Thread Poor Yorick
I have a future statement in a script which is intended to work in 2.6 and 3. Shouldn't compile flags in __future__ objects essentially be noops for versions that already support the feature? doctest is complaining about unrecognised flags. This illustrates the problem: Python 3.0 (r30:67507,

__future__ and unrecognised flags

2008-12-12 Thread Poor Yorick
I have a future statement in a script I intend to work on 2.6 and 3. Shouldn't __future__ statements basically be noops for versions that already support the feature? doctest is complaining about compiler flags. This illustrates the problem: Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [

Python3: sorting image objects according to a cmp function

2008-12-03 Thread Poor Yorick
I'm looking for a Python3-compatible way to sort a list of PIL image objects based on a computed difference between the two images. In 2.x, this would work: imagelist.sort(cmp=image_diff(a,b)) Maybe this could be done by creating a new class with the appropriate __lt__, gt__, __eq__ metho

install python to custom prefix with custom library directories

2007-07-17 Thread Poor Yorick
x27;, ] +self.compiler.include_dirs.insert(0, +'/my/custom/path/include') inc_dirs = self.compiler.include_dirs + ['/usr/include'] exts = [] -- Poor Yorick -- http://mail.python.org/mailman/listinfo/python-list

access to the namespace of a function from within its invocation

2007-07-12 Thread Poor Yorick
print 'need something like me().data' return tmpfunc fun1.s = fun1 fun1.data=['one', 'two', 'three'] fun1() fun2 = makefun() fun2.data=['four', 'five','six'] fun2() ###code end### -- Poor Yorick -- http://mail.python.org/mailman/listinfo/python-list