Wingware Python IDE version 3.2.4 released
Hi, Wingware has released version 3.2.4 of Wing IDE, our integrated development environment for the Python programming language. Wing IDE can be used on Windows, Linux, and OS X to develop Python code for web, GUI, and embedded scripting applications. Wing IDE provides auto-completion, call tips, a powerful debugger, unit testing, version control, search, and many other features. This release includes the following minor features and improvements: * Corrected support for non-ascii I/O when debugging under Python 3.x * Support debugging of wide unicode builds of Python 3.x * Improve GUI responsiveness in very large projects (optimized external file change checking) * Auto-enter last failed or canceled version control commit message * Added context menu for copy/paste to commit message area in version control tools * Version control annotate commands like 'svn blame' show results in scratch buffer * Many other minor features and bug fixes; See the change log at http://wingware.com/pub/wingide/3.2.4/CHANGELOG.txt for details *Wing 3.2 Highlights* Version 3.2 of Wing IDE includes the following new features not present in Wing IDE 3.1: * Support for Python 3.0 and 3.1 * Rewritten version control integration with support for Subversion, CVS, Bazaar, git, Mercurial, and Perforce (*) * Added 64-bit Debian, RPM, and tar file installers for Linux * File management in Project view (**) * Auto-completion in the editor obtains completion data from live runtime when the debugger is active (**) * Perspectives: Create and save named GUI layouts and optionally automatically transition when debugging is started (*) * Improved support for Cython and Pyrex (*.pyx files) * Added key binding documentation to the manual * Added Restart Debugging item in Debug menu and tool bar (**) * Improved OS Commands and Bookmarks tools (*) (*)'d items are available in Wing IDE Professional only. (**)'d items are available in Wing IDE Personal and Professional only. The release also contains many other minor features and bug fixes; see the change log for details: http://wingware.com/pub/wingide/3.2.4/CHANGELOG.txt *Downloads* Wing IDE Professional and Wing IDE Personal are commercial software and require a license to run. A free trial license can be obtained directly from the product when launched. Wing IDE 101 can be used free of charge. Wing IDE Pro 3.2.4http://wingware.com/downloads/wingide/3.2 Wing IDE Personal 3.2.4 http://wingware.com/downloads/wingide-personal/3.2 Wing IDE 101 3.2.4http://wingware.com/downloads/wingide-101/3.2 *About Wing IDE* Wing IDE is an integrated development environment for the Python programming language. It provides powerful debugging, editing, code intelligence, testing, version control, and search capabilities that reduce development and debugging time, cut down on coding errors, and make it easier to understand and navigate Python code. Wing IDE is available in three product levels: Wing IDE Professional is the full-featured Python IDE, Wing IDE Personal offers a reduced feature set at a low price, and Wing IDE 101 is a free simplified version designed for teaching entry level programming courses with Python. System requirements are Windows 2000 or later, OS X 10.3.9 or later for PPC or Intel (requires X11 Server), or a recent Linux system (either 32 or 64 bit). Wing IDE 3.2 supports Python versions 2.0.x through 3.1.x. *Purchasing and Upgrading* Wing 3.2 is a free upgrade for all Wing IDE 3.0 and 3.1 users. Any 2.x license sold after May 2nd 2006 is free to upgrade; others cost 1/2 the normal price to upgrade. Upgrade a 2.x license: https://wingware.com/store/upgrade Purchase a 3.x license:https://wingware.com/store/purchase -- The Wingware Team Wingware | Python IDE Advancing Software Development www.wingware.com -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
[ANN]: circuits-1.2.1
Hi, I'm pleased to announce the release of circuits-1.2.1 This is a minor bug fix release. == About == circuits is a Lightweight Event driven Framework for the Python Programming Language, with a strong Component Architecture. circuits also includes a lightweight, high performance and scalable HTTP/WSGI web server (with some similar features to CherryPy) as well as various I/O and Networking components. circuits has a clean architecture and has no required external dependencies. It has a small footprint and delivers a powerful set of features for building large, scalable, maintainable applications and systems. circuits comes with a suite of standard components that can be quickly utilzed to create applications from a simple tool to a complex distributed web application. == Links == * Home Page: http://code.google.com/p/circuits/ * Mailing list: http://groups.google.com.au/group/circuits-users/ * Download: http://code.google.com/p/circuits/downloads/list * API Docs: http://circuits.googlecode.com/hg/docs/html/circuits-module.html cheers James -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
expy 0.5.1 released
Hi there, EXPY 0.5.1 released, the exception raising feature is enhanced so that you can raise any builtin exceptions. Custom exceptions will be supported soon. For more information, see http://expy.sourceforge.net/ EXPY is an expressway to extend Python! Regards, Yingjie -- http://mail.python.org/mailman/listinfo/python-list
Why this error message
Guys, I apologize for the last email asking for help I am going to have to remember to check my indentation. Ray -- http://mail.python.org/mailman/listinfo/python-list
Re: get error install MySQLdb on Mac OS X
On Jan 29, 5:02 am, Sean DiZazzo half.ital...@gmail.com wrote: On Jan 28, 12:53 pm, PS.OHM ps.o...@gmail.com wrote: Hello Guys I havegetsomeerrorwhen i install MySQLdb on Mac OS X after i key command $python setup.py build rusult is : : error: command 'gcc-4.0' failed with exit status 1 How to config this poblem? Please show a little bit more of theerror iME-macbook-pro:MySQL-python-1.2.3c1 iME$ python setup.py build running build running build_py copying MySQLdb/release.py - build/lib.macosx-10.3-fat-2.6/MySQLdb running build_ext building '_mysql' extension gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 - Dversion_info=(1,2,3,'gamma',1) -D__version__=1.2.3c1 -I/Applications/ MAMP/Library/include/mysql -I/Library/Frameworks/Python.framework/ Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.3- fat-2.6/_mysql.o -fno-omit-frame-pointer -D_P1003_1B_VISIBLE - DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ - DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL _mysql.c:36:23: error: my_config.h: No such file or directory _mysql.c:38:19: error: mysql.h: No such file or directory _mysql.c:39:26: error: mysqld_error.h: No such file or directory _mysql.c:40:20: error: errmsg.h: No such file or directory _mysql.c:76: error: syntax error before ‘MYSQL’ _mysql.c:76: warning: no semicolon at end of struct or union _mysql.c:79: error: syntax error before ‘}’ token _mysql.c:79: warning: data definition has no type or storage class _mysql.c:90: error: syntax error before ‘MYSQL_RES’ _mysql.c:90: warning: no semicolon at end of struct or union _mysql.c:94: error: syntax error before ‘}’ token _mysql.c:94: warning: data definition has no type or storage class _mysql.c:106: error: syntax error before ‘*’ token _mysql.c: In function ‘_mysql_Exception’: _mysql.c:120: error: ‘c’ undeclared (first use in this function) _mysql.c:120: error: (Each undeclared identifier is reported only once _mysql.c:120: error: for each function it appears in.) _mysql.c:123: error: ‘CR_MAX_ERROR’ undeclared (first use in this function) _mysql.c:131: error: ‘CR_COMMANDS_OUT_OF_SYNC’ undeclared (first use in this function) _mysql.c:132: error: ‘ER_DB_CREATE_EXISTS’ undeclared (first use in this function) _mysql.c:133: error: ‘ER_SYNTAX_ERROR’ undeclared (first use in this function) _mysql.c:134: error: ‘ER_PARSE_ERROR’ undeclared (first use in this function) _mysql.c:135: error: ‘ER_NO_SUCH_TABLE’ undeclared (first use in this function) _mysql.c:136: error: ‘ER_WRONG_DB_NAME’ undeclared (first use in this function) _mysql.c:137: error: ‘ER_WRONG_TABLE_NAME’ undeclared (first use in this function) _mysql.c:138: error: ‘ER_FIELD_SPECIFIED_TWICE’ undeclared (first use in this function) _mysql.c:139: error: ‘ER_INVALID_GROUP_FUNC_USE’ undeclared (first use in this function) _mysql.c:140: error: ‘ER_UNSUPPORTED_EXTENSION’ undeclared (first use in this function) _mysql.c:141: error: ‘ER_TABLE_MUST_HAVE_COLUMNS’ undeclared (first use in this function) _mysql.c:170: error: ‘ER_DUP_ENTRY’ undeclared (first use in this function) _mysql.c:213: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast _mysql.c: At top level: _mysql.c:358: error: syntax error before ‘*’ token _mysql.c: In function ‘_mysql_ResultObject_Initialize’: _mysql.c:363: error: ‘MYSQL_RES’ undeclared (first use in this function) _mysql.c:363: error: ‘result’ undeclared (first use in this function) _mysql.c:364: error: ‘conn’ undeclared (first use in this function) _mysql.c:368: error: ‘MYSQL_FIELD’ undeclared (first use in this function) _mysql.c:368: error: ‘fields’ undeclared (first use in this function) _mysql.c:370: error: ‘args’ undeclared (first use in this function) _mysql.c:370: error: ‘kwargs’ undeclared (first use in this function) _mysql.c:375: error: ‘self’ undeclared (first use in this function) _mysql.c: At top level: _mysql.c:445: error: syntax error before ‘*’ token _mysql.c: In function ‘_mysql_ResultObject_traverse’: _mysql.c:450: error: ‘self’ undeclared (first use in this function) _mysql.c:451: error: ‘arg’ undeclared (first use in this function) _mysql.c: At top level: _mysql.c:460: error: syntax error before ‘*’ token _mysql.c: In function ‘_mysql_ResultObject_clear’: _mysql.c:462: error: ‘self’ undeclared (first use in this function) _mysql.c: At top level: _mysql.c:471: error: syntax error before ‘*’ token _mysql.c: In function ‘_mysql_ConnectionObject_Initialize’: _mysql.c:475: error: ‘MYSQL’ undeclared (first use in this function) _mysql.c:475: error: ‘conn’ undeclared (first use in this function) _mysql.c:500: error: ‘self’ undeclared (first use in this function) _mysql.c:503: error: ‘args’ undeclared (first use in this function) _mysql.c:503: error: ‘kwargs’ undeclared (first use in this function) _mysql.c:550: error: ‘MYSQL_OPT_CONNECT_TIMEOUT’ undeclared (first use in this function)
Re: whassup? builtins? python3000? Naah can't be right?
Hey, it's really simple! Just like the excerpt from the Learning Python book says: Really, the built-in scope is just a built-in module called builtins, but you have to import builtins to query built-ins because the name builtins is not itself built-in :) -- http://mail.python.org/mailman/listinfo/python-list
Re: HTML Parser which allows low-keyed local changes?
Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the human edited format of the original HTML code. makes it rather unreadable. What do you mean? Could you give an example? lxml certainly does not destroy anything it parsed, unless you tell it to do so. Stefan -- http://mail.python.org/mailman/listinfo/python-list
how long a Str can be used in this python code segment?
tmp=file.read() (very huge file) if targetStr in tmp: print find it else: print not find file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some certain information on this prolbem? -- http://mail.python.org/mailman/listinfo/python-list
Re: gmtime
gazza wrote: Hi, I am trying to discover how to obtain the correct time of say CST/ America and EST/America in python? Any help on this would be appreciated. Thanks, Garyc The datetime module should give you all you need. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list
Re: how long a Str can be used in this python code segment?
On Mon, Feb 1, 2010 at 1:17 AM, Stephen.Wu 54wut...@gmail.com wrote: tmp=file.read() (very huge file) if targetStr in tmp: print find it else: print not find file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some certain information on this prolbem? If the file's contents is larger than available memory, you'll get a MemoryError. To avoid this, you can read the file in by chunks (or if applicable, by lines) and see if each chunk/line matches. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: how long a Str can be used in this python code segment?
Stephen.Wu wrote: tmp=file.read() (very huge file) if targetStr in tmp: print find it else: print not find file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some certain information on this prolbem? Python has no specific limit on string size other than memory size and perhaps 32 bit address space and so on. However, if your file size is even a fraction of that size, you should not attempt to read it all into memory at once. Is there not a way to process your file in batches of a reasonable size? Gary Herron -- http://mail.python.org/mailman/listinfo/python-list
Re: how long a Str can be used in this python code segment?
On Feb 1, 5:26 pm, Chris Rebert c...@rebertia.com wrote: On Mon, Feb 1, 2010 at 1:17 AM, Stephen.Wu 54wut...@gmail.com wrote: tmp=file.read() (very huge file) if targetStr in tmp: print find it else: print not find file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some certain information on this prolbem? If the file's contents is larger than available memory, you'll get a MemoryError. To avoid this, you can read the file in by chunks (or if applicable, by lines) and see if each chunk/line matches. Cheers, Chris --http://blog.rebertia.com actually, I just use file.read(length) way, i just want to know what exactly para of length I should set, I'm afraid length doesn't equal to the amount of physical memory after trials... -- http://mail.python.org/mailman/listinfo/python-list
Re: how long a Str can be used in this python code segment?
Stephen.Wu, 01.02.2010 10:17: tmp=file.read() (very huge file) if targetStr in tmp: print find it else: print not find file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some certain information on this prolbem? Others have already pointed out that reading the entire file into memory is not a good idea. Try reading chunks repeatedly instead. As it appears that you simply try to find out if a file contains a specific byte sequence, you might find acora interesting: http://pypi.python.org/pypi/acora Also note that there are usually platform optimised tools available to search content in files, e.g. grep. It's basically impossible to beat their raw speed even with hand-tuned Python code, so running the right tool using the subprocess module might be a solution. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3147 - new .pyc format
PEP 3147 has just been posted, proposing that, beginning in release 3.2 (and possibly 2.7) compiled .pyc and .pyo files be placed in a directory with a .pyr extension. The reason is so that compiled versions of a program can coexist, which isn't possible now. Frankly, I think this is a really good idea, although I've got a few comments. 1. Apple's MAC OS X should be mentioned, since 10.5 (and presumably 10.6) ship with both Python release 2.3 and 2.5 installed. 2. I think the proposed logic is too complex. If this is installed in 3.2, then that release should simply store its .pyc file in the .pyr directory, without the need for either a command line switch or an environment variable (both are mentioned in the PEP.) 3. Tool support. There are tools that look for the .pyc files; these need to be upgraded somehow. The ones that ship with Python should, of course, be fixed with the PEP, but there are others. 4. I'm in favor of putting the source in the .pyr directory as well, but that's got a couple more issues. One is tool support, which is likely to be worse for source, and the other is some kind of algorithm for identifying which source goes with which object. I also think the PEP is a great idea and proposes a solution to a real problem. But I also hear the 'directory clutter' argument and I'm really concerned too, having all these extra directories around (and quite a large number of them indeed!). How about this scheme: 1. install python source files to a shared (among python installations) location /this/is/shared 2. when python X.Y imports a source file from /this/is/shared it will create pyc files in its private area /usr/lib/pythonX.Y/site-packages/ Time comparison would be between /this/is/shared/x.py and /usr/lib/pythonX.Y/site-packages/x.pyc, for instance. Obviously pythonX.Y needs to know the path to /this/is/shared so it can import modules from there, but this can be controlled by an environment variable. There would be only .py files in /this/is/shared. Linux distro packagers would only offer a single python-myapp to install and it would only contain python source, and the version-specific pyc files would be created the first time the application is used by python. In /usr/lib/pythonX.Y/site-packages there would be only pyc files with magic number matching python X.Y. So, basically nothing would change only the location of py and pyc files would be different from current behavior, but the same algorithm would be run to determine which one to load, when to create a pyc file, when to ignore the old one, etc. What would be wrong with this setup? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list
User-defined exceptions from 2.6
Which is the best way to create user-defined exceptions since that *BaseException.message* is deprecated in Python 2.6 ? -- http://mail.python.org/mailman/listinfo/python-list
Re: SimpleXMLRPCServer daemon
Gabriel Genellina wrote: En Fri, 29 Jan 2010 12:54:23 -0300, Thomas Allen thomasmal...@gmail.com escribió: I have a script that runs an instance of SimpleXMLRPCServer and in general it works as expected. In its __del__, it is supposed to clean up its PID file (written on boot). I have two problems with this server instance: The first is that tt doesn't always clean up its PID file; is there a more reliable way to do this than how I am currently? The second is that when it does crash, I don't know about it...what would be sufficient as a keep-alive script to restart it? I suppose I could use something like EventMachine (already installed on my server) to watch the PID file if it were deleted reliably. I agree with the recommendation of using some daemon library; doing it right is better left to the experts :) But if you can't or don't want to alter your code so much, I suggest: - use atexit.register, instead of __del__, to delete the PID file - keep a lock on the pid file; if a second instance is able to write to it, it means it's an orphan from a previous, aborted run. (Checking whether a process with such pid exists is not enough - pids are recycled rather fast) see also http://code.activestate.com/recipes/278731/ JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Python-list Digest, Vol 77, Issue 7 *
Hello Help for datetime module Source code is : *from *datetime *import *datetime d = datetime(datetime.now().year, datetime.now().month, datetime.now().day, 11, 59, 0 ) print d On Mon, Feb 1, 2010 at 3:44 PM, python-list-requ...@python.org wrote: Junk Score: 2 out of 10 (below your Auto Allow thresholdhttps://www.boxbe.com/mail-screening) | Approve sender https://www.boxbe.com/anno?tc=1488077305_3972850 | Block sender https://www.boxbe.com/anno?tc=1488077305_3972850disp=b | Block domain https://www.boxbe.com/anno?tc=1488077305_3972850disp=bdom Send Python-list mailing list submissions to python-list@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/python-list or, via email, send a message with subject or body 'help' to python-list-requ...@python.org You can reach the person managing the list at python-list-ow...@python.org When replying, please edit your Subject line so it is more specific than Re: Contents of Python-list digest... Today's Topics: 1. Re: whassup? builtins? python3000? Naah can't be right? (Andrej Mitrovic) 2. gmtime (gazza) 3. Re: A performance issue when using default value (keakon) 4. Re: HTML Parser which allows low-keyed local changes? (Stefan Behnel) 5. how long a Str can be used in this python code segment? (Stephen.Wu) 6. Re: gmtime (Gary Herron) 7. Re: how long a Str can be used in this python code segment? (Chris Rebert) 8. Re: how long a Str can be used in this python code segment? (Gary Herron) 9. Re: Keyboard input (Dennis Lee Bieber) 10. Re: how long a Str can be used in this python code segment? (Stephen.Wu) 11. Re: how long a Str can be used in this python code segment? (Stefan Behnel) 12. Re: PEP 3147 - new .pyc format (Daniel Fetchinson) -- Forwarded message -- From: Andrej Mitrovic andrej.mitrov...@gmail.com To: Date: Sun, 31 Jan 2010 20:01:57 -0800 (PST) Subject: Re: whassup? builtins? python3000? Naah can't be right? Hey, it's really simple! Just like the excerpt from the Learning Python book says: Really, the built-in scope is just a built-in module called builtins, but you have to import builtins to query built-ins because the name builtins is not itself built-in :) -- Forwarded message -- From: gazza burslem2...@yahoo.com To: Date: Sun, 31 Jan 2010 13:27:46 -0800 (PST) Subject: gmtime Hi, I am trying to discover how to obtain the correct time of say CST/ America and EST/America in python? Any help on this would be appreciated. Thanks, Garyc -- Forwarded message -- From: keakon kea...@gmail.com To: Date: Sun, 31 Jan 2010 21:20:28 -0800 (PST) Subject: Re: A performance issue when using default value Even this style is 41 times faster than h2(): def i2(x=[]): y = x if not y: # add this line y = [] # add this line y.append(1) return y + [] print Timer('i2()','from __main__ import f2, g2, h2, i2').timeit (TIMES) Time: 0.00742356919664 -- Forwarded message -- From: Stefan Behnel stefan...@behnel.de To: Date: Mon, 01 Feb 2010 09:34:28 +0100 Subject: Re: HTML Parser which allows low-keyed local changes? Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the human edited format of the original HTML code. makes it rather unreadable. What do you mean? Could you give an example? lxml certainly does not destroy anything it parsed, unless you tell it to do so. Stefan -- Forwarded message -- From: Stephen.Wu 54wut...@gmail.com To: python-list@python.org Date: Mon, 1 Feb 2010 01:17:09 -0800 (PST) Subject: how long a Str can be used in this python code segment? tmp=file.read() (very huge file) if targetStr in tmp: print find it else: print not find file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some certain information on this prolbem? -- Forwarded message -- From: Gary Herron gher...@islandtraining.com To: python-list@python.org python-list@python.org Date: Mon, 01 Feb 2010 01:23:31 -0800 Subject: Re: gmtime gazza wrote: Hi, I am trying to discover how to obtain the correct time of say CST/ America and EST/America in python? Any help on this would be appreciated. Thanks, Garyc The datetime module should give you all you need. Gary Herron -- Forwarded message -- From: Chris Rebert c...@rebertia.com To: Stephen.Wu 54wut...@gmail.com Date: Mon, 1 Feb 2010 01:26:55 -0800 Subject: Re: how long a Str can be used in this python code segment? On Mon, Feb 1, 2010 at 1:17 AM, Stephen.Wu 54wut...@gmail.com wrote: tmp=file.read() (very huge file)
Any Python Module to send ring tones from PC to mobile via GSM modem
Hi group, Is there any python module available which sends ring tones from our PC to mobile phone using GSM Modem. I googled in vain to find a solution .I can find few modules like pygsm ,singshotsms by which only sms is send .I could appreciate if some one helps me to find a way to send ring tones . Thanks Ganesh -- http://mail.python.org/mailman/listinfo/python-list
how to decode rtf characterset ?
hello, I want to translate rtf files to unicode strings. I succeeded in remove all the tags, but now I'm stucked to the special accent characters, like : Vóór the character ó is represented by the string r\'f3, or in bytes: 92, 39,102, 51 so I think I need a way to translate that into the string r\xf3 but I can't find a way to accomplish that. a Any suggestions are very welcome. thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list
Re: [Edu-sig] odd drawing problem with turtle.py
On Jan 31, 2010, at 23:05 , John Posner wrote: Try commenting out this statement: self.turtle.tracer(False) That helps on Python 2.6.4. interesting. It seems as if the tracer property is a global one: In [1]:t1=Turtle() In [2]:t1.tracer() Out[2]:1 In [3]:t1.tracer(False) In [4]:t1.tracer() Out[4]:0 In [5]:t2=Turtle() In [6]:t2.tracer() Out[6]:0 In [7]:t2.tracer(True) In [8]:t1.tracer() Out[8]:1 looks like I need to set the tracer manually. however, even if the tracer is off, shouldn't it still draw the line? when I put in the T.tracer(True) it works, but I shouldn't need to I think. On Jan 31, 2010, at 21:11 , kirby urner wrote: I don't see where you've defined a Turtle class to instantiate sir. Turtle is given in turtle.py. I should have subclassed it, but I was being lazy. :) thanks for the fast replies! bb On Sun, Jan 31, 2010 at 4:27 PM, Brian Blais bbl...@bryant.edu wrote: I'm on Python 2.5, but using the updated turtle.py Version 1.0.1 - 24. 9. 2009. The following script draws 5 circles, which it is supposed to, but then doesn't draw the second turtle which is supposed to simply move forward. Any ideas? from turtle import * from numpy.random import randint resetscreen() class Circle(object): def __init__(self,x,y,r,color): self.x=x self.y=y self.r=r self.color=color self.turtle=Turtle(visible=False) self.turtle.tracer(False) self.draw() def draw(self): self.turtle.penup() self.turtle.setposition(self.x,self.y) self.turtle.setheading(0) self.turtle.backward(self.r) self.turtle.pendown() self.turtle.fill(True) self.turtle.pencolor(black) self.turtle.fillcolor(self.color) self.turtle.circle(self.r) self.turtle.fill(False) self.turtle.penup() for i in range(5): c=Circle(randint(-350,350),randint(-250,250),10,red) T=Turtle() T.forward(100) T.forward(100) thanks, bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ ___ Edu-sig mailing list edu-...@python.org http://mail.python.org/mailman/listinfo/edu-sig -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Any Python Module to send ring tones from PC to mobile via GSM modem
Hi Ganesh, Am 01.02.2010 11:35, schrieb guptha: Hi group, Is there any python module available which sends ring tones from our PC to mobile phone using GSM Modem. I googled in vain to find a solution .I can find few modules like pygsm ,singshotsms by which only sms is send .I could appreciate if some one helps me to find a way to send ring tones . If you really want to send via GSM (e.g. over the air to another Phone) it seems you need to generate an MMS instead of SMS. If thats not the case and you only want to upload tones to your phone via wire/bluetooth, obex should be the key to find more information on how to do that. Regards Tino smime.p7s Description: S/MIME Cryptographic Signature -- http://mail.python.org/mailman/listinfo/python-list
Embedded python 2.6 in C++ problems
Hi, I'm extending some old Visual Studio 6 MFC code to add embedded python scripting. It works fine most of the time but some python function calls do not work as expected. The C++ code is a multithreaded MFC application. I was assuming that it was GIL issues but I have tried using the manual locking (PyEval_SaveThread PyEval_RestoreThread) and what seems to be the current method (PyGILState_Ensure PyGILState_Release) Here's the error I'm getting: Traceback (most recent call last): File ...scripts\receipt_parser.py, line 296, in get_giftcard_purchase_value details = extract_transaction_details_section(test) File ...scripts\receipt_parser.py, line 204, in extract_transaction_details_section for line in base_details: TypeError: expected string or Unicode object, NoneType found base_details is a string variable and the code runs fine when run from standard interpreter. Many other function calls work fine from the embedded app. I create and then Py_DECREF the function parameters and the return value after each function call. The module import is created at C++ object constructor and then Py_DECREF'd in the desctuctor Anyone else had issues of this kind? Thanks, Paul. -- http://mail.python.org/mailman/listinfo/python-list
Embedded python 2.6 in C++ problems
Hi, I'm extending some old Visual Studio 6 MFC code to add embedded python scripting. It works fine most of the time but some python function calls do not work as expected. The C++ code is a multithreaded MFC application. I was assuming that it was GIL issues but I have tried using the manual locking (PyEval_SaveThread PyEval_RestoreThread) and what seems to be the current method (PyGILState_Ensure PyGILState_Release) Here's the error I'm getting: Traceback (most recent call last): File ...scripts\receipt_parser.py, line 296, in get_giftcard_purchase_value details = extract_transaction_details_section(test) File ...scripts\receipt_parser.py, line 204, in extract_transaction_details_section for line in base_details: TypeError: expected string or Unicode object, NoneType found base_details is a string variable and the code runs fine when run from standard interpreter. Many other function calls work fine from the embedded app. I create and then Py_DECREF the function parameters and the return value after each function call. The module import is created at C++ object constructor and then Py_DECREF'd in the desctuctor Anyone else had issues of this kind? Thanks, Paul. -- http://mail.python.org/mailman/listinfo/python-list
Re: recv_into(bytearray) complains about a pinned buffer
Le Mon, 01 Feb 2010 03:30:56 +0100, Martin v. Loewis a écrit : Is this a bug in Python 2.6 or a deliberate choice regarding implementation concerns I don't know about? It's actually a bug also that you pass an array; doing so *should* give the very same error. Well, if you can give neither an array nor a bytearray to recv_into(), what *could* you give it? recv_into() should simply be fixed to use the new buffer API, as it does in 3.x. -- http://mail.python.org/mailman/listinfo/python-list
Re: Any Python Module to send ring tones from PC to mobile via GSM modem
Hi,Tino Thanks for your reply, My PC is connected with cell phone (through data card) as a modem,and my OS is Ubuntu I have to send ring tones from my PC to any other cell phone by using connected cell phone as a modem (Your first case satisfy my need ) I think with pygsm, it is not possible to send MMS,if so what could be the apt python module to work with .what about python-gammu? can any one point me a url which gives detail tutorial on this topic thanks ganesh -- http://mail.python.org/mailman/listinfo/python-list
libpcap and python
Hello All, I used tcpdump to capture data on my network. I would like to analyze the data using python -- currently using ethereal and wireshark. I would like to get certain type of packets (I can get the hex code for them), what is the best way to do this? Lets say I want to capture all events of `ping localhost` TIA -- http://mail.python.org/mailman/listinfo/python-list
Re: User-defined exceptions from 2.6
On Mon, 01 Feb 2010 02:19:39 -0800, Joan Miller wrote: Which is the best way to create user-defined exceptions since that *BaseException.message* is deprecated in Python 2.6 ? Inherit from an existing exception. class MyValueException(ValueError): ... pass ... raise MyValueException(value is impossible, try again) Traceback (most recent call last): File stdin, line 1, in module __main__.MyValueException: value is impossible, try again class GenericError(Exception): ... pass ... raise GenericError(oops) Traceback (most recent call last): File stdin, line 1, in module __main__.GenericError: oops Do you need anything more complicated? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
Steven D'Aprano wrote: On Sun, 31 Jan 2010 22:43:56 -0800, alex23 wrote: Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: You're using that term wrong. It looks to me that you don't actually know what a straw man argument is. A straw man argument is when somebody responds to a deliberately weakened or invalid argument as if it had been made by their opponent. Jeez, Steve, you're beginning to sound like some kind of fallacy zealot... ;) Death to all those who confuse agumentum ad populum with argumentum ad verecundiam!!! Yeah, what did the zealots ever do for us? regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS:http://holdenweb.eventbrite.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: User-defined exceptions from 2.6
On 1 feb, 12:45, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 01 Feb 2010 02:19:39 -0800, Joan Miller wrote: Which is the best way to create user-defined exceptions since that *BaseException.message* is deprecated in Python 2.6 ? Inherit from an existing exception. class MyValueException(ValueError): ... pass ... raise MyValueException(value is impossible, try again) Traceback (most recent call last): File stdin, line 1, in module __main__.MyValueException: value is impossible, try again class GenericError(Exception): ... pass ... raise GenericError(oops) Traceback (most recent call last): File stdin, line 1, in module __main__.GenericError: oops Do you need anything more complicated? It's enought, thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
Terry Reedy wrote: On 1/31/2010 7:25 PM, Steven D'Aprano wrote: On Sun, 31 Jan 2010 15:40:36 -0800, Chris Rebert wrote: On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote: In most functional languages you just name a function to access it and you do it ALL the time. for example, in if you have a function 'f' which takes two parameters to call the function and get the result you use: f 2 3 If you want the function itself you use: f How do you call a function of no arguments? It's not really a function in that case, it's just a named constant. (Recall that functions don't/can't have side-effects.) Three of you gave essentially identical answers, but I still do not see how given something like def f(): return 1 I differentiate between 'function object at address xxx' and 'int 1' objects. But in a functional environment you don't need to. That's pretty much the whole point. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS:http://holdenweb.eventbrite.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: HTML Parser which allows low-keyed local changes (upon serialization)
Stefan Behnel wrote: Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the human edited format of the original HTML code. makes it rather unreadable. What do you mean? Could you give an example? lxml certainly does not destroy anything it parsed, unless you tell it to do so. of course it does not destroy during parsing.(?) I mean: I want to walk with a Python script through the parsed tree HTML and modify here and there things (auto alt tags from DB/similar, link corrections, text sections/translated sentences... due to HTML code and content checks.) Then I want to output the changed tree - but as close to the original format as far as possible. No changes to my white space identation, etc.. Only lokal changes, where really tags where changed. Thats similiar like that what a good HTML editor does: After you made little changes, it doesn't reformat/re-spit-out your whole code layout from tree/attribute logic only. you have lokal changes only. But a simple HTML editor like that in Mozilla-Seamonkey outputs a whole new HTML, produces the HTML from logical tree only (regarding his (ugly) style), destroys my whitspace layout and much more - forgetting anything about the original layout. Such a good HTML editor must somehow track the original positions of the tags in the file. And during each logical change in the tree it must tracks the file position changes/offsets. That thing seems to miss in lxml and BeautifulSoup which I tried so far. This is a frequent need I have. Nobody else's? Seems I need to write my own or patch BS to do that extra tracking? Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: [Edu-sig] odd drawing problem with turtle.py
Brian Blais wrote: On Jan 31, 2010, at 23:05 , John Posner wrote: Try commenting out this statement: self.turtle.tracer(False) That helps on Python 2.6.4. interesting. It seems as if the tracer property is a global one: Actually, the tracer method that does the work is part of the TurtleScreen class, and individual Turtle instances just access the tracer method of the TurtleScreen they inhabit... if that makes sense. So since your turtles are on the same screen, yes, in effect, tracer is sort of global. Cheers, Vern In [1]:t1=Turtle() In [2]:t1.tracer() Out[2]:1 In [3]:t1.tracer(False) In [4]:t1.tracer() Out[4]:0 In [5]:t2=Turtle() In [6]:t2.tracer() Out[6]:0 In [7]:t2.tracer(True) In [8]:t1.tracer() Out[8]:1 looks like I need to set the tracer manually. however, even if the tracer is off, shouldn't it still draw the line? when I put in the T.tracer(True) it works, but I shouldn't need to I think. On Jan 31, 2010, at 21:11 , kirby urner wrote: I don't see where you've defined a Turtle class to instantiate sir. Turtle is given in turtle.py. I should have subclassed it, but I was being lazy. :) thanks for the fast replies! bb On Sun, Jan 31, 2010 at 4:27 PM, Brian Blais bbl...@bryant.edu mailto:bbl...@bryant.edu wrote: I'm on Python 2.5, but using the updated turtle.py Version 1.0.1 - 24. 9. 2009. The following script draws 5 circles, which it is supposed to, but then doesn't draw the second turtle which is supposed to simply move forward. Any ideas? from turtle import * from numpy.random import randint resetscreen() class Circle(object): def __init__(self,x,y,r,color): self.x=x self.y=y self.r=r self.color=color self.turtle=Turtle(visible=False) self.turtle.tracer(False) self.draw() def draw(self): self.turtle.penup() self.turtle.setposition(self.x,self.y) self.turtle.setheading(0) self.turtle.backward(self.r) self.turtle.pendown() self.turtle.fill(True) self.turtle.pencolor(black) self.turtle.fillcolor(self.color) self.turtle.circle(self.r) self.turtle.fill(False) self.turtle.penup() for i in range(5): c=Circle(randint(-350,350),randint(-250,250),10,red) T=Turtle() T.forward(100) T.forward(100) thanks, bb -- Brian Blais bbl...@bryant.edu mailto:bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ ___ Edu-sig mailing list edu-...@python.org mailto:edu-...@python.org http://mail.python.org/mailman/listinfo/edu-sig -- Brian Blais bbl...@bryant.edu mailto:bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ ___ Edu-sig mailing list edu-...@python.org http://mail.python.org/mailman/listinfo/edu-sig -- This time for sure! -Bullwinkle J. Moose - Vern Ceder, Director of Technology Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804 vce...@canterburyschool.org; 260-436-0746; FAX: 260-436-5137 The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW -- http://mail.python.org/mailman/listinfo/python-list
Re: HTML Parser which allows low-keyed local changes (upon serialization)
Robert wrote: Stefan Behnel wrote: Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the human edited format of the original HTML code. makes it rather unreadable. What do you mean? Could you give an example? lxml certainly does not destroy anything it parsed, unless you tell it to do so. of course it does not destroy during parsing.(?) I mean: I want to walk with a Python script through the parsed tree HTML and modify here and there things (auto alt tags from DB/similar, link corrections, text sections/translated sentences... due to HTML code and content checks.) Then I want to output the changed tree - but as close to the original format as far as possible. No changes to my white space identation, etc.. Only lokal changes, where really tags where changed. Thats similiar like that what a good HTML editor does: After you made little changes, it doesn't reformat/re-spit-out your whole code layout from tree/attribute logic only. you have lokal changes only. But a simple HTML editor like that in Mozilla-Seamonkey outputs a whole new HTML, produces the HTML from logical tree only (regarding his (ugly) style), destroys my whitspace layout and much more - forgetting anything about the original layout. Such a good HTML editor must somehow track the original positions of the tags in the file. And during each logical change in the tree it must tracks the file position changes/offsets. That thing seems to miss in lxml and BeautifulSoup which I tried so far. This is a frequent need I have. Nobody else's? Seems I need to write my own or patch BS to do that extra tracking? basic feature(s) of such parser perhaps: * can it tell for each tag object in the parsed tree, at what original file position start:end it resided? even a basic need: tell me the line number e.g. (for warning/analysis reports e.g.) (* do the tree objects auto track/know if they were changed. (for convenience; a tree copy may serve this otherwise .. ) the creation of a output with local changes whould be rather simple from that ... Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: HTML Parser which allows low-keyed local changes (upon serialization)
Robert, 01.02.2010 14:36: Stefan Behnel wrote: Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the human edited format of the original HTML code. makes it rather unreadable. What do you mean? Could you give an example? lxml certainly does not destroy anything it parsed, unless you tell it to do so. of course it does not destroy during parsing.(?) I meant parsed in the sense of has parsed and is now working on. I mean: I want to walk with a Python script through the parsed tree HTML and modify here and there things (auto alt tags from DB/similar, link corrections, text sections/translated sentences... due to HTML code and content checks.) Sure, perfectly valid use case. Then I want to output the changed tree - but as close to the original format as far as possible. No changes to my white space identation, etc.. Only lokal changes, where really tags where changed. That's up to you. If you only apply local changes that do not change any surrounding whitespace, you'll be fine. Thats similiar like that what a good HTML editor does: After you made little changes, it doesn't reformat/re-spit-out your whole code layout from tree/attribute logic only. you have lokal changes only. HTML editors don't work that way. They always re-spit-out the whole code when you click on save. They certainly don't track the original file position of tags. What they preserve is the content, including whitespace (or not, if they reformat the code, but that's usually an *option*). Such a good HTML editor must somehow track the original positions of the tags in the file. And during each logical change in the tree it must tracks the file position changes/offsets. Sorry, but that's nonsense. The file position of a tag is determined by whitespace, i.e. line endings and indentation. lxml does not alter that, unless you tell it do do so. Since you keep claiming that it *does* alter it, please come up with a reproducible example that shows a) what you do in your code, b) what your input is and c) what unexpected output it creates. Do not forget to include the version number of lxml and libxml2 that you are using, as well as a comment on /how/ the output differs from what you expected. My stab in the dark is that you forgot to copy the tail text of elements that you replace by new content, and that you didn't properly indent new content that you added. But that's just that, a stab in the dark. You didn't provide enough information for even an educated guess. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: libpcap and python
On 2010-02-01, Mag Gam magaw...@gmail.com wrote: Hello All, I used tcpdump to capture data on my network. I would like to analyze the data using python -- currently using ethereal and wireshark. I would like to get certain type of packets (I can get the hex code for them), what is the best way to do this? Lets say I want to capture all events of `ping localhost` http://www.google.com/search?q=python+pcap -- Grant Edwards grante Yow! My face is new, my at license is expired, and I'm visi.comunder a doctor's care -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3147 - new .pyc format
On Mon, 01 Feb 2010 11:14:42 +0100, Daniel Fetchinson wrote: I also think the PEP is a great idea and proposes a solution to a real problem. But I also hear the 'directory clutter' argument and I'm really concerned too, having all these extra directories around (and quite a large number of them indeed!). Keep in mind that if you don't explicitly ask for the proposed feature, you won't see any change at all. You need to run Python with the -R switch, or set an environment variable. The average developer won't see any clutter at all unless she is explicitly supporting multiple versions. How about this scheme: 1. install python source files to a shared (among python installations) location /this/is/shared 2. when python X.Y imports a source file from /this/is/shared it will create pyc files in its private area /usr/lib/pythonX.Y/site-packages/ $ touch /usr/lib/python2.5/site-packages/STEVEN touch: cannot touch `/usr/lib/python2.5/site-packages/STEVEN': Permission denied There's your first problem: most users don't have write-access to the private area. When you install a package, you normally do so as root, and it all works. When you import a module and it gets compiled as a .pyc file, you're generally running as a regular user. Time comparison would be between /this/is/shared/x.py and /usr/lib/pythonX.Y/site-packages/x.pyc, for instance. I don't quite understand what you mean by time comparison. [...] In /usr/lib/pythonX.Y/site-packages there would be only pyc files with magic number matching python X.Y. Personally, I think it is a terribly idea to keep the source file and byte code file in such radically different places. They should be kept together. What you call clutter I call having the files that belong together kept together. So, basically nothing would change only the location of py and pyc files would be different from current behavior, but the same algorithm would be run to determine which one to load, when to create a pyc file, when to ignore the old one, etc. What happens when there is a .pyc file in the same location as the .py file? Because it *will* happen. Does it get ignored, or does it take precedence over the site specific file? Given: ./module.pyc /usr/lib/pythonX.Y/site-packages/module.pyc and you execute import module, which gets used? Note that in this situation, there may or may not be a module.py file. What would be wrong with this setup? Consider: ./module.py ./package/module.py Under your suggestion, both of these will compile to /usr/lib/pythonX.Y/site-packages/module.pyc -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Unable to install numpy
On 2010-01-31 08:03 AM, vsoler wrote: On Jan 18, 9:08 pm, Robert Kernrobert.k...@gmail.com wrote: On 2010-01-18 14:02 PM, vsoler wrote: Hi all, I just download Numpy, and tried to install it using numpy-1.4.0- win32-superpack-python2.6.exe I get an error: Python version 2.6 required, which was not found in the Registry However, I am using Python 2.6 every day. I'm running Windows 7. What can I do? Please ask numpy installation questions on the numpy mailing list. http://www.scipy.org/Mailing_Lists Thank you Robert. I'm going to direct my questions towards scipy.org. However, since I do not find my questions already answered, could you tell me where to post it? I beg your pardon for still asking this question outside of scipy.org, but I've been unable to move on. Subscribe to the numpy-discussion mailing list following the directions given on the above-linked page. Then send email to numpy-discuss...@scipy.org with your question. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: how long a Str can be used in this python code segment?
Chris Rebert wrote: On Mon, Feb 1, 2010 at 1:17 AM, Stephen.Wu 54wut...@gmail.com wrote: tmp=file.read() (very huge file) if targetStr in tmp: print find it else: print not find file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some certain information on this prolbem? If the file's contents is larger than available memory, you'll get a MemoryError. To avoid this, you can read the file in by chunks (or if applicable, by lines) and see if each chunk/line matches. If you're processing in chunks then you also need to consider the possibility that what you're looking for crosses a chunk boundary, of course. It's an easy case to miss! :-) -- http://mail.python.org/mailman/listinfo/python-list
ANN: Wing IDE 3.2.4 released
Hi, Wingware has released version 3.2.4 of Wing IDE, our integrated development environment for the Python programming language. Wing IDE can be used on Windows, Linux, and OS X to develop Python code for web, GUI, and embedded scripting applications. Wing IDE provides auto-completion, call tips, a powerful debugger, unit testing, version control, search, and many other features. This release includes the following minor features and improvements: * Corrected support for non-ascii I/O when debugging under Python 3.x * Support debugging of wide unicode builds of Python 3.x * Improve GUI responsiveness in very large projects (optimized external file change checking) * Auto-enter last failed or canceled version control commit message * Added context menu for copy/paste to commit message area in version control tools * Version control annotate commands like 'svn blame' show results in scratch buffer * Many other minor features and bug fixes; See the change log at http://wingware.com/pub/wingide/3.2.4/CHANGELOG.txt for details *Wing 3.2 Highlights* Version 3.2 of Wing IDE includes the following new features not present in Wing IDE 3.1: * Support for Python 3.0 and 3.1 * Rewritten version control integration with support for Subversion, CVS, Bazaar, git, Mercurial, and Perforce (*) * Added 64-bit Debian, RPM, and tar file installers for Linux * File management in Project view (**) * Auto-completion in the editor obtains completion data from live runtime when the debugger is active (**) * Perspectives: Create and save named GUI layouts and optionally automatically transition when debugging is started (*) * Improved support for Cython and Pyrex (*.pyx files) * Added key binding documentation to the manual * Added Restart Debugging item in Debug menu and tool bar (**) * Improved OS Commands and Bookmarks tools (*) (*)'d items are available in Wing IDE Professional only. (**)'d items are available in Wing IDE Personal and Professional only. The release also contains many other minor features and bug fixes; see the change log for details: http://wingware.com/pub/wingide/3.2.4/CHANGELOG.txt *Downloads* Wing IDE Professional and Wing IDE Personal are commercial software and require a license to run. A free trial license can be obtained directly from the product when launched. Wing IDE 101 can be used free of charge. Wing IDE Pro 3.2.4http://wingware.com/downloads/wingide/3.2 Wing IDE Personal 3.2.4 http://wingware.com/downloads/wingide-personal/3.2 Wing IDE 101 3.2.4http://wingware.com/downloads/wingide-101/3.2 *About Wing IDE* Wing IDE is an integrated development environment for the Python programming language. It provides powerful debugging, editing, code intelligence, testing, version control, and search capabilities that reduce development and debugging time, cut down on coding errors, and make it easier to understand and navigate Python code. Wing IDE is available in three product levels: Wing IDE Professional is the full-featured Python IDE, Wing IDE Personal offers a reduced feature set at a low price, and Wing IDE 101 is a free simplified version designed for teaching entry level programming courses with Python. System requirements are Windows 2000 or later, OS X 10.3.9 or later for PPC or Intel (requires X11 Server), or a recent Linux system (either 32 or 64 bit). Wing IDE 3.2 supports Python versions 2.0.x through 3.1.x. *Purchasing and Upgrading* Wing 3.2 is a free upgrade for all Wing IDE 3.0 and 3.1 users. Any 2.x license sold after May 2nd 2006 is free to upgrade; others cost 1/2 the normal price to upgrade. Upgrade a 2.x license: https://wingware.com/store/upgrade Purchase a 3.x license:https://wingware.com/store/purchase -- The Wingware Team Wingware | Python IDE Advancing Software Development www.wingware.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python distutils build problems with MinGW
On Feb 1, 4:03 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On Feb 1, 2:59 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Hi, I've made a similar post on the Cython mailing list, however I think this is more python-specific. I'm having trouble setting up distutils to use MinGW instead of Visual Studio when building a module. Even tho I've just uninstalled VS, and cleared out any leftover VS environment variables, distutils keeps wanting to use it. The steps I took: Fresh installation of Python 3.1.1 Successfully installed MinGW, added to the path variable (gcc in command prompt works) Successfully installed Cython, imports from Cython in Python work. Added a distutils.cfg file in \Python31\Lib\distutils\ directory with: [build] compiler=mingw32 (also tried adding [build_ext] compiler=mingw32) There's a demo setup.py module that came with Cython, I tried the following commands: python setup.py build_ext --inplace error: Unable to find vcvarsall.bat python setup.py build error: Unable to find vcvarsall.bat I'm having the exact same issue with trying to build the Polygon library via MinGW. In fact, the reason I had installed Visual Studio in the first place was to be able to build the Polygon library, since I was having these errors. What do I need to do to make distutils/python use MinGW? Update: I installed and tried building with Python 2.6, it calls MinGW when I have the distutils.cfg file configured properly (same configuration as the Python 3.1.1 one) But why doesn't it work on a fresh Python 3.1.1 installation as well? Is this a bug? Also tried calling (Python 3.1.1): python setup.py build --compiler=mingw32 error: Unable to find vcvarsall.bat I've tried using pexports and the dlltool to build new python31.def and libpython31.a files, and put them in the libs folder. That didn't work either. I've also tried adding some print statements in the \distutils\dist.py file, in the parse_config_files() function, just to see if Python properly parses the config file. And it does, both Python 2.6 and 3.1 parse the distutils.cfg file properly. Yet something is making python 3 look for the VS/VC compiler instead of MinGW. I'll keep updating on any progres.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python distutils build problems with MinGW
On Feb 1, 8:31 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On Feb 1, 4:03 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On Feb 1, 2:59 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Hi, I've made a similar post on the Cython mailing list, however I think this is more python-specific. I'm having trouble setting up distutils to use MinGW instead of Visual Studio when building a module. Even tho I've just uninstalled VS, and cleared out any leftover VS environment variables, distutils keeps wanting to use it. The steps I took: Fresh installation of Python 3.1.1 Successfully installed MinGW, added to the path variable (gcc in command prompt works) Successfully installed Cython, imports from Cython in Python work. Added a distutils.cfg file in \Python31\Lib\distutils\ directory with: [build] compiler=mingw32 (also tried adding [build_ext] compiler=mingw32) There's a demo setup.py module that came with Cython, I tried the following commands: python setup.py build_ext --inplace error: Unable to find vcvarsall.bat python setup.py build error: Unable to find vcvarsall.bat I'm having the exact same issue with trying to build the Polygon library via MinGW. In fact, the reason I had installed Visual Studio in the first place was to be able to build the Polygon library, since I was having these errors. What do I need to do to make distutils/python use MinGW? Update: I installed and tried building with Python 2.6, it calls MinGW when I have the distutils.cfg file configured properly (same configuration as the Python 3.1.1 one) But why doesn't it work on a fresh Python 3.1.1 installation as well? Is this a bug? Also tried calling (Python 3.1.1): python setup.py build --compiler=mingw32 error: Unable to find vcvarsall.bat I've tried using pexports and the dlltool to build new python31.def and libpython31.a files, and put them in the libs folder. That didn't work either. I've also tried adding some print statements in the \distutils\dist.py file, in the parse_config_files() function, just to see if Python properly parses the config file. And it does, both Python 2.6 and 3.1 parse the distutils.cfg file properly. Yet something is making python 3 look for the VS/VC compiler instead of MinGW. I'll keep updating on any progres..- Hide quoted text - - Show quoted text - I think this is http://bugs.python.org/issue6377. I applied the patch to my local copy of Python 3.1 and it seems to work. casevh -- http://mail.python.org/mailman/listinfo/python-list
Iterating over a function call
Hi -- I have many sections of code like this: for value in value_iterator: value_function(value) I noticed that this does two things I don't like: 1. looks up value_function and value for each iteration, but value_function doesn't change. 2. side effect of (maybe) leaking the iterator variable value into the code following the loop (if the iterator is not empty). I can take care of 2 by explicitly deleting the variable at the end: del value but I'd probably forget to do that sometimes. I then realized that, in the 2.x series, I can accomplish the same thing with: map(value_function, value_iterator) and avoid both problems BUT map() returns a list which is never used. Not a big deal for small iterables, I guess, but it seems messy. Upon conversion to 3.x I have to explicitly list-ify it: list(map(value_function, value_iterator)) which works but again the list returned is never used (extra work) and has to be gc'd I suppose (extra memory). It's easy to make a little function to take care of this (2.x): from itertools import imap def apply(function, iterable): for item in imap(function, iterable): pass then later: apply(value_function, value_iterator) or something similar thing in 3.x, but that just adds an additional function def that I have to include whenever I want to do something like this. So.I'm wondering if there is any interest in an apply() built-in function that would work like map() does in 2.x (calls the function with each value returned by the iterator) but return nothing. Maybe apply isn't the best name; it's just the first one that occurred to me. Or is this just silly and should I forget about it? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list
Re: how long a Str can be used in this python code segment?
Le Mon, 01 Feb 2010 01:33:09 -0800, Stephen.Wu a écrit : actually, I just use file.read(length) way, i just want to know what exactly para of length I should set, I'm afraid length doesn't equal to the amount of physical memory after trials... There's no exact length you should set, just set something big enough that looping doesn't add any noticeable overhead, but small enough that it doesn't take too much memory. Something between 64kB and 1MB sounds reasonable. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python distutils build problems with MinGW
I've found the problem: For the windows Python 3.1.1 x86 installation, the file \Python31\Lib \Distutils\command\build_ext.py, has this: Line 313: self.compiler = new_compiler(compiler=None, But Python 2.6 has this line: Line 306: self.compiler = new_compiler(compiler=self.compiler, I've changed the Python 3.1.1 \Python31\Lib\Distutils\command \build_ext.py, Line 313 to this: self.compiler = new_compiler(compiler=self.compiler, And now MinGW gets properly called in Python 3.1.1. I think this must have been a typo. Is there anyone else that can confirm this? The installation that distributes the file with that line is from this Python ftp link: http://python.org/ftp/python/3.1.1/python-3.1.1.msi -- http://mail.python.org/mailman/listinfo/python-list
Re: create a string of variable lenght
Il Sun, 31 Jan 2010 19:54:17 -0500, Benjamin Kaplan ha scritto: First of all, if you haven't read this before, please do. It will make this much clearer. http://www.joelonsoftware.com/articles/Unicode.html i'm reading it right now, thanks :-) [cut] Solution to your problem: in addition to keeping the #-*- coding ... line, go with Günther's advice and use Unicode strings. that is: always use the u operator (i.e. my_name = uNico), right? Ciao, Nico -- http://mail.python.org/mailman/listinfo/python-list
Re: Python distutils build problems with MinGW
On Feb 1, 5:44 pm, casevh cas...@gmail.com wrote: On Feb 1, 8:31 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On Feb 1, 4:03 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On Feb 1, 2:59 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Hi, I've made a similar post on the Cython mailing list, however I think this is more python-specific. I'm having trouble setting up distutils to use MinGW instead of Visual Studio when building a module. Even tho I've just uninstalled VS, and cleared out any leftover VS environment variables, distutils keeps wanting to use it. The steps I took: Fresh installation of Python 3.1.1 Successfully installed MinGW, added to the path variable (gcc in command prompt works) Successfully installed Cython, imports from Cython in Python work. Added a distutils.cfg file in \Python31\Lib\distutils\ directory with: [build] compiler=mingw32 (also tried adding [build_ext] compiler=mingw32) There's a demo setup.py module that came with Cython, I tried the following commands: python setup.py build_ext --inplace error: Unable to find vcvarsall.bat python setup.py build error: Unable to find vcvarsall.bat I'm having the exact same issue with trying to build the Polygon library via MinGW. In fact, the reason I had installed Visual Studio in the first place was to be able to build the Polygon library, since I was having these errors. What do I need to do to make distutils/python use MinGW? Update: I installed and tried building with Python 2.6, it calls MinGW when I have the distutils.cfg file configured properly (same configuration as the Python 3.1.1 one) But why doesn't it work on a fresh Python 3.1.1 installation as well? Is this a bug? Also tried calling (Python 3.1.1): python setup.py build --compiler=mingw32 error: Unable to find vcvarsall.bat I've tried using pexports and the dlltool to build new python31.def and libpython31.a files, and put them in the libs folder. That didn't work either. I've also tried adding some print statements in the \distutils\dist.py file, in the parse_config_files() function, just to see if Python properly parses the config file. And it does, both Python 2.6 and 3.1 parse the distutils.cfg file properly. Yet something is making python 3 look for the VS/VC compiler instead of MinGW. I'll keep updating on any progres..- Hide quoted text - - Show quoted text - I think this ishttp://bugs.python.org/issue6377. I applied the patch to my local copy of Python 3.1 and it seems to work. casevh Thanks for the link, it seems like it's got more to do than what I just posted. But in any case, it works for me now. I think I'll have to open myself a blog and post some guides for problems like these, so people can avoid spending whole nights around a problem like this. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python distutils build problems with MinGW
Well, in any case this seems to be working ok for me now. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to decode rtf characterset ?
Stef Mientki wrote: hello, I want to translate rtf files to unicode strings. I succeeded in remove all the tags, but now I'm stucked to the special accent characters, like : Vóór the character ó is represented by the string r\'f3, or in bytes: 92, 39,102, 51 so I think I need a way to translate that into the string r\xf3 but I can't find a way to accomplish that. a Any suggestions are very welcome. Change r\'f3 to r\xf3 and then decode to Unicode: s = r\'f3 s = s.replace(r\', r\x).decode(unicode_escape) print s ó -- http://mail.python.org/mailman/listinfo/python-list
Re: HTML Parser which allows low-keyed local changes (upon serialization)
Stefan Behnel wrote: Robert, 01.02.2010 14:36: Stefan Behnel wrote: Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the human edited format of the original HTML code. makes it rather unreadable. What do you mean? Could you give an example? lxml certainly does not destroy anything it parsed, unless you tell it to do so. of course it does not destroy during parsing.(?) I meant parsed in the sense of has parsed and is now working on. I mean: I want to walk with a Python script through the parsed tree HTML and modify here and there things (auto alt tags from DB/similar, link corrections, text sections/translated sentences... due to HTML code and content checks.) Sure, perfectly valid use case. Then I want to output the changed tree - but as close to the original format as far as possible. No changes to my white space identation, etc.. Only lokal changes, where really tags where changed. That's up to you. If you only apply local changes that do not change any surrounding whitespace, you'll be fine. Thats similiar like that what a good HTML editor does: After you made little changes, it doesn't reformat/re-spit-out your whole code layout from tree/attribute logic only. you have lokal changes only. HTML editors don't work that way. They always re-spit-out the whole code when you click on save. They certainly don't track the original file position of tags. What they preserve is the content, including whitespace (or not, if they reformat the code, but that's usually an *option*). Such a good HTML editor must somehow track the original positions of the tags in the file. And during each logical change in the tree it must tracks the file position changes/offsets. Sorry, but that's nonsense. The file position of a tag is determined by whitespace, i.e. line endings and indentation. lxml does not alter that, unless you tell it do do so. Since you keep claiming that it *does* alter it, please come up with a reproducible example that shows a) what you do in your code, b) what your input is and c) what unexpected output it creates. Do not forget to include the version number of lxml and libxml2 that you are using, as well as a comment on /how/ the output differs from what you expected. My stab in the dark is that you forgot to copy the tail text of elements that you replace by new content, and that you didn't properly indent new content that you added. But that's just that, a stab in the dark. You didn't provide enough information for even an educated guess. I think you confused the logical level of what I meant with file position: Of course its not about (necessarily) writing back to the same open file (OS-level), but regarding the whole serializiation string (wherever it is finally written to - I typically write the auto-converted HTML files to a 2nd test folder first, and want use diff -u ... to see human-readable what changed happened - which again is only reasonable if the original layout is preserved as good as possible ) lxml and BeautifulSoup e.g. : loadparse a HTML file to a tree, immediately serialize the tree without changes = you see big differences of original and serialized files with quite any file. The main issue: those libs seem to not track any info about the original string/file positions of the objects they parse. The just forget the past. Thus they cannot by principle do what I want it seems ... Or does anybody see attributes of the tree objects - which I overlooked? Or a lib which can do or at least enable better this source-back-connected editing? Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: [Edu-sig] odd drawing problem with turtle.py
On Mon, Feb 1, 2010 at 3:27 AM, Brian Blais bbl...@bryant.edu wro I don't see where you've defined a Turtle class to instantiate sir. Turtle is given in turtle.py. I should have subclassed it, but I was being lazy. :) thanks for the fast replies! bb No obvious need to subclass. You weren't being lazy, I was being sloppy. I'm glad Vern caught my error right away. Kirby -- http://mail.python.org/mailman/listinfo/python-list
Re: HTML Parser which allows low-keyed local changes (upon serialization)
Robert wrote: I think you confused the logical level of what I meant with file position: Of course its not about (necessarily) writing back to the same open file (OS-level), but regarding the whole serializiation string (wherever it is finally written to - I typically write the auto-converted HTML files to a 2nd test folder first, and want use diff -u ... to see human-readable what changed happened - which again is only reasonable if the original layout is preserved as good as possible ) lxml and BeautifulSoup e.g. : loadparse a HTML file to a tree, immediately serialize the tree without changes = you see big differences of original and serialized files with quite any file. The main issue: those libs seem to not track any info about the original string/file positions of the objects they parse. The just forget the past. Thus they cannot by principle do what I want it seems ... Or does anybody see attributes of the tree objects - which I overlooked? Or a lib which can do or at least enable better this source-back-connected editing? You'd have to write your own parse (or extend the example HTML one we include), but mxTextTools allows you to work on original code quite easily: it tags parts of the input string with objects. You can then have those objects manipulate the underlying text as necessary and write back the text using the original formatting plus your local changes. http://www.egenix.com/products/python/mxBase/mxTextTools/ -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 01 2010) Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ -- http://mail.python.org/mailman/listinfo/python-list
Re: how to decode rtf characterset ?
Stef Mientki wrote: hello, I want to translate rtf files to unicode strings. I succeeded in remove all the tags, but now I'm stucked to the special accent characters, like : Vóór the character ó is represented by the string r\'f3, or in bytes: 92, 39,102, 51 so I think I need a way to translate that into the string r\xf3 but I can't find a way to accomplish that. a Any suggestions are very welcome. You could try something along these lines: s = r\'f3 s = s.replace(\\', \\x) u = s.decode('unicode-escape') u u'\xf3' However, this assumes Latin-1 codes being using by the RTF text. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 01 2010) Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ -- http://mail.python.org/mailman/listinfo/python-list
Re: create a string of variable lenght
On Mon, Feb 1, 2010 at 12:00 PM, Tracubik affdfsdfds...@b.com wrote: Il Sun, 31 Jan 2010 19:54:17 -0500, Benjamin Kaplan ha scritto: First of all, if you haven't read this before, please do. It will make this much clearer. http://www.joelonsoftware.com/articles/Unicode.html i'm reading it right now, thanks :-) [cut] Solution to your problem: in addition to keeping the #-*- coding ... line, go with Günther's advice and use Unicode strings. that is: always use the u operator (i.e. my_name = uNico), right? Ciao, Nico Short answer: yes. Slightly longer explanation for future reference: This is true for Python 2 but not Python 3. One of the big changes in Python 3 is that strings are Unicode by default because you're not the only one who runs into this problem. So in Python 3, just writing 'Nico' will make a Unicode string and you have to explicitly declare b'Nico' if you want to look at it as a series of bytes. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python-list Digest, Vol 77, Issue 7 *
En Mon, 01 Feb 2010 07:26:13 -0300, Rohit Roger$ rohitraj...@gmail.com escribió: Help for datetime module Source code is : from datetime import datetime d = datetime(datetime.now().year, datetime.now().month, datetime.now().day, 11, 59, 0 ) print d And your problem is...? This is what I get: py print d 2010-02-01 11:59:00 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterating over a function call
So.I'm wondering if there is any interest in an apply() built-in function that would work like map() does in 2.x (calls the function with each value returned by the iterator) but return nothing. Maybe apply isn't the best name; it's just the first one that occurred to me. Or is this just silly and should I forget about it? IMHO - yes. Looking up names is what python does all the time, trying to microoptimize that away is silly. It is only justfied if you have extremely timing-critical code. And then, all you need to do is to say def whatever(): _function = function for value in values: _function(value) which will reduce lookup-time, as _function is found in locals() rather than globals(). And any function that does something worthy will dwarf the second namespace-lookup I'd say. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterating over a function call
Gerald Britton gerald.brit...@gmail.com writes: Hi -- I have many sections of code like this: for value in value_iterator: value_function(value) I noticed that this does two things I don't like: 1. looks up value_function and value for each iteration, but value_function doesn't change. 2. side effect of (maybe) leaking the iterator variable value into the code following the loop (if the iterator is not empty). I can take care of 2 by explicitly deleting the variable at the end: del value but I'd probably forget to do that sometimes. I then realized that, in the 2.x series, I can accomplish the same thing with: map(value_function, value_iterator) and avoid both problems BUT map() returns a list which is never used. Not a big deal for small iterables, I guess, but it seems messy. Upon conversion to 3.x I have to explicitly list-ify it: list(map(value_function, value_iterator)) which works but again the list returned is never used (extra work) and has to be gc'd I suppose (extra memory). It's easy to make a little function to take care of this (2.x): from itertools import imap def apply(function, iterable): for item in imap(function, iterable): pass then later: apply(value_function, value_iterator) or something similar thing in 3.x, but that just adds an additional function def that I have to include whenever I want to do something like this. You have itertools.consume which is close to what you want: consume(imap(func, iterable)) # 2.x consume(map(func, iterable)) # 3.x HTH -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Adding methods from one class to another, dynamically
Hello Python gurus, I'm quite new when it comes to Python so I will appreciate any help. Here is what I'm trying to do. I've two classes like below import new import unittest class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): print 'second test' def test_third(self): print 'third test' class tee(unittest.TestCase): pass and I want to attach all test methods of 'test'(i.e. test_first(), test_second() and test_third()) class to 'tee' class. So I'm trying to do something like if __name__==__main__: for name,func in inspect.getmembers(test,inspect.ismethod): if name.find('test_')!= -1: tee.name = new.instancemethod(func,None,tee) after doing above when I run this statement print dirs(tee) I don't see test_first(), test_second() and test_third() attached to class 'tee'. Any ideas, on how can I attach methods of class 'test' to class 'tee' dynamically? Any help is highly appreciated. Many thanks and I look forward to any help. -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3147 - new .pyc format
I also think the PEP is a great idea and proposes a solution to a real problem. But I also hear the 'directory clutter' argument and I'm really concerned too, having all these extra directories around (and quite a large number of them indeed!). Keep in mind that if you don't explicitly ask for the proposed feature, you won't see any change at all. You need to run Python with the -R switch, or set an environment variable. The average developer won't see any clutter at all unless she is explicitly supporting multiple versions. How about this scheme: 1. install python source files to a shared (among python installations) location /this/is/shared 2. when python X.Y imports a source file from /this/is/shared it will create pyc files in its private area /usr/lib/pythonX.Y/site-packages/ $ touch /usr/lib/python2.5/site-packages/STEVEN touch: cannot touch `/usr/lib/python2.5/site-packages/STEVEN': Permission denied There's your first problem: most users don't have write-access to the private area. True, I haven't thought about that (I should have though). When you install a package, you normally do so as root, and it all works. When you import a module and it gets compiled as a .pyc file, you're generally running as a regular user. Time comparison would be between /this/is/shared/x.py and /usr/lib/pythonX.Y/site-packages/x.pyc, for instance. I don't quite understand what you mean by time comparison. I meant the comparison of timestamps on .py and .pyc files in order to determine which is newer and if a recompilation should take place or not. [...] In /usr/lib/pythonX.Y/site-packages there would be only pyc files with magic number matching python X.Y. Personally, I think it is a terribly idea to keep the source file and byte code file in such radically different places. They should be kept together. What you call clutter I call having the files that belong together kept together. I see why you think so, it's reasonable, however there is compelling argument, I think, for the opposite view: namely to keep things separate. An average developer definitely wants easy access to .py files. However I see no good reason for having access to .pyc files. I for one have never inspected a .pyc file. Why would you want to have a .pyc file at hand? If we don't really want to have .pyc files in convenient locations because we (almost) never want to access them really, then I'd say it's a good idea to keep them totally separate and so make don't get in the way. So, basically nothing would change only the location of py and pyc files would be different from current behavior, but the same algorithm would be run to determine which one to load, when to create a pyc file, when to ignore the old one, etc. What happens when there is a .pyc file in the same location as the .py file? Because it *will* happen. Does it get ignored, or does it take precedence over the site specific file? Given: ./module.pyc /usr/lib/pythonX.Y/site-packages/module.pyc and you execute import module, which gets used? Note that in this situation, there may or may not be a module.py file. What would be wrong with this setup? Consider: ./module.py ./package/module.py Under your suggestion, both of these will compile to /usr/lib/pythonX.Y/site-packages/module.pyc I see the problems with my suggestion. However it would be great if in some other way the .pyc files could be kept out of the way. Granted, I don't have a good proposal for this. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding methods from one class to another, dynamically
On Mon, Feb 1, 2010 at 12:06 PM, Oltmans rolf.oltm...@gmail.com wrote: Hello Python gurus, I'm quite new when it comes to Python so I will appreciate any help. Here is what I'm trying to do. I've two classes like below import new import unittest class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): print 'second test' def test_third(self): print 'third test' class tee(unittest.TestCase): pass and I want to attach all test methods of 'test'(i.e. test_first(), test_second() and test_third()) class to 'tee' class. So I'm trying to do something like if __name__==__main__: for name,func in inspect.getmembers(test,inspect.ismethod): if name.find('test_')!= -1: tee.name = new.instancemethod(func,None,tee) This ends up repeatedly assigning to the attribute name of tee; if you check dir(tee), you'll see the string name as an entry. It does *not* assign to the attribute named by the string in the variable `name`. You want setattr(): http://docs.python.org/library/functions.html#setattr Assuming the rest of your code chunk is correct: setattr(tee, name, new.instancemethod(func,None,tee)) Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterating over a function call
[snip[ You have itertools.consume which is close to what you want: consume(imap(func, iterable)) # 2.x consume(map(func, iterable)) # 3.x HTH It does! Though in my case this is simpler: deque(imap(func, iterable), 0) since the recipe for consume just calls deque anyway when you want to eat up the rest of the iterable. It also solves the iterator-variable leakage problem and is only a wee bit slower than a conventional for-loop. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding methods from one class to another, dynamically
On Feb 1, 12:06 pm, Oltmans rolf.oltm...@gmail.com wrote: Hello Python gurus, I'm quite new when it comes to Python so I will appreciate any help. Here is what I'm trying to do. I've two classes like below import new import unittest class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): print 'second test' def test_third(self): print 'third test' class tee(unittest.TestCase): pass and I want to attach all test methods of 'test'(i.e. test_first(), test_second() and test_third()) class to 'tee' class. Simplest way: class tee(test): pass To do it dynamically the following might work: class tee(unittest.TestCase): pass tee.__bases__ = (test,) tee.__bases__ = (test2,) # dynamically reassign base So I'm trying to do something like if __name__==__main__: for name,func in inspect.getmembers(test,inspect.ismethod): if name.find('test_')!= -1: tee.name = new.instancemethod(func,None,tee) after doing above when I run this statement print dirs(tee) I don't see test_first(), test_second() and test_third() attached to class 'tee'. Any ideas, on how can I attach methods of class 'test' to class 'tee' dynamically? Any help is highly appreciated. If you want to do it this way--and I recommend regular inheritance if you can--this is how: for x in dir(test): # or inspect.getmembers if x.startswith('test_'): method = getattr(test,x) function = method.im_func setattr(tee,x,function) The business with method.im_func is because in Python 2.x the getattr on a class will actually returns an unbound method, so you have to get at the actual function object with im_func. In Python 3 this is not necessary. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding methods from one class to another, dynamically
Or you could just do a mixin: tee.__class__.__bases__ = (test,) + tee.__class__.__bases__ On Mon, Feb 1, 2010 at 3:25 PM, Chris Rebert c...@rebertia.com wrote: On Mon, Feb 1, 2010 at 12:06 PM, Oltmans rolf.oltm...@gmail.com wrote: Hello Python gurus, I'm quite new when it comes to Python so I will appreciate any help. Here is what I'm trying to do. I've two classes like below import new import unittest class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): print 'second test' def test_third(self): print 'third test' class tee(unittest.TestCase): pass and I want to attach all test methods of 'test'(i.e. test_first(), test_second() and test_third()) class to 'tee' class. So I'm trying to do something like if __name__==__main__: for name,func in inspect.getmembers(test,inspect.ismethod): if name.find('test_')!= -1: tee.name = new.instancemethod(func,None,tee) This ends up repeatedly assigning to the attribute name of tee; if you check dir(tee), you'll see the string name as an entry. It does *not* assign to the attribute named by the string in the variable `name`. You want setattr(): http://docs.python.org/library/functions.html#setattr Assuming the rest of your code chunk is correct: setattr(tee, name, new.instancemethod(func,None,tee)) Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list
Re: get error install MySQLdb on Mac OS X
In article 2be17362-8a54-4a04-9671-0a0ff7266...@k2g2000pro.googlegroups.com, PS.OHM ps.o...@gmail.com wrote: On Jan 29, 5:02 am, Sean DiZazzo half.ital...@gmail.com wrote: On Jan 28, 12:53 pm, PS.OHM ps.o...@gmail.com wrote: I havegetsomeerrorwhen i install MySQLdb on Mac OS X after i key command $python setup.py build The build of MySQLdb is not finding the MySQL client database libraries. You need to install them first and, for the python you are using, you need a version that includes 32-bit. The easiest options are to download them from mysql.com or, if you are comfortable with MacPorts, I would recommend installing them from there. sudo port install mysql5 In fact, with MacPorts you can install a complete Python 2.6.4, MySQLdb, and MySQL libraries with just one command. With the MacPorts base installed, this should do it: sudo port install py26-mysql You might need to tweak the variants of some of the packages if you want 32-bit only, etc, depending on what version of OS X you're running on. -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: libpcap and python
On 2/1/2010 7:47 AM, Mag Gam wrote: Hello All, I used tcpdump to capture data on my network. I would like to analyze the data using python -- currently using ethereal and wireshark. I would like to get certain type of packets (I can get the hex code for them), what is the best way to do this? Lets say I want to capture all events of `ping localhost` The following is pretty straightforward. def process(dump, wanted, func): for packet in dump: if packet_type(packet) == wanted: func(packet) Perhaps you can ask a more specific question. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding methods from one class to another, dynamically
Thank you for your help, Chris. Looks like I can now attach methods to class 'tee'. However, after attaching methods to 'tee' when I try to run them using suite.run() I don't see any of the methods running, I'm sorry but I've no clue what's failing this. Any insights will be highly appreciated. Here is the sample code filename: check.py --- import inspect import unittest class result(unittest.TestResult): def addSuccess(self,test): print str(test) + ' succeeded' def addError(self,test,err): print 'An error occured while running the test ' + str(test) + ' and error is = ' + str(err) def addFailure(self,test,err): print str(test) + failed with an error = + str(err) class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): print 'second test' def test_third(self): print 'third test' import new class tee(unittest.TestCase): pass if __name__==__main__: r = result() for name,func in inspect.getmembers(test,inspect.ismethod): if name.find('test_')!= -1: setattr(tee, name, new.instancemethod(func,None,tee)) suite = unittest.defaultTestLoader.loadTestsFromName('check.tee') suite.run(r) --- Then line suite.run(r) should have run the methods that we just attached, but it's not. I must be missing something here. Please enlighten me. Thanks. On Feb 2, 1:25 am, Chris Rebert c...@rebertia.com wrote: On Mon, Feb 1, 2010 at 12:06 PM, Oltmans rolf.oltm...@gmail.com wrote: Hello Python gurus, I'm quite new when it comes to Python so I will appreciate any help. Here is what I'm trying to do. I've two classes like below import new import unittest class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): print 'second test' def test_third(self): print 'third test' class tee(unittest.TestCase): pass and I want to attach all test methods of 'test'(i.e. test_first(), test_second() and test_third()) class to 'tee' class. So I'm trying to do something like if __name__==__main__: for name,func in inspect.getmembers(test,inspect.ismethod): if name.find('test_')!= -1: tee.name = new.instancemethod(func,None,tee) This ends up repeatedly assigning to the attribute name of tee; if you check dir(tee), you'll see the string name as an entry. It does *not* assign to the attribute named by the string in the variable `name`. You want setattr():http://docs.python.org/library/functions.html#setattr Assuming the rest of your code chunk is correct: setattr(tee, name, new.instancemethod(func,None,tee)) Cheers, Chris --http://blog.rebertia.com- Hide quoted text - - Show quoted text - -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding methods from one class to another, dynamically
Oltmans wrote: Thank you for your help, Chris. Looks like I can now attach methods to class 'tee'. However, after attaching methods to 'tee' when I try to run them using suite.run() I don't see any of the methods running, I'm sorry but I've no clue what's failing this. Any insights will be highly appreciated. Here is the sample code filename: check.py --- import inspect import unittest class result(unittest.TestResult): def addSuccess(self,test): print str(test) + ' succeeded' def addError(self,test,err): print 'An error occured while running the test ' + str(test) + ' and error is = ' + str(err) def addFailure(self,test,err): print str(test) + failed with an error = + str(err) class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): print 'second test' def test_third(self): print 'third test' import new class tee(unittest.TestCase): pass if __name__==__main__: r = result() for name,func in inspect.getmembers(test,inspect.ismethod): if name.find('test_')!= -1: setattr(tee, name, new.instancemethod(func,None,tee)) suite = unittest.defaultTestLoader.loadTestsFromName('check.tee') suite.run(r) --- Then line suite.run(r) should have run the methods that we just attached, but it's not. I must be missing something here. Please enlighten me. Should not tee be subclassing test, not unittest.TestCase? regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS:http://holdenweb.eventbrite.com/ -- http://mail.python.org/mailman/listinfo/python-list
CheddarGetter module for Python - easy recurring billing
We just released pychedder, an open source module for integrating CheddarGetter with Python (and Django): http://www.feedmagnet.com/blog/cheddargetter-for-python-and-django/ Anyone who's built commercial web app knows that payment processing can be one of the toughest pieces to put in place - and it can distract you from working on the core functionality of your app. CheddarGetter is a web service that abstracts the entire process of managing credit cards, processing transactions on a recurring basis, and even more complex setups like free trials, setup fees, and overage charges. We're using CheddarGetter for FeedMagnet.com and we thought the Python community in general could benefit from the module we wrote to interact with it. More just just a Python wrapper for CheddarGetter, pycheddar gives you class objects that work a lot like Django models, making the whole experience of integrating with CheddarGetter just a little more awesome and Pythonic. We're a week or two away from putting pycheddar into production on FeedMagnet, but we felt like it was close enough that others could start using it. We also published it to PyPi so you can easy_install pycheddar and get the latest version (currently 0.9). Hope others can benefit from it! - Jason -- http://mail.python.org/mailman/listinfo/python-list
Re: starting a thread in a nother thread
In article 4b60a661$0$1598$742ec...@news.sonic.net, John Nagle na...@animats.com wrote: If a C package called from Python crashes, the package is defective. Nothing you can do from Python should be able to cause a segmentation fault. ...unless you use ctypes. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ import antigravity -- http://mail.python.org/mailman/listinfo/python-list
Problems embedding python 2.6 in C++
Hi, I'm extending some old Visual Studio 6 code to add embedded python scripting. It works fine most of the time but some python function calls do not work as expected. The C++ code is a multithreaded MFC application. I was assuming that it was GIL issues but I have tried using the manual locking (PyEval_SaveThread PyEval_RestoreThread) and what seems to be the current method (PyGILState_Ensure PyGILState_Release) Here's the error I'm getting: Traceback (most recent call last): File ...scripts\receipt_parser.py, line 296, in get_giftcard_purchase_value details = extract_transaction_details_section(test) File ...scripts\receipt_parser.py, line 204, in extract_transaction_details_section for line in base_details: TypeError: expected string or Unicode object, NoneType found base_details is a list of strings (I can just define it like 'base_details=[1,2,3...]' on the line previous) and the code runs fine when run from standard interpreter. Many other function calls work fine from the embedded app. I create and then Py_DECREF the function parameters and the return value after each function call. The module import is created at C++ object constructor and then Py_DECREF'd in the desctuctor Anyone else had issues of this kind? My next try will be to use sub-interpreters per thread. Thanks, Paul. -- http://mail.python.org/mailman/listinfo/python-list
Re: Function name unchanged in error message
En Sat, 30 Jan 2010 06:28:19 -0300, Peter Otten __pete...@web.de escribió: Gabriel Genellina wrote: En Fri, 29 Jan 2010 13:09:40 -0300, Michele Simionato michele.simion...@gmail.com escribió: On Jan 29, 2:30 pm, andrew cooke and...@acooke.org wrote: Is there any way to change the name of the function in an error message? In the example below I'd like the error to refer to bar(), for example (the motivation is related function decorators - I'd like the wrapper function to give the same name) Use the decorator module which does the right thing: http://pypi.python.org/pypi/decorator The decorator module is a very fine addition to anyone's tool set -- but in this case it is enough to use the wraps() function from the functools standard module. I don't know about the decorator module, but functools.wraps() doesn't affect the error message: It seems I misunderstood the original request and got it backwards - but then I have to question the usefulness of doing so. If an error happens in the decorating function (as opposed to inside the function being decorated) I'd like the error to be reported as such, in the decorating function (else tracebacks and line numbers would be lying). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Processing XML File
On Jan 29, 2:41 pm, Stefan Behnel stefan...@behnel.de wrote: Sells, Fred, 29.01.2010 20:31: Google is your friend. Elementtree is one of the better documented IMHO, but there are many modules to do this. Unless the OP provides some more information, do this is rather underdefined. And sending someone off to Google who is just learning the basics of Python and XML and trying to solve a very specific problem with them is not exactly the spirit I'm used to in this newsgroup. Stefan Just want to thank everyone for their posts. I got it working after I discovered a name space issue with this code. xmlDoc = libxml2.parseDoc(guts) # Ignore namespace and just get the Resource resourceNodes = xmlDoc.xpathEval('//*[local-name()=Resource]') for rNode in resourceNodes: print rNode -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: Instant Messenger Clients
En Sun, 31 Jan 2010 18:15:34 -0300, Victor Subervi victorsube...@gmail.com escribió: I need to record my IM conversations. I'm using Gmal's IM client and I can't figure out how to do it, nor do I find any help googling it. Hard to believe... http://www.google.com/talk/chathistory.html -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
On Jan 30, 8:43 am, Nobody nob...@nowhere.com wrote: On Wed, 27 Jan 2010 15:29:05 -0800, Jonathan Gardner wrote: Python is much, much cleaner. I don't know how anyone can honestly say Ruby is cleaner than Python. I'm not familiar with Ruby, but most languages are cleaner than Python once you get beyond the 10-minute introduction stage. Probably too little, too late (haven't read all of the replies yet...) I judge a language's simplicity by how long it takes to explain the complete language. That is, what minimal set of documentation do you need to describe all of the language? With a handful of statements, and a very short list of operators, Python beats out every language in the Algol family that I know of. I can think of only one language (or rather, a class of languages) that can every hope to be shorter than Python. I doubt you've heard of it based on your comments, but I suggest you look into it. Unfortunately, to fully appreciate that language, you're going to have to study a textbook called SICP. At the end of that textbook, you are blessed to not only see but understand the complete compiler for the language, in the language itself. -- http://mail.python.org/mailman/listinfo/python-list
Re: whassup? builtins? python3000? Naah can't be right?
En Sun, 31 Jan 2010 18:17:04 -0300, _wolf wolfgang.l...@gmail.com escribió: dear pythoneers, i would be very gladly accept any commentaries about what this sentence, gleaned from http://celabs.com/python-3.1/reference/executionmodel.html, is meant to mean, or why gods have decided this is the way to go. i anticipate this guy named Kay Schluehr will have a say on that, or maybe even the BDFL will care to pronounce ``__builtins__`` the correct way to his fallovers, followers, and fellownerds:: The built-in namespace associated with the execution of a code block is actually found by looking up the name __builtins__ in its global namespace; this should be a dictionary or a module (in the latter case the module’s dictionary is used). By default, when in the __main__ module, __builtins__ is the built-in module builtins; when in any other module, __builtins__ is an alias for the dictionary of the builtins module itself. __builtins__ can be set to a user-created dictionary to create a weak form of restricted execution. Short answer: use `import builtins` (spelled __builtin__, no 's' and double underscores, in Python 2.x) to access the module containing the predefined (built-in) objects. Everything else is an implementation detail. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
On Jan 31, 3:01 am, rantingrick rantingr...@gmail.com wrote: On Jan 30, 10:43 am, Nobody nob...@nowhere.com wrote: That's also true for most functional languages, e.g. Haskell and ML, as well as e.g. Tcl and most shells. Why require f(x) or (f x) if f x will suffice? yuck! wrapping the arg list with parenthesis (python way) makes the most sense. Its to easy to misread somthing like this onetwothree four five six onetwothree(four, five, six) #ahhh... plain english. In Lisp-ish languages, you have a list of stuff that represents a function call: (a b c d) means: Call a with values (b, c, d) While this certainly doesn't agree with what you learned in Algebra, it is a reasonable syntax that exposes the code-data duality of programs. There is, however, one fatal flaw. Why is the first element so different than the rest? This is inconsistent with what people who are unfamiliar with the language would expect. Indeed, in teaching Lisp, learners have to be reminded about how the evaluator looks at lists and processes them. I would expect a clear, simple language to have exactly one way to call a function. This calling notation would clearly distinguish between the function and its parameters. There are quite a few options, and it turns out that function(arg, arg, arg) is a really good compromise. One of the bad things with languages like perl and Ruby that call without parentheses is that getting a function ref is not obvious. You need even more syntax to do so. In perl: foo(); # Call 'foo' with no args. $bar = foo; # Call 'foo; with no args, assign to '$bar' $bar = foo; # Don't call 'foo', but assign a pointer to it to '$bar' # By the way, this '' is not the bitwise-and '' $bar-() # Call whatever '$bar' is pointing at with no args Compare with python: foo() # Call 'foo' with no args. bar = foo() # 'bar' is now pointing to whatever 'foo()' returned bar = foo # 'bar' is now pointing to the same thing 'foo' points to bar() # Call 'bar' with no args One is simple, consistent, and easy to explain. The other one requires the introduction of advanced syntax and an entirely new syntax to make function calls with references. Note that the Algebra notation of functions allows for an obvious, simple way to refer to functions without calling them, leading to syntax such as f o g (x) and more. -- http://mail.python.org/mailman/listinfo/python-list
Re: ftp.storlines error
En Sun, 31 Jan 2010 19:07:44 -0300, Mik0b0 new...@gmail.com escribió: Good day/night/etc. I am rather a newb in Python (learning Python 3). I am trying to create a small script for FTP file uploads on my home network. The script looks like this: from ftplib import FTP ftp=FTP('10.0.0.1') ftp.login('mike','*') directory='/var/www/blabla/' ftp.cwd(directory) ftp.retrlines('LIST') print('- - - - - - - - - ') file_to_change='test' file=1 file=open(file_to_change,'w') text='test' file.write(text) ftp.storlines('STOR ' + file_to_change,file) ftp.retrlines('LIST') file.close() The output is like this: Traceback (most recent call last): File ftp.py, line 13, in module ftp.storlines('STOR ' + file_to_change,i) File /usr/lib/python3.1/ftplib.py, line 474, in storlines buf = fp.readline() IOError: not readable For the ftp client to be able to read and upload the file, it must have been opened for reading. But you opened it with mode 'w' a few lines above. A quick and dirty way would be to close the file right after file.write(...) and re-open it with mode 'r': ... file.write(text) file.close() file = open(file_to_change,'r') ftp.storlines(...) But I'd separate file-creation from file-uploading. When it's time to upload the file, assume it already exists and has the desired contents (because it has already been created earlier by the same script, or perhaps by some other process), so you just have to open it with mode 'r'. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterating over a function call
2010/2/1 Gerald Britton gerald.brit...@gmail.com: Hi -- I have many sections of code like this: for value in value_iterator: value_function(value) I noticed that this does two things I don't like: ... -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list Hi, just to add to the collection of possible approaches (personally, I find the straightforward versions fine, given the task ... ) If you know, that the called function (used for side effect in any case) doesn't return any true value, you could use any(...) over a generator expression or imap (or, inversely, all(...) if there are true returns all the time). Not that it improves clarity, but something like a dummy reduce(lambda x, y: None, genexp, None) might (kind of) work for arbitrary returns. Both variants only have a redundant boolean or None value. vbr -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
On Jan 31, 12:43 pm, Nobody nob...@nowhere.com wrote: If it was common-place to use Curried functions and partial application in Python, you'd probably prefer f a b c to f(a)(b)(c) as well. That's just the point. It isn't common to play with curried functions or monads or anything like that in computer science today. Yes, Haskell exists, and is a great experiment in how such a language could actually work. But at the same time, you have to have a brain the size of the titanic to contain all the little details about the language before you could write any large-scale application. Meanwhile, Python's syntax and language is simple and clean, and provides tremendous expressiveness without getting in the way of the programmer. Comparing Python's syntax to Haskell's syntax, Python is simpler. Comparing what Python can do to what Haskell can do, Haskell is much faster at certain tasks and allows the expression of certain things that are difficult to express in Python. But at the end of the day, the difference really doesn't matter that much. Now, compare Python versus Language X along the same lines, and the end result is that (a) Python is extraordinarily more simple than Langauge X, and (b) Python is comparable in expressiveness to Language X. That's the #1 reason why I like Python, and why saying Ruby and Python are similar isn't correct. -- http://mail.python.org/mailman/listinfo/python-list
converting XML to hash/dict/CustomTreeCtrl
Hi, I have xml files that I want to convert to a hash/dict and then further placed in a wx CustomTreeCtrl based on the structure. The problem I am having now is that the XML file is very unusual and there aren't any unique identifiers to be put in a dict and because there are no unique variables, finding the value of it from a CustromTreeCtrl is abit tricky. I would appreciate any help or links to projects similar to this. Thanks The XML file looks something like this: doc rm:statsDoc xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; stats name=position1 description=Calculation statistics kind=position stats name=time description=Timing summary kind=section string name=timersNote description=Note:This is the note on calculation times/string stats name=timers kind=timers timer name=totaltime description=Total time elapsed609.081574/elapsed user2531.972081/user system65.119100/system /timer timer name=partialTimer description=Gravitational Displacement elapsed1772.011230/elapsed /timer stats name=subTimers description=All non-phased time kind=timers timer name=subATimer description=Phase time A elapsed72.418861/elapsed /timer timer name=subBTimer description=Phase time B elapsed28.285192/elapsed /timer timer name=spaceMem description=Space memory elapsed0.000/elapsed /timer /stats timer name=endTime description=End elapsed607.432373/elapsed /timer /stats /stats stats name=space description=Space usage summary kind=section stats name=systemSpace description=System Space memory name=heapSpace description=Total Space peak483328/peak current483328/current /memory memory name=spaceResidentSize description=Space resident size peak4182777856/peak current4182777856/current /memory int name=pageMem1/int int name=memReclaims1943498/int int name=memSwaps0/int /stats stats name=subsystems kind=memstats memory name=geoSpace description=Geo-Space peak1640100156/peak current411307840/current /memory memory name=gridSpace description=Grid-Space peak709596712/peak current1406752/current /memory memory name=spaceMem description=Space memory peak737720720/peak current0/current /memory memory name=endTime description=End peak607.432373/peak /memory /stats memory name=subsystemSpace description=Subsystem space total peak5164184694/peak current2054715622/current /memory /stats /stats /rm:statsDoc /doc -- http://mail.python.org/mailman/listinfo/python-list
Modules failing to add runtime library path info at link time
Hey everyone, this has been driving me crazy for long enough now that I'm motivated to post and find an answer. Before I pose my question, let me state that using LD_LIBRARY_PATH is not the answer :) We have things installed in odd places, such as very specific versions of libraries to link against, etc. When I build a module (let's say PyGreSQL for instance) via python setup.py build, the link part is including a proper -L argument (-L/ some/weird/lib because /some/weird/bin was in PATH), but is omitting the additional needed runtime linker arguments. For Solaris that's -R/some/weird/lib For Linux that's -Xlinker -rpath -Xlinker /some/weird/lib Where/how can I configure the appropriate portion of our Python install to do 100% the right thing instead of just 50% (-L)? A specific example -- note the -L and lack of -R (Solaris build): % python setup.py build ... gcc -shared build/temp.solaris-2.10-sun4u-2.6/pgmodule.o -L/afs/rcf/ apps/catchall/lib -lpq -o build/lib.solaris-2.10-sun4u-2.6/_pg.so % -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterating over a function call
On 2/1/2010 11:50 AM, Gerald Britton wrote: Hi -- I have many sections of code like this: for value in value_iterator: value_function(value) I noticed that this does two things I don't like: 1. looks up value_function and value for each iteration, but value_function doesn't change. What you mean by 'looks up'? And why are you bothered by normal Python expression evaluation? Within a function, the 'look_up' is a fast LOAD_FAST instruction. 2. side effect of (maybe) leaking the iterator variable value into the code following the loop (if the iterator is not empty). So? it is sometime useful. I can take care of 2 by explicitly deleting the variable at the end: del value but I'd probably forget to do that sometimes. So? If having 'value' bound breaks your subsequent code, I consider it buggy. I then realized that, in the 2.x series, I can accomplish the same thing with: map(value_function, value_iterator) and avoid both problems BUT map() returns a list which is never used. Not a big deal for small iterables, I guess, but it seems messy. Upon conversion to 3.x I have to explicitly list-ify it: list(map(value_function, value_iterator)) which works but again the list returned is never used (extra work) and has to be gc'd I suppose (extra memory). It's easy to make a little function to take care of this (2.x): from itertools import imap def apply(function, iterable): for item in imap(function, iterable): pass collections.deque(imap(function, iterable), maxlen=0) will do nearly the same and may be faster. then later: apply(value_function, value_iterator) or something similar thing in 3.x, but that just adds an additional function def that I have to include whenever I want to do something like this. So.I'm wondering if there is any interest in an apply() built-in function that would work like map() does in 2.x (calls the function with each value returned by the iterator) but return nothing. Maybe apply isn't the best name; it's just the first one that occurred to me. Or is this just silly and should I forget about it? In my opinion, forget about it. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems embedding python 2.6 in C++
En Mon, 01 Feb 2010 18:21:56 -0300, Paul goblado...@gmail.com escribió: I'm extending some old Visual Studio 6 code to add embedded python scripting. It works fine most of the time but some python function calls do not work as expected. The C++ code is a multithreaded MFC application. I was assuming that it was GIL issues but I have tried using the manual locking (PyEval_SaveThread PyEval_RestoreThread) and what seems to be the current method (PyGILState_Ensure PyGILState_Release) Here's the error I'm getting: Traceback (most recent call last): File ...scripts\receipt_parser.py, line 296, in get_giftcard_purchase_value details = extract_transaction_details_section(test) File ...scripts\receipt_parser.py, line 204, in extract_transaction_details_section for line in base_details: TypeError: expected string or Unicode object, NoneType found base_details is a list of strings (I can just define it like 'base_details=[1,2,3...]' on the line previous) and the code runs fine when run from standard interpreter. Many other function calls work fine from the embedded app. I create and then Py_DECREF the function parameters and the return value after each function call. The module import is created at C++ object constructor and then Py_DECREF'd in the desctuctor Usually, errors in reference count handling prevent objects from being destroyed (a memory leak) or generate a GPF when accessing an now-inexistent object. In principle I'd look elsewhere. Anyone else had issues of this kind? Hard to tell without more info. base_details is built in C++ code? Is it actually a list, or a subclass defined by you? A common error is to forget to check *every* API function call for errors, so errors get unnoticed for a while but are reported on the next check, which may happen in an entirely unrelated function. My next try will be to use sub-interpreters per thread. I would not do that - I'd try to *simplify* the code to test, not make it more complicated. Does it work in a single-threaded application? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterating over a function call
On 2/1/2010 3:05 PM, Arnaud Delobelle wrote: You have itertools.consume which is close to what you want: consume(imap(func, iterable)) # 2.x consume(map(func, iterable)) # 3.x Consume is not in itertools. It is one of many recipes in the doc (9.7.2). For exhausting an iterator, collections.deque(iterator, maxlen=0). -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
On Mon, Feb 1, 2010 at 2:28 PM, Jonathan Gardner jgard...@jonathangardner.net wrote: On Jan 31, 3:01 am, rantingrick rantingr...@gmail.com wrote: On Jan 30, 10:43 am, Nobody nob...@nowhere.com wrote: That's also true for most functional languages, e.g. Haskell and ML, as well as e.g. Tcl and most shells. Why require f(x) or (f x) if f x will suffice? yuck! wrapping the arg list with parenthesis (python way) makes the most sense. Its to easy to misread somthing like this onetwothree four five six onetwothree(four, five, six) #ahhh... plain english. In Lisp-ish languages, you have a list of stuff that represents a function call: (a b c d) means: Call a with values (b, c, d) While this certainly doesn't agree with what you learned in Algebra, it is a reasonable syntax that exposes the code-data duality of programs. There is, however, one fatal flaw. Why is the first element so different than the rest? This is inconsistent with what people who are unfamiliar with the language would expect. Indeed, in teaching Lisp, learners have to be reminded about how the evaluator looks at lists and processes them. I would expect a clear, simple language to have exactly one way to call a function. This calling notation would clearly distinguish between the function and its parameters. There are quite a few options, and it turns out that function(arg, arg, arg) is a really good compromise. One of the bad things with languages like perl and Ruby that call without parentheses is that getting a function ref is not obvious. You need even more syntax to do so. In perl: foo(); # Call 'foo' with no args. $bar = foo; # Call 'foo; with no args, assign to '$bar' $bar = foo; # Don't call 'foo', but assign a pointer to it to '$bar' # By the way, this '' is not the bitwise-and '' $bar-() # Call whatever '$bar' is pointing at with no args Compare with python: foo() # Call 'foo' with no args. bar = foo() # 'bar' is now pointing to whatever 'foo()' returned bar = foo # 'bar' is now pointing to the same thing 'foo' points to bar() # Call 'bar' with no args One is simple, consistent, and easy to explain. The other one requires the introduction of advanced syntax and an entirely new syntax to make function calls with references. Ruby isn't nearly as bad as Perl in this regard; at least it doesn't introduce extra syntax (though there are extra method calls): foo# Call 'foo' with no args. bar = foo # Call 'foo; with no args, assign to bar bar = method(:foo) # 'bar' is now referencing the 'foo' function bar.call# Call 'bar' (i.e. 'foo') with no args Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: myths about python 3
Blog blogtes...@gmail.com writes: Where did you come up with that information? Almost all of the major distros ship with 2.6.x - CentOS, OpenSuSe, Ubuntu, Fedora. (Debian does ship with 2.5, but the next major release sid' is due out in Q2) I don't see Python 2.6 in my CentOS 5.4 installation. All I see is 2.4. Same as RHEL and I'd say that's a fairly major distribution too. -- http://mail.python.org/mailman/listinfo/python-list
Re: recv_into(bytearray) complains about a pinned buffer
Antoine Pitrou wrote: Le Mon, 01 Feb 2010 03:30:56 +0100, Martin v. Loewis a écrit : Is this a bug in Python 2.6 or a deliberate choice regarding implementation concerns I don't know about? It's actually a bug also that you pass an array; doing so *should* give the very same error. Well, if you can give neither an array nor a bytearray to recv_into(), what *could* you give it? My recommendation would be to not use recv_into in 2.x, but only in 3.x. recv_into() should simply be fixed to use the new buffer API, as it does in 3.x. I don't think that's the full solution. The array module should also implement the new buffer API, so that it would also fail with the old recv_into. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
Jonathan Gardner jgard...@jonathangardner.net writes: I judge a language's simplicity by how long it takes to explain the complete language. That is, what minimal set of documentation do you need to describe all of the language? With a handful of statements, and a very short list of operators, Python beats out every language in the Algol family that I know of. Python may have been like that in the 1.5 era. By now it's more complex, and not all that well documented. Consider the different subclassing rules for new and old style classes, the interaction of metaclasses and multiple inheritance, the vagaries of what operations are thread-safe without locks, the inter-thread signalling mechanism that can only be invoked through the C API, the mysteries of generator-based coroutines, etc. I've never used Ruby and I think its syntax is ugly, but everyone tells me it's more uniform. Simplicity is not necessarily such a good thing anyway. Consider FORTH. -- http://mail.python.org/mailman/listinfo/python-list
Re: interaction of mode 'r+', file.write(), and file.tell(): a bug or undefined behavior?
In article 4b617f4...@dnews.tpgi.com.au, Lie Ryan lie.1...@gmail.com wrote: f = open('input.txt', 'r+') for line in f: s = line.replace('python', 'PYTHON') # f.tell() f.write(s) When f.tell() is commented, 'input.txt' does not change; but when uncommented, the f.write() succeeded writing into the 'input.txt' (surprisingly, but not entirely unexpected, at the end of the file). Another possible issue is that using a file iterator is generally not compatible with direct file operations. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ import antigravity -- http://mail.python.org/mailman/listinfo/python-list
Optimized bytecode in exec statement
Dear All, while trying to optimize some unpack operations with self compiling code I wondered howto invoke the optimization in the exec statement. Even starting with -O or -OO yields in Python 2.5.2 the same dis.dis code, which is appended below. My interest would be to reduce the LOAD_FAST ops of s with DUP_TOP on the stack (are there hash lookups behind those ?) and of course to optimize the integer arithmetics following below (removing +-0 etc). Thanks for any ideas, greetings Hermann import dis g=r.rra.LAST3.getter(ds=0,row=0) class fa(struct.Struct): def __init__(s): super(fa,s).__init__('d') def __call__(s,): return s.unpack_from(s.buf,5392+(((s.lastrow()-0)%2880)*3+0)*8)[0] dis.dis(g.__call__) 7 0 LOAD_FAST0 (s) 3 LOAD_ATTR0 (unpack_from) 6 LOAD_FAST0 (s) 9 LOAD_ATTR1 (buf) 12 LOAD_CONST 1 (5392) 15 LOAD_FAST0 (s) 18 LOAD_ATTR2 (lastrow) 21 CALL_FUNCTION0 24 LOAD_CONST 2 (0) 27 BINARY_SUBTRACT 28 LOAD_CONST 3 (2880) 31 BINARY_MODULO 32 LOAD_CONST 4 (3) 35 BINARY_MULTIPLY 36 LOAD_CONST 2 (0) 39 BINARY_ADD 40 LOAD_CONST 5 (8) 43 BINARY_MULTIPLY 44 BINARY_ADD 45 CALL_FUNCTION2 48 LOAD_CONST 2 (0) 51 BINARY_SUBSCR 52 RETURN_VALUE -- Netzwerkadministration/Zentrale Dienste, Interdiziplinaeres Zentrum fuer wissenschaftliches Rechnen der Universitaet Heidelberg IWR; INF 368; 69120 Heidelberg; Tel: (06221)54-8236 Fax: -5224 Email: hermann.la...@iwr.uni-heidelberg.de -- http://mail.python.org/mailman/listinfo/python-list
Re: recv_into(bytearray) complains about a pinned buffer
On Feb 2, 12:12 am, Martin v. Loewis wrote: My recommendation would be to not use recv_into in 2.x, but only in 3.x. I don't think that's the full solution. The array module should also implement the new buffer API, so that it would also fail with the old recv_into. Okay. But recv_into was added in 2.5 and the test case in 2.6's test_socket.py clearly allows an array there: def testRecvInto(self): buf = array.array('c', ' '*1024) nbytes = self.cli_conn.recv_into(buf) self.assertEqual(nbytes, len(MSG)) msg = buf.tostring()[:len(MSG)] self.assertEqual(msg, MSG) Checking koders and Google Code search engines, I found one project which used recv_into, with the filename bmpreceiver.py . It uses a array.array(B, [0] * length) . Clearly it was added to work with an array, and it's being used with an array. Why shouldn't people use it with Python 2.x? Andrew da...@dalkescientific.com -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3147 - new .pyc format
On Mon, 01 Feb 2010 21:19:52 +0100, Daniel Fetchinson wrote: Personally, I think it is a terribly idea to keep the source file and byte code file in such radically different places. They should be kept together. What you call clutter I call having the files that belong together kept together. I see why you think so, it's reasonable, however there is compelling argument, I think, for the opposite view: namely to keep things separate. An average developer definitely wants easy access to .py files. However I see no good reason for having access to .pyc files. I for one have never inspected a .pyc file. Why would you want to have a .pyc file at hand? If you don't care about access to .pyc files, why do you care where they are? If they are in a subdirectory module.pyr, then shrug and ignore the subdirectory. If you (generic you) are one of those developers who don't care about .pyc files, then when you are browsing your source directory and see this: module.py module.pyc you just ignore the .pyc file. Or delete it, and Python will re-create it as needed. So if you see module.pyr/ just ignore that as well. If we don't really want to have .pyc files in convenient locations because we (almost) never want to access them really, then I'd say it's a good idea to keep them totally separate and so make don't get in the way. I like seeing them in the same place as the source file, because when I start developing a module, I often end up renaming it multiple times before it settles on a final name. When I rename or move it, I delete the .pyc file, and that ensures that if I miss changing an import, and try to import the old name, it will fail. By hiding the .pyc file elsewhere, it is easy to miss deleting one, and then the import won't fail, it will succeed, but use the old, obsolete byte code. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Modules failing to add runtime library path info at link time
cjblaine wrote: Where/how can I configure the appropriate portion of our Python install to do 100% the right thing instead of just 50% (-L)? Python's distutils doesn't alter the library search path unless you tell it explicitly. A specific example -- note the -L and lack of -R (Solaris build): % python setup.py build gcc -shared build/temp.solaris-2.10-sun4u-2.6/pgmodule.o -L/afs/rcf/ apps/catchall/lib -lpq -o build/lib.solaris-2.10-sun4u-2.6/_pg.so % The Extension() class supports the rpath argument. Simply add rpath=/path/to/library/dir and you are good. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Optimized bytecode in exec statement
On 2/1/2010 6:05 PM, Hermann Lauer wrote: Dear All, while trying to optimize some unpack operations with self compiling code I wondered howto invoke the optimization in the exec statement. Even starting with -O or -OO yields in Python 2.5.2 the same dis.dis code, which is appended below. Currently, as far as I know, -0 just removes asserts. My interest would be to reduce the LOAD_FAST ops of s with DUP_TOP on the stack (are there hash lookups behind those ?) Load_fast is a locals array lookup. load_fast 0 (s) means put locals[0] on the top of the stack. The '(s)' is added for the human reader. and of course to optimize the integer arithmetics following below (removing +-0 etc). Something + 0 is no necessarily something. It depends on the type of something. So the interpreter will not optimize it away. What concretely happens with int+0 is a different matter. You can remove it though, if you want to get into byte-code hacking, but why write '+0' if you do not want it? Thanks for any ideas, greetings Hermann import dis g=r.rra.LAST3.getter(ds=0,row=0) class fa(struct.Struct): def __init__(s): super(fa,s).__init__('d') def __call__(s,): return s.unpack_from(s.buf,5392+(((s.lastrow()-0)%2880)*3+0)*8)[0] dis.dis(g.__call__) 7 0 LOAD_FAST0 (s) 3 LOAD_ATTR0 (unpack_from) 6 LOAD_FAST0 (s) 9 LOAD_ATTR1 (buf) 12 LOAD_CONST 1 (5392) 15 LOAD_FAST0 (s) 18 LOAD_ATTR2 (lastrow) 21 CALL_FUNCTION0 24 LOAD_CONST 2 (0) 27 BINARY_SUBTRACT 28 LOAD_CONST 3 (2880) 31 BINARY_MODULO 32 LOAD_CONST 4 (3) 35 BINARY_MULTIPLY 36 LOAD_CONST 2 (0) 39 BINARY_ADD 40 LOAD_CONST 5 (8) 43 BINARY_MULTIPLY 44 BINARY_ADD 45 CALL_FUNCTION2 48 LOAD_CONST 2 (0) 51 BINARY_SUBSCR 52 RETURN_VALUE Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: For loop searching takes too long!
On Mon, 01 Feb 2010 14:04:01 -0800, Jonathan Gardner wrote: Having worked with datasets that are truly enormous, whenever I see a list that is unbounded (as this appears to be), I freak out because unbounded can be a really, really big number. Might as well write software that works for the truly enormous case and the really large case and be done with it once and for all. Then write it to work on iterators, if at all possible, and you won't care how large the data stream is. Even databases have limits! Of course you should write your code to deal with your expected data, but it is possible to commit overkill as well as underkill. There are trade- offs between development effort, runtime speed, memory usage, and size of data you can deal with, and maximizing the final one is not always the best strategy. Look at it this way... for most applications, you probably don't use arbitrary precision floats even though floating point numbers can have an unbounded number of decimal places. But in practice, you almost never need ten decimal places to pi, let alone an infinite number. If the creators of floating point libraries wrote software that works for the truly enormous case, the overhead would be far too high for nearly all applications. Choose your algorithm according to your expected need. If you under- estimate your need, you will write slow code, and if you over-estimate it, you'll write slow code too. Getting that balance right is why they pay software architects the big bucks *wink* -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Optimized bytecode in exec statement
Terry Reedy wrote: Currently, as far as I know, -0 just removes asserts. -O (not -0) also sets __debug__ to False. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Optimized bytecode in exec statement
En Mon, 01 Feb 2010 20:05:16 -0300, Hermann Lauer hermann.la...@iwr.uni-heidelberg.de escribió: while trying to optimize some unpack operations with self compiling code I wondered howto invoke the optimization in the exec statement. Even starting with -O or -OO yields in Python 2.5.2 the same dis.dis code, which is appended below. There is not much difference with -O or -OO; assert statements are removed, __debug__ is False, docstrings are not stored (in -OO). Code generation is basically the same. My interest would be to reduce the LOAD_FAST ops of s with DUP_TOP on the stack (are there hash lookups behind those ?) No, no lookup is performed at run time. LOAD_FAST takes an integer argument, an index into the locals array. The compiler knows (by static analysis, at compile time) which names are local; those objects are stored in a C array. I've not done such microbenchmark, but using DUP_TOP instead might even be slower. and of course to optimize the integer arithmetics following below (removing +-0 etc). Can't you remove it from source beforehand? (or, from `r.rra.LAST3.getter(ds=0,row=0)` since it looks like a code generator) In general, x+0 may execute arbitrary code, depending on the type of x. Only if you could determine that x will always be an integer, you could optimize +0 away. Python (the current version of CPython) does not perform such analysis; you may investigate psyco, Unladen Swallow, ShedSkin for such things. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote: for example, in if you have a function 'f' which takes two parameters to call the function and get the result you use: f 2 3 If you want the function itself you use: f How do you call a function of no arguments? There's no such thing. All functions take one argument and return a value. As functions don't have side-effects, there is seldom much point in having a function with no arguments or which doesn't return a value. In cases where it is useful (i.e. a value must have function type), you can use the unit type () (essentially a zero-element tuple), e.g.: f () = 1 or: f x = () -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
Nobody wrote: On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote: for example, in if you have a function 'f' which takes two parameters to call the function and get the result you use: f 2 3 If you want the function itself you use: f How do you call a function of no arguments? There's no such thing. All functions take one argument and return a value. As functions don't have side-effects, there is seldom much point in having a function with no arguments or which doesn't return a value. In cases where it is useful (i.e. a value must have function type), you can use the unit type () (essentially a zero-element tuple), e.g.: f () = 1 or: f x = () A function with no arguments could be used as a lazy constant, generated only on demand. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
On Mon, Feb 1, 2010 at 6:14 PM, MRAB pyt...@mrabarnett.plus.com wrote: Nobody wrote: On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote: for example, in if you have a function 'f' which takes two parameters to call the function and get the result you use: f 2 3 If you want the function itself you use: f How do you call a function of no arguments? There's no such thing. All functions take one argument and return a value. As functions don't have side-effects, there is seldom much point in having a function with no arguments or which doesn't return a value. In cases where it is useful (i.e. a value must have function type), you can use the unit type () (essentially a zero-element tuple), e.g.: f () = 1 or: f x = () A function with no arguments could be used as a lazy constant, generated only on demand. The usefulness of that depends on a language's evaluation strategy. Haskell, for instance, uses lazy evaluation by default, so your use case doesn't apply in that instance. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Ruby
On Mon, 01 Feb 2010 14:35:57 -0800, Jonathan Gardner wrote: If it was common-place to use Curried functions and partial application in Python, you'd probably prefer f a b c to f(a)(b)(c) as well. That's just the point. It isn't common to play with curried functions or monads or anything like that in computer science today. Yes, Haskell exists, and is a great experiment in how such a language could actually work. But at the same time, you have to have a brain the size of the titanic to contain all the little details about the language before you could write any large-scale application. No, not really. Haskell (and previously ML) are often used as introductory languages in Comp.Sci. courses (at least in the UK). You don't need to know the entire language before you can use any of it (if you did, Python would be deader than a certain parrot; Python's dark corners are *really* dark). The lack of mutable state (or at least, the isolation of it within monads) eliminates a lot of potential problems. How many Python novices get tripped up by x = y = [] ; x.append(...); # now y has changed? And in spite of the category theory behind monads, Haskell's I/O system really isn't any more complex than that of any other language, beyond the constraint that you can only use it in procedures (i.e. something returning an IO instance), not in functions. Which for the most part, is a net win, as it forces you to maintain a reasonable degree of structure. Now, if you actually want to use everything the language has to offer, you can run into some fairly hairy error messages. But then I've found that to be a common problem with generic programming in general. E.g. error messages relating to the C++ STL can be quite insanely complex (particularly when the actual error is there are so many nested templates that the mangled function name is longer than the linker can handle and it's trying to explain *where* the error is). -- http://mail.python.org/mailman/listinfo/python-list