HI I AM VIVEK
a rel=nofollow target=_blank href=http://www.anrdoezrs.net/ click-2701385-10313598 img src=http://www.tqlkg.com/image-2701385-10313598; width=600 height=300 alt=Search FastWeb see Green! border=0//a a rel=nofollow target=_blank href=http://www.jdoqocy.com/ click-2701385-10484777 img src=http://www.tqlkg.com/image-2701385-10484777; width=160 height=600 alt=Wanted! Professionals Seeking $80,000 to $500,000+ border=0//a a rel=nofollow target=_blank href=http://www.kqzyfj.com/ click-2701385-1200282 img src=http://www.ftjcfx.com/image-2701385-1200282; width=234 height=60 alt=Jumpline.com VDS Web Hosting border=0//a a rel=nofollow target=_blank href=http://www.kqzyfj.com/ click-2701385-10509491 img src=http://www.ftjcfx.com/image-2701385-10509491; width=100 height=75 alt= border=0//a a rel=nofollow target=_blank href=http://www.kqzyfj.com/ click-2701385-10380785 img src=http://www.ftjcfx.com/image-2701385-10380785; width=88 height=31 alt= border=0//a -- http://mail.python.org/mailman/listinfo/python-list
Re: Avoid newline at the end
On Nov 11, 10:22 am, Florian Lindner [EMAIL PROTECTED] wrote: Hello, I have a piece of code like that: for row in resultSet: logs += /home/%s/%s/log/access.log \n % (row[1], row[0]) logs += /home/%s/%s/log/error.log \n % (row[1], row[0]) # -- Now I want to avoid the newline at the last iteration and only at the second line. How to do that most elegantly with Python? Naively after your code... logs = logs.rstrip() But probably, I'd have constructed the list of logs, then used 'join' to build the string. logs = [] for row in resultSet: for name in ('access.log', 'error.log'): logs += ['/home/%s/%s/log/%s' % (row[1], row[0], name)] logs = '\n'.join(logs) Or equivalently using a list comprehension... logs = '\n'.join('/home/%s/%s/log/%s' % (row[1], row[0], name) for row in resultSet for name in ('access.log', 'error.log')) -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list
why ctypes+dll gives a strange result
you can download the files at http://www.newsmth.net/att.php?s.284.38015.655.zip the dll and exe are created by freebasic import ctypes mydll=ctypes.windll.LoadLibrary(mydll.dll) _TwoTimes=getattr(mydll,'[EMAIL PROTECTED]') _TwoTimes.argtypes=[ctypes.c_double] def TwoTimes(i): return _TwoTimes(i) in fact, twotimes function return double*2, but when I use print TwoTimes(10) in python, I get 2226880 thanx -- http://mail.python.org/mailman/listinfo/python-list
Re: Python iPod challenge
Il Thu, 08 Nov 2007 08:11:27 -0600, Tim Chase ha scritto: I had similar problems. Additionally, that's pretty unpythonic code, as the correct answer would be something like That's true, but you should remember it's a linguistic experiment, not a Python programming contest. The task is not to do that thing in the best possible way, but to fill in the gaps. You should just try to understand what the original programmer did and to complete the program in such way. Real problems here lie in the webapp implementation: it should check for javascript *before* beginning the test (I have noscript enabled, and had to give permission to the site, hence it took me far more time to complete the test since I was just clicking but obtaining nothing) and should state more clearly that it just needs the number of letters as the output (this should be related to scripteaze problem) without any other character. Error messages are pretty counter-intuitive. -- Alan Franzoni [EMAIL PROTECTED] - Togli .xyz dalla mia email per contattarmi. Remove .xyz from my address in order to contact me. - GPG Key Fingerprint (Key ID = FE068F3E): 5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E -- http://mail.python.org/mailman/listinfo/python-list
Re: Avoid newline at the end
On Sun, 11 Nov 2007 11:22:19 +0100, Florian Lindner wrote: Hello, I have a piece of code like that: for row in resultSet: logs += /home/%s/%s/log/access.log \n % (row[1], row[0]) logs += /home/%s/%s/log/error.log \n % (row[1], row[0]) # -- Now I want to avoid the newline at the last iteration and only at the second line. That means your log file doesn't end with a newline. That's often not good, because it can confuse some tools. Also, appending lots of strings together like that is very inefficient. How to do that most elegantly with Python? If you have a small number of rows (say, less than a few tens of thousands), you can do this: rows = [] for row in resultSet: rows.append(/home/%s/%s/log/access.log % (row[1], row[0])) rows.append(/home/%s/%s/log/error.log % (row[1], row[0])) # note that there are no newlines logs = '\n'.join(rows) # do it once at the end But again, when you write text to a file, you should end it with a newline. It isn't compulsory, but it is best practice. Alternatively, check out the logging module. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list
Re: python - an eggs...
bruce schrieb: Hi... I have a python script/app that i'm dealing with. It uses Durus, which installs as an egg. I'm trying to figure out how to modify any of the underlying source files or the egg, short of modifying the original source file, and then having to reinstall the egg via python setup.py install... I'm relatively new to python/egg(s), but I can't seem to find a way to accomplish this via the 'net. I've looked in the Install file, as well as the setup.py thinking that I migt be able to find a way to simply build the app, and to have the required scripts installed under the /usr/lib/python2.4/site-packages tree as the other pyhon apps/scripts are The app I'm working with is Durus 3.7. I've got the tar.gz uncompressed, but the only thing I get is an egg file, which gets installed/placed under the site-packages dir. Any help/pointers/etc.. would be helpful!! Usually, eggs are created using setuptools [1]. The documentation there is comparably good. So I'm wondering where your troubles come from. Your usecase should be solved by a simple durus-dir# python setup.py develop Then in the site-packages there will be created an egg-link that points to your durus-dir. You can then modify the source. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Portrait of a real life __metaclass__
On 2007-11-11, Jonathan Gardner [EMAIL PROTECTED] wrote: There isn't much difference between match_calendar_month(2007, 11, message) and m = CalendarMonthMatcher(2007, 11) m.match(message) Yes, there isn't a world of difference between the two. But there is a world of difference between those and: match(message, before=date(2007, 12, 1), after=date(2007, 11, 1)) And you can add parameters as needed. In the end, you may have a lot of parameters, but only one match function and only one interface. No, that would be an absolutely, positively bad decision. Heck, suppose I wanted to match messages from @ufl.edu that are at least seven days old, OR all other messages from the previous month or earlier -- but only if we're at least four days into the current month. (This isn't a fanciful invention for the sake of argument, it's an actual rule I'm using right now.) Then, at best, we'd have something like: (match(message, domain=ufl.edu) and match(message, before=date(2007, 11, 4)) or (match(message, before=date(2007, 11, 1)), \ butMatchThePreviousMonthInsteadIfDaysIntoCurrentMonthIsLessThan=4)) Or you could go the other way and try to solve it by adding even more arguments to the function, but then you're even worse off for complexity. Either way, you're left without an abstract way to say this month or previous week without implementing the logic to do so separately from the data. In my experience, that kind of design ends up making things a lot more complicated than they need to be, once the application is put to use and once you (or worse, somebody else) starts wanting to extend it. Compare that to the actual implementation of this rule in my program: rule= Or( And( SenderPattern(re.compile(@ufl\.edu)), DaysOld(7) ), CalendarMonthOld(match_delay_days=4) ) rule.match(message) (The current implementation of CalendarMonthOld takes the current month if not otherwise specified.) Or it could be that you are confusing two things with each other. [...] How do you avoid complexity? You take a step back, identify patterns, or pull different things apart from each other (like rows and columns), and try to find the most basic principles to guide the entire system. If I could just break everything down into date ranges, I would. But that doesn't give me the kind of behavior I want. The very fact that you are talking about months (and thus days and weeks and years and centuries, etc...) and not generic dates means you have some more simplifying to do in your design elsewhere as well. No, it truly does not. Sometimes I want to match a message that is N days old; sometimes I want to match a message from the previous *calendar month* or earlier, which can not be readily specified as a number of days; the same goes for calendar year, calendar week, etc. Some small amount of calculation has to be performed to convert a given number of calendar weeks into a datetime range. And in order for the user -- that is, primarily, me, but hopefully others too once I get around to polishing up this thing -- to be able to generically say, match all the messages from the last quarter, bundling such behavior with the data it operates on makes the system easier to implement and *much* easier to extend. If I used a monolithic match() function, as you suggest, then any user who wanted to implement a new message handling action or a new matching rule would need to alter the core application. With my approach, all that user needs to do is toss a module containing his or her custom Matcher and Action implementations into a certain directory, and he's good to go. Rewrite the SaveAttachmentsByMonth so that it calls a more generic SaveAttachmentsByDateRange function. Or better yet, have it FilterEmailsByDateRange and ExtractAttachment and SaveAttachment. Or even better, have it FilterEmailsBySpecification(date_from=X, date_to=Y) and SaveAttachmentl. Yeah, actually the class I have defined for this action *is* a more generic save attachments by date range action type, as I used for an example later in that post when I described passing it a CalendarWeek date range instead of a CalendarMonth. The confusion on this point is my fault, though, as I also referred to this action as SaveAttachmentsByMonth in a misguided attempt at clarifying my point. Do you see the point? Your big function SaveAttachmentsByMonth is kind of like point number 735. It's easier to describe it as the point at (7,35) than as a single number. It's better to talk about the most basic functionality --- saving emails and filter emails -- rather than talking about big concepts. [...] Your users will appreciate it as well. While it may be nice to have a shiny button that saves attachments by months, they'd rather they could specify the date ranges theyd like to use (hours? Days? Weeks? Quarters?) and what they'd like to
Re: Python Extension Building Network
On Nov 10, 11:03 pm, Yu-Xi Lim [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi, I am trying to get a small group of volunteers together to create Windows binaries for any Python extension developer that needs them, much like the package/extension builders who volunteer their time to create Linux RPMs. Mike It's not entirely clear to me what you're compiling. Most of the modules you have there do not have native code. I'm guessing your main focus is building .exe installers for Windows users. The main objective is to make it easier for Windows users to install the modules, so that's what the .exe is for. Admittedly developers should know how to install from source, but the newbs don't always know how and I've had some trouble with some of the more complex ones myself. If it's just installers of pure Python code, why the extra effort of using both VS and MingW? AFAIK, they both yield functionally identical results---the exact same .py files get installed. I am using both because Steve Holden asked me to try MinGW. I was just going to use Visual Studio. However, I thought it might be a good idea to try it both ways to make sure it could be done in a completely open source environment. I'm pretty sure you can use MinGW on impure Python extensions too, although it takes more work. I'm also not sure how big a task this is or the issues involved, but here's my take based on what I've read: Throwing more manpower at the task is not the solution. The actual process can be and SHOULD BE highly automated. All that's needed are a proper distutils script, and proper tests. Both responsibilities should fall on the shoulders of the module authors, though I guess experienced volunteers can help out with the former. I would like to do this and I was trying to come up with a way to do just that. For some reason, when I mentioned that idea to one of my more knowledgeable contacts, he didn't see the need for it. If the module is pure Python, there should be little need for testing the installer specifically on Windows. If there's a failure, then the module itself is buggy (e.g. making platform-specific assumptions) or there's similar problem with the install script. For a large number of modules on PyPI, building the installer is trivial (assuming pure Python, and a setup script). Compiling them can be easily automated: 1) check PyPI for updates 2) download the latest update 3) build the .exe 3) upload to a website. All that remains is the need for some hardware (a build farm) and the occasional manual intervention. If I'm not mistaken, distutils can build Windows installers on other platforms. Maybe you could set up a Linux LiveCD with the necessary tools installed and distribute that. Module authors who want to build Windows installers can easily use that CD. Volunteers wanting to help can do so easily without having to repeat the task of setting up the toolchain separately. I've been told that distutils can build Windows installers on other platforms, but I think that may apply only to pure Python extensions only. I've done some work as a port maintainer (aka package maintainer) for FreeBSD. The BSD port system is somewhat closer to PEAK's Easy Install, however binary packages (similar to RPMs or DEBs) are also available. The port maintainer's job is solely to ensure that the Makefile (build script) is working and up to date. The actual testing of the code is done by the authors of the software itself and the port maintainer only ensures that the install script works right. Binary packages are built by an automated system using a cluster of computers for various architectures and supported OS versions. Errors during builds are sent to to port maintainers. A similar system is used for most Linux distributions with a central repository for packages. I like this idea quite a bit. It's nice to know that other people are thinking along the same lines as I am. However, I am not sure how to do this myself. I assume when you mean by creating a Linux Live CD with the proper tools, you mean that it should include MinGW and Python. I suppose the only problem with that is the dependency issue. There's a number of modules that require arbitrary modules for the setup.py file to run. Mechanize is one such module as it require ClientForm. Some of the others I've done required various versions of Easy Setup or ElementTree. I'm not sure how this is resolved unless you can just download these items during the Live CD session and install them to memory. However, I don't think this is currently possible, correct? I'll float your ideas by Holden and see what he thinks though. Thanks for the ideas. Mike -- http://mail.python.org/mailman/listinfo/python-list
RE: Extended date and time
The time module in the standard library does epoch, and conversions. Get current local time in seconds since epoch (1970): import time now_secs = time.time() print now_secs 1194790069.33 Convert to a struct_time object for conversions: now_struct = time.localtime(now_secs) print now_struct (2007, 11, 11, 8, 7, 49, 6, 315, 0) Make it a readable string: now_string = time.strftime('%a %m/%d/%Y, %I:%M:%S %p', now_struct) print now_string 'Sun 11/11/2007, 08:07:49 AM' Convert string back into a struct_time object, then seconds again: now_struct2 = time.strptime(now_string, '%a %m/%d/%Y, %I:%M:%S %p') print now_struct2 (2007, 11, 11, 8, 7, 49, 6, 315, -1) now2 = time.mktime(now_struct2) print now2 1194790069.0 ... etc. If you're starting the other direction, change the format string passed to strptime to match the pattern of your existing strings. The standard docs for the time module has all the details. - Adam From: [EMAIL PROTECTED] on behalf of Jeremy Sanders Sent: Sat 11/10/2007 9:37 AM To: python-list@python.org Subject: Extended date and time Hi - I need to add support to a program for dates and times. The built-in Python library seems to be okay for many purposes, but what I would like would be Unix epoch style times (seconds relative to some date), covering a large period from the past to the future. What would be nice would be a library which can take floating point seconds from an epoch. Does anyone know of a library which can convert from human style dates and times to a floating point epoch and back again? I expect I could fudge the fractional seconds with the built-in library, but I can't see how to get dates in the past. Thanks, Jeremy. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: security code whit python
[EMAIL PROTECTED] wrote: On 10 Kas m, 23:57, Wildemar Wildenburger I have setuped pyx i wonder i have mistake? So far you seem to be treating this group as a free help desk for a program you have paid thousands of dollars for. See http://www.catb.org/~esr/faqs/smart-questions.html You've given a full traceback, but you have spent no effort describing what your goal is or what different things you've done to solve _your_ problem. -Scott -- http://mail.python.org/mailman/listinfo/python-list
Re: Global variables within classes.
On 11 10 , 10 01 , Donn Ingle [EMAIL PROTECTED] wrote: def pop(self): item = self.list[-1] del self.list[-1] return item Is there some reason you do all that and not a self.list.pop(0)? Hi. There are no special reasons I do it that way. Just not familiar with the member function 'pop'. Thanks for your reminding -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
- Original Message From: Paul Rubin http://[EMAIL PROTECTED] To: python-list@python.org Sent: Sunday, November 11, 2007 12:45:44 AM Subject: Re: Populating a dictionary, fast Michael Bacarella [EMAIL PROTECTED] writes: If only it were so easy. I think I know what's going on, the dictionary updates are sending the GC into quadratic behavior. Try turning off the GC: import gc gc.disable() Tried that already. No difference. :( -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
On Nov 11, 7:35 am, Michael Bacarella [EMAIL PROTECTED] wrote: Tried that already. No difference. :( Not sure if it would make a difference, and it would imply re- organizing your preceding lines, but what about doing the dictionary build in one go, rather than incrementally? Using the dict function, which takes a list of (key,value) tuples. I use it frequently as a space-saver and it works well enough. It may speed things up, I dunno. I had to break out your formatting in its own function and that can't help too much. Something like: def fmt(line): id,name = line.strip().split(':') id = long(id) return (id,name) id2name = dict([fmt(line) for line in iter(open('id2name.txt').readline,'')]) Cheers -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
Steven == Steven D'Aprano [EMAIL PROTECTED] writes: Steven $ time ./slurp_dict.py Starting at Sun Nov 11 14:26:51 Steven 2007 Line 0 Line 100 Line 200 Line 300 Line Steven 400 Line 500 Line 600 Line 700 Line Steven 800 Items in dict: 8191180 Completed import at Sun Nov Steven 11 14:29:31 2007 Starting to delete dict... Steven Traceback (most recent call last): File ./slurp_dict.py, Steven line 20, in module del id2name KeyboardInterrupt Steven real 35m52.334s user 1m17.663s sys 0m16.758s Steven Notice that the dict is completely read into memory in Steven just two and a half minutes. The script then tries to Steven delete the dict, and 32 minutes later is still Steven struggling. That's the point I got sick of waiting and Steven interrupted the script. Steven Conclusion: it's a memory issue, or maybe a garbage Steven collection issue, not a problem with dicts. uh, strange results... I run your same scripts with and without garbage collection enabled and those are the results: with gc enabled: [EMAIL PROTECTED]:~/wip/zodb_test$ python slurp_dict.py Starting at Sun Nov 11 16:35:12 2007 Line 0 Line 100 Line 200 Line 300 Line 400 Line 500 Line 600 Line 700 Line 800 Items in dict: 8191180 Completed import at Sun Nov 11 16:36:03 2007 Starting to delete dict... Completed deletion at Sun Nov 11 16:36:09 2007 Finishing at Sun Nov 11 16:36:09 2007 and without gc enabled [EMAIL PROTECTED]:~/wip/zodb_test$ python slurp_dict.py Starting at Sun Nov 11 16:39:02 2007 Line 0 Line 100 Line 200 Line 300 Line 400 Line 500 Line 600 Line 700 Line 800 Items in dict: 8191180 Completed import at Sun Nov 11 16:39:49 2007 Starting to delete dict... Completed deletion at Sun Nov 11 16:39:56 2007 Finishing at Sun Nov 11 16:39:56 2007 all with python2.4 on and i386 Linux cheers Alberto -- http://mail.python.org/mailman/listinfo/python-list
Trouble with subprocess.call(...) and zsh script (OSError: [Errno 8] Exec format error)
Hi, (Python 2.5, OS X 10.4.10) I have a program called pdb2pqr on my system. It is installed so that pdb2pqr is in my path and looks like: #\!/bin/zsh -f /sw/share/pdb2pqr/pdb2pqr.py $@ When I call it via this script: #!/usr/bin/env python import subprocess import tempfile args = ('/sw/bin/pdb2pqr','--help') output_file = tempfile.TemporaryFile(mode=w+) print Running,args retcode = subprocess.call(args,stdout=output_file.fileno(),stderr=subprocess.STDOUT) output_file.close() I get this error: localhost~/tmp$ ./x.py Running ('/sw/bin/pdb2pqr', '--help') Traceback (most recent call last): File ./x.py, line 9, in module retcode = subprocess.call(args,stdout=output_file.fileno(),stderr=subprocess.STDOUT) File /sw/lib/python2.5/subprocess.py, line 443, in call return Popen(*popenargs, **kwargs).wait() File /sw/lib/python2.5/subprocess.py, line 593, in __init__ errread, errwrite) File /sw/lib/python2.5/subprocess.py, line 1051, in _execute_child raise child_exception OSError: [Errno 8] Exec format error But when I change it to directly call the script that the zsh script calls like this: args = ('/sw/share/pdb2pqr/pdb2pqr.py','--help') everything works: localhost~/tmp$ ./x.py Running ('/sw/share/pdb2pqr/pdb2pqr.py', '--help') This is with 2.5 on OS X 10.4.10. I'm happy to provide whatever additional information might be useful. Thanks, -michael -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
Ah, well, just noticed Ben's suggested this already. Mind you, his code, while correct in intent, does look a bit fishy (missing those square brackets), so don't dismiss it just because you had trouble running it (or mine). Definitely worth a try and I'd be curious to know if it makes a difference. -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
Steven D'Aprano wrote: (2) More memory will help avoid paging. If you can't get more memory, try more virtual memory. It will still be slow, but at least the operating system doesn't have to try moving blocks around as much. Based on his previous post, it would seem he has 7GB of RAM (with about 5GB free) and 2GB of swap. I don't think RAM is the issue. Maybe there's something wrong with his specific Python installation. What version is it and was it compiled by him? This version: $ python Python 2.3.4 (#1, May 2 2007, 19:18:17) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2 Type help, copyright, credits or license for more information. $ rpm -qi python Name: python Relocations: (not relocatable) Version : 2.3.4 Vendor: CentOS Release : 14.4 Build Date: Wed 02 May 2007 07:20:29 PM EDT Install Date: Mon 04 Jun 2007 05:48:29 PM EDT Build Host: builder6 Group : Development/Languages Source RPM: python-2.3.4-14.4.src.rpm Size: 21137194 License: PSF - see LICENSE Signature : DSA/SHA1, Sat 05 May 2007 09:33:49 AM EDT, Key ID a53d0bab443e1821 URL : http://www.python.org/ $ uname -a Linux xxx 2.6.9-22.ELsmp #1 SMP Sat Oct 8 21:32:36 BST 2005 x86_64 x86_64 x86_64 GNU/Linux We've also tried it on this version (on a different machine): $ python Python 2.4.3 (#1, Mar 14 2007, 19:01:42) [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2 Type help, copyright, credits or license for more information. $ rpm -qi python Name: python Relocations: (not relocatable) Version : 2.4.3 Vendor: CentOS Release : 19.el5Build Date: Wed 14 Mar 2007 11:06:42 PM UTC Install Date: Mon 29 Oct 2007 07:03:16 PM UTC Build Host: builder6 Group : Development/Languages Source RPM: python-2.4.3-19.el5.src.rpm Size: 22087600 License: PSF - see LICENSE Signature : DSA/SHA1, Wed 04 Apr 2007 12:26:58 AM UTC, Key ID a8a447dce8562897 URL : http://www.python.org/ Summary : An interpreted, interactive, object-oriented programming language. $ uname -a Linux yyy 2.6.18-8.el5 #1 SMP Thu Mar 15 19:46:53 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
On Nov 10, 4:56 pm, Michael Bacarella [EMAIL PROTECTED] wrote: This would seem to implicate the line id2name[id] = name as being excruciatingly slow. As others have pointed out there is no way that this takes 45 minutes.Must be something with your system or setup. A functionally equivalent code for me runs in about 49 seconds! (it ends up using about twice as much ram as the data on disk) i. -- http://mail.python.org/mailman/listinfo/python-list
Re: easy 3D graphics for rendering geometry?
gsal wrote: On Nov 10, 11:13 am, Scott David Daniels [EMAIL PROTECTED] wrote: Well, what kind of computer, what version of everything (OS, Python, VPython), what display card, Windows XP Professional Version 2002, Service Pack 2 1.4GHz, 512MB ATI MOBILITY RADEON 9000 Python 2.5, VPython 2.5 gsal Well, I'm running Python-2.5.1 and VPython 3.2.11 successfully on an NVIDIA GeForce 7100 GS on XP. I generally don't see the problems you are seeing. I know they are still struggling a bit with the Windows code (due in part to Arthur Siegel's untimely demise) and OpenGL on 2.5. Do simple things always break, or do you kind of know what you do that breaks it? BTW, there is a newsgroup/mailing list that you should know about that I read on gmane: gmane.comp.python.visualpython.user Are you including calls to sleep and/or rate in your loops? -Scott -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
Firstly, thank you for all of your help so far, I really appreciate it. So, you think the Python's dict implementation degrades towards O(N) performance when it's fed millions of 64-bit pseudo-random longs? No. Yes. I tried your code (with one change, time on feedback lines) and got the same terrible performance against my data set. $ cat stevescode.py #!/usr/bin/python Read a big file into a dict. import gc import time print Starting at %s % time.asctime() flag = gc.isenabled() gc.disable() id2name = {} for n, line in enumerate(open('id2name.txt', 'r')): if n % 100 == 0: # Give feedback. print Line %d % n,time.asctime() id,name = line.strip().split(':', 1) id = long(id) id2name[id] = name print Items in dict:, len(id2name) print Completed import at %s % time.asctime() print Starting to delete dict... del id2name print Completed deletion at %s % time.asctime() if flag: gc.enable() print Finishing at %s % time.asctime() $ ./stevescode.py Starting at Sun Nov 11 10:46:37 2007 Line 0 Sun Nov 11 10:46:37 2007 Line 100 Sun Nov 11 10:48:22 2007 Line 200 Sun Nov 11 10:51:08 2007 Line 300 Sun Nov 11 10:56:16 2007 Line 400 Sun Nov 11 10:58:41 2007 Line 500 Sun Nov 11 11:03:26 2007 ^C To prove that my machine is sane, I ran the same against your generated sample file and got _excellent_ performance. Start to finish in under a minute. $ cat steves-makedict.py #!/usr/bin/python Make a big file of 64-bit integer keys plus random values. bits64 = 2**64 import random template = '%d:This is a bunch of text...\n' fp = open('id2name.txt', 'w') for i in xrange(8191180): fp.write(template % random.randint(0, bits64)) fp.close() $ ./steves-makedict.py $ ./stevescode.py Starting at Sun Nov 11 11:15:31 2007 Line 0 Sun Nov 11 11:15:31 2007 Line 100 Sun Nov 11 11:15:37 2007 Line 200 Sun Nov 11 11:15:43 2007 Line 300 Sun Nov 11 11:15:49 2007 Line 400 Sun Nov 11 11:15:54 2007 Line 500 Sun Nov 11 11:16:00 2007 Line 600 Sun Nov 11 11:16:07 2007 Line 700 Sun Nov 11 11:16:12 2007 Line 800 Sun Nov 11 11:16:18 2007 Items in dict: 8191180 Completed import at Sun Nov 11 11:16:19 2007 Starting to delete dict... Completed deletion at Sun Nov 11 11:16:23 2007 Finishing at Sun Nov 11 11:16:23 2007 Notice that the dict is completely read into memory in just two and a half minutes. The script then tries to delete the dict, and 32 minutes later is still struggling. That's the point I got sick of waiting and interrupted the script. Conclusion: it's a memory issue, or maybe a garbage collection issue, not a problem with dicts. As you can see, not the case at all against my data set. (1) Presumably you don't want to run your app with the garbage collector turned off. You might still want to play around with the gc module to see what you can learn. As you can see, your version did no better. :( (2) More memory will help avoid paging. If you can't get more memory, try more virtual memory. It will still be slow, but at least the operating system doesn't have to try moving blocks around as much. The machine has 8GB, and is not doing anything else when I run this. (3) Are you sure you need all eight-million-plus items in the cache all at once? Yes. (4) There are lots of algorithms out there for dealing with data too big to fit into main memory. Do some research. It DOES fit into main memory and a dictionary is exactly the right way to do this. (5) There is a data structure designed for dealing with tens of millions of records at once. It is called a database. If you can't find a better algorithm, and refuse to use an existing RDBMS, I suspect you're going to end up inventing a primitive, inefficient, buggy database which is no faster than existing systems out there. I've tried three disk-based implementations already (BerkeleyDB, cdb, and an RDBMS) Performance is terrible because they end up doing too many random disk seeks. Pre-caching all of the data ahead of time has offered us the best performance so far, but is still slower than it ought to be. Creating a HEAP TABLE in the RDBMS is an idea, but moving all of this really easy code into the RDBMS just to find a hashing algorithm that doesn't choke on my keys sounds pretty lame. A cached in main memory hash is the right way to do this. The Perl version runs *very* fast, after all. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python iPod challenge
Hi guys,.. thanks for your thoughtful comments... as Alan says, its just a linguistic experiment... it seems the problem you guys found appears... when combining Windows OS and MSIE... (apologies... m_._m ) Dont know how to fix it .(I am a begginer...) if some soul wanna help out... the code is here... http://test-iq.web.cern.ch/test-iq/piton_is_easy.tar Anyway it works fine with firefox :) Thanks! On Nov 11, 12:55 pm, Alan Franzoni [EMAIL PROTECTED] wrote: Il Thu, 08 Nov 2007 08:11:27 -0600, Tim Chase ha scritto: I had similar problems. Additionally, that's pretty unpythonic code, as the correct answer would be something like That's true, but you should remember it's a linguistic experiment, not a Python programming contest. The task is not to do that thing in the best possible way, but to fill in the gaps. You should just try to understand what the original programmer did and to complete the program in such way. Real problems here lie in the webapp implementation: it should check for javascript *before* beginning the test (I have noscript enabled, and had to give permission to the site, hence it took me far more time to complete the test since I was just clicking but obtaining nothing) and should state more clearly that it just needs the number of letters as the output (this should be related to scripteaze problem) without any other character. Error messages are pretty counter-intuitive. -- Alan Franzoni [EMAIL PROTECTED] - Togli .xyz dalla mia email per contattarmi. Remove .xyz from my address in order to contact me. - GPG Key Fingerprint (Key ID = FE068F3E): 5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
On Nov 11, 11:25 am, Michael Bacarella [EMAIL PROTECTED] wrote: I tried your code (with one change, time on feedback lines) and got the same terrible performance against my data set. To prove that my machine is sane, I ran the same against your generated sample file and got _excellent_ performance. Start to finish in under a minute. One possibility could be that your dataset turns out to be some sort of pathological worst case for the hashing algorithm in python. i. -- http://mail.python.org/mailman/listinfo/python-list
RE: python - an eggs...
Hi Diez... In my case, I do a python setup.py install and i get a Durus...egg installed in the /usr/lib/python2.4/site-packages/ dir... As I understand it, this egg/file contains compressed pythonic files. When I run the app which uses the durus stuff... the app crashes, and displays the durus python script with a path. However, when I simply cut/copy the path, and attempt to view that file, the path doesn't exist on the drive. I'm assuming that there is some sort of relative offset action going on, but that the file actually doesn't exist, except within the egg itself. I've also tried to simply modify the original source file, without rebuilding the egg, which obviously doesn't affect the egg file. So, for now, the only way I can see to modify the src, is to go back to the src files, modify, and rebuild the durus app. I don't see any setuptools neither setuptools, nor man setuptools returns anything on my system. when i run python setup.py develop and I then run my app, it crashes, complaining of a persisten object not being found So I don't think that's the immediate solution. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Diez B. Roggisch Sent: Sunday, November 11, 2007 4:36 AM To: python-list@python.org Subject: Re: python - an eggs... bruce schrieb: Hi... I have a python script/app that i'm dealing with. It uses Durus, which installs as an egg. I'm trying to figure out how to modify any of the underlying source files or the egg, short of modifying the original source file, and then having to reinstall the egg via python setup.py install... I'm relatively new to python/egg(s), but I can't seem to find a way to accomplish this via the 'net. I've looked in the Install file, as well as the setup.py thinking that I migt be able to find a way to simply build the app, and to have the required scripts installed under the /usr/lib/python2.4/site-packages tree as the other pyhon apps/scripts are The app I'm working with is Durus 3.7. I've got the tar.gz uncompressed, but the only thing I get is an egg file, which gets installed/placed under the site-packages dir. Any help/pointers/etc.. would be helpful!! Usually, eggs are created using setuptools [1]. The documentation there is comparably good. So I'm wondering where your troubles come from. Your usecase should be solved by a simple durus-dir# python setup.py develop Then in the site-packages there will be created an egg-link that points to your durus-dir. You can then modify the source. Diez -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: security code whit python
[EMAIL PROTECTED] [EMAIL PROTECTED] (oc) wrote: oc thank you oc but it said oc Traceback (most recent call last): oc File pyshell#3, line 1, in module oc c.text(0, 0, Hello, world!) oc File C:\web\apache\python\lib\pyx\canvas.py, line 309, in text oc return self.insert(self.texrunner.text(x, y, atext, *args, oc **kwargs)) oc File C:\web\apache\python\lib\pyx\text.py, line 1199, in text oc self.execute(expr, self.defaulttexmessagesdefaultrun + oc self.texmessagesdefaultrun + texmessages) oc File C:\web\apache\python\lib\pyx\text.py, line 899, in execute oc self.fontmap = dvifile.readfontmap(self.fontmaps.split()) oc File C:\web\apache\python\lib\pyx\dvifile.py, line 386, in oc readfontmap oc raise RuntimeError(cannot find font mapping file '%s' % oc filename) oc RuntimeError: cannot find font mapping file 'psfonts.map' oc oc I have setuped pyx i wonder i have mistake? Do you have TeX installed? -- Piet van Oostrum [EMAIL PROTECTED] URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
This would seem to implicate the line id2name[id] = name as being excruciatingly slow. As others have pointed out there is no way that this takes 45 minutes.Must be something with your system or setup. A functionally equivalent code for me runs in about 49 seconds! (it ends up using about twice as much ram as the data on disk) You can download the list of keys from here, it's 43M gzipped: http://www.sendspace.com/file/9530i7 and see it take about 45 minutes with this: $ cat cache-keys.py #!/usr/bin/python v = {} for line in open('keys.txt'): v[long(line.strip())] = True -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
I tried your code (with one change, time on feedback lines) and got the same terrible performance against my data set. To prove that my machine is sane, I ran the same against your generated sample file and got _excellent_ performance. Start to finish in under a minute. One possibility could be that your dataset turns out to be some sort of pathological worst case for the hashing algorithm in python. Cool! Putting that on the resume. ;) -- http://mail.python.org/mailman/listinfo/python-list
No backend servers available using httplib
i am trying to access printing templates from avery.com and i get a message from the nsapi plugin:no backend server available.can you help me? -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
Michael Bacarella wrote: You can download the list of keys from here, it's 43M gzipped: http://www.sendspace.com/file/9530i7 and see it take about 45 minutes with this: $ cat cache-keys.py #!/usr/bin/python v = {} for line in open('keys.txt'): v[long(line.strip())] = True It takes about 20 seconds for me. It's possible it's related to int/long unification - try using Python 2.5. If you can't switch to 2.5, try using string keys instead of longs. -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
Michael == Michael Bacarella [EMAIL PROTECTED] writes: This would seem to implicate the line id2name[id] = name as being Michael excruciatingly slow. As others have pointed out there is no way that this takes 45 minutes.Must be something with your system or setup. A functionally equivalent code for me runs in about 49 seconds! (it ends up using about twice as much ram as the data on disk) Michael You can download the list of keys from here, it's 43M Michael gzipped: http://www.sendspace.com/file/9530i7 Michael and see it take about 45 minutes with this: I've downloaded your keys, run your program and this is the result: $ du -h keys.txt 128Mkeys.txt $ time python cache_keys.py real0m55.913s user0m35.286s sys 0m0.852s $ python Python 2.4.4 (#2, Apr 26 2007, 00:02:45) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 $ uname -a Linux lizard 2.6.21-1-k7 #1 SMP Sat May 26 16:56:05 UTC 2007 i686 GNU/Linux cheers Alberto -- http://mail.python.org/mailman/listinfo/python-list
Re: python - an eggs...
bruce schrieb: Hi Diez... In my case, I do a python setup.py install and i get a Durus...egg installed in the /usr/lib/python2.4/site-packages/ dir... As I understand it, this egg/file contains compressed pythonic files. When I run the app which uses the durus stuff... the app crashes, and displays the durus python script with a path. However, when I simply cut/copy the path, and attempt to view that file, the path doesn't exist on the drive. I'm assuming that there is some sort of relative offset action going on, but that the file actually doesn't exist, except within the egg itself. You can unzipp eggs as well, creating a directory that ends in .egg - that works the same. I've also tried to simply modify the original source file, without rebuilding the egg, which obviously doesn't affect the egg file. Then after modification, reinstall. So, for now, the only way I can see to modify the src, is to go back to the src files, modify, and rebuild the durus app. I don't see any setuptools neither setuptools, nor man setuptools returns anything on my system. setuptools is a package that installs creates eggs. You find it documented here: http://peak.telecommunity.com/DevCenter/setuptools It comes with a few commandline-scripts after installation, such as easy_install when i run python setup.py develop and I then run my app, it crashes, complaining of a persisten object not being found So I don't think that's the immediate solution. I can't comment on that, but usually that shouldn't be the case just because of the development mode. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
On Sun, 11 Nov 2007 08:51:37 -0800, Michael Bacarella wrote: As others have pointed out there is no way that this takes 45 minutes.Must be something with your system or setup. A functionally equivalent code for me runs in about 49 seconds! (it ends up using about twice as much ram as the data on disk) You can download the list of keys from here, it's 43M gzipped: http://www.sendspace.com/file/9530i7 and see it take about 45 minutes with this: $ cat cache-keys.py #!/usr/bin/python v = {} for line in open('keys.txt'): v[long(line.strip())] = True Takes about 40 seconds here. [EMAIL PROTECTED]:~$ time python test.py real0m38.758s user0m25.290s sys 0m1.580s Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
which tool to use?
Hello, I'm looking for a system for managing submissions of proposals, with multiple parts, and possible updating of those parts by the user (so it needs some basic version control). There has to be some sort of permissions enforcement, to distinguish submitters from committee members reading/commenting on proposals. I've looked at Plone, but am not sure if it is the correct tool for this job: it's much more than I need. I could try to roll my own, but it seems like I'd be reinventing the wheel. Is there software out there already for this kind of thing, preferably customizable in Python? I can be more specific about my requirements if that would help. thanks, Brian Blais -- Brian Blais [EMAIL PROTECTED] http://web.bryant.edu/~bblais -- http://mail.python.org/mailman/listinfo/python-list
Re: Avoid newline at the end
Florian Lindner [EMAIL PROTECTED] writes: for row in resultSet: logs += /home/%s/%s/log/access.log \n % (row[1], row[0]) logs += /home/%s/%s/log/error.log \n % (row[1], row[0]) # -- def logfile_path(name, row): return /home/%s/%s/log/%s % (row[1], row[0], name) logs = '\n'.join(logfile_path(name, row) for row in resultSet for name in ('access.log', 'error.log')) -- http://mail.python.org/mailman/listinfo/python-list
Re: Avoid newline at the end
Steven D'Aprano wrote: On Sun, 11 Nov 2007 11:22:19 +0100, Florian Lindner wrote: Hello, I have a piece of code like that: for row in resultSet: logs += /home/%s/%s/log/access.log \n % (row[1], row[0]) logs += /home/%s/%s/log/error.log \n % (row[1], row[0]) # -- Now I want to avoid the newline at the last iteration and only at the second line. That means your log file doesn't end with a newline. That's often not good, because it can confuse some tools. Also, appending lots of strings together like that is very inefficient. How to do that most elegantly with Python? If you have a small number of rows (say, less than a few tens of thousands), you can do this: rows = [] for row in resultSet: rows.append(/home/%s/%s/log/access.log % (row[1], row[0])) rows.append(/home/%s/%s/log/error.log % (row[1], row[0])) # note that there are no newlines logs = '\n'.join(rows) # do it once at the end But again, when you write text to a file, you should end it with a newline. It isn't compulsory, but it is best practice. Alternatively, check out the logging module. That is not log file it's a config file for logrotate. And the log string goes into a template therefore the config file ends with a newline. The problem is that logrotate gets confused by empty lines between logfile path and config. The number of lines will always be 100 and so config will only be regenerated not often so efficiency is not issue. Regards, Florian -- http://mail.python.org/mailman/listinfo/python-list
Re: easy 3D graphics for rendering geometry?
Scott David Daniels wrote: gsal wrote: On Nov 10, 11:13 am, Scott David Daniels [EMAIL PROTECTED] wrote: Well, what kind of computer, what version of everything (OS, Python, VPython), what display card, Windows XP Professional Version 2002, Service Pack 2 1.4GHz, 512MB ATI MOBILITY RADEON 9000 Python 2.5, VPython 2.5 gsal Well, I'm running Python-2.5.1 and VPython 3.2.11 successfully on an NVIDIA GeForce 7100 GS on XP. I generally don't see the problems you are seeing. I know they are still struggling a bit with the Windows code (due in part to Arthur Siegel's untimely demise) and OpenGL on 2.5. Do simple things always break, or do you kind of know what you do that breaks it? BTW, there is a newsgroup/mailing list that you should know about that I read on gmane: gmane.comp.python.visualpython.user Are you including calls to sleep and/or rate in your loops? -Scott Also, you can try VPython's newest beta for the _new_ style: 2007-11-10 4.beta20 Available on http://sourceforge.net/projects/visualpython/ That has more, rather than less, performance issues for me, but you might find it works more nicely with your video setup. -Scott -- http://mail.python.org/mailman/listinfo/python-list
Re: Extended date and time
Adam Pletcher wrote: The time module in the standard library does epoch, and conversions. Get current local time in seconds since epoch (1970): import time now_secs = time.time() print now_secs 1194790069.33 Convert to a struct_time object for conversions: now_struct = time.localtime(now_secs) print now_struct (2007, 11, 11, 8, 7, 49, 6, 315, 0) Make it a readable string: now_string = time.strftime('%a %m/%d/%Y, %I:%M:%S %p', now_struct) print now_string 'Sun 11/11/2007, 08:07:49 AM' Convert string back into a struct_time object, then seconds again: now_struct2 = time.strptime(now_string, '%a %m/%d/%Y, %I:%M:%S %p') print now_struct2 (2007, 11, 11, 8, 7, 49, 6, 315, -1) now2 = time.mktime(now_struct2) print now2 1194790069.0 ... etc. If you're starting the other direction, change the format string passed to strptime to match the pattern of your existing strings. The standard docs for the time module has all the details. - Adam What about November 5, 1605 ? Colin W. *From:* [EMAIL PROTECTED] on behalf of Jeremy Sanders *Sent:* Sat 11/10/2007 9:37 AM *To:* python-list@python.org *Subject:* Extended date and time Hi - I need to add support to a program for dates and times. The built-in Python library seems to be okay for many purposes, but what I would like would be Unix epoch style times (seconds relative to some date), covering a large period from the past to the future. What would be nice would be a library which can take floating point seconds from an epoch. Does anyone know of a library which can convert from human style dates and times to a floating point epoch and back again? I expect I could fudge the fractional seconds with the built-in library, but I can't see how to get dates in the past. Thanks, Jeremy. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
Michael Bacarella wrote: This would seem to implicate the line id2name[id] = name as being excruciatingly slow. As others have pointed out there is no way that this takes 45 minutes.Must be something with your system or setup. A functionally equivalent code for me runs in about 49 seconds! (it ends up using about twice as much ram as the data on disk) You can download the list of keys from here, it's 43M gzipped: http://www.sendspace.com/file/9530i7 and see it take about 45 minutes with this: $ cat cache-keys.py #!/usr/bin/python v = {} for line in open('keys.txt'): v[long(line.strip())] = True Have you tried taking the long away? I mean : v[line.strip()] = True -- http://mail.python.org/mailman/listinfo/python-list
RE: python - an eggs...
Hi Diez Forgot to mention, that when I did an unzip of the egg file, and placed the files in the ../python2.4/site-packages/durus dir, it still crashed... it's as if the egg file is needed... thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Diez B. Roggisch Sent: Sunday, November 11, 2007 10:03 AM To: python-list@python.org Subject: Re: python - an eggs... bruce schrieb: Hi Diez... In my case, I do a python setup.py install and i get a Durus...egg installed in the /usr/lib/python2.4/site-packages/ dir... As I understand it, this egg/file contains compressed pythonic files. When I run the app which uses the durus stuff... the app crashes, and displays the durus python script with a path. However, when I simply cut/copy the path, and attempt to view that file, the path doesn't exist on the drive. I'm assuming that there is some sort of relative offset action going on, but that the file actually doesn't exist, except within the egg itself. You can unzipp eggs as well, creating a directory that ends in .egg - that works the same. I've also tried to simply modify the original source file, without rebuilding the egg, which obviously doesn't affect the egg file. Then after modification, reinstall. So, for now, the only way I can see to modify the src, is to go back to the src files, modify, and rebuild the durus app. I don't see any setuptools neither setuptools, nor man setuptools returns anything on my system. setuptools is a package that installs creates eggs. You find it documented here: http://peak.telecommunity.com/DevCenter/setuptools It comes with a few commandline-scripts after installation, such as easy_install when i run python setup.py develop and I then run my app, it crashes, complaining of a persisten object not being found So I don't think that's the immediate solution. I can't comment on that, but usually that shouldn't be the case just because of the development mode. Diez -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Trouble with subprocess.call(...) and zsh script (OSError: [Errno 8] Exec format error)
Michael George Lerner [EMAIL PROTECTED] writes: Hi, (Python 2.5, OS X 10.4.10) I have a program called pdb2pqr on my system. It is installed so that pdb2pqr is in my path and looks like: #\!/bin/zsh -f Are you sure that this shebang is correct? I've tested that on bash and have similar error: # t1.sh #\!/bin/sh echo t1 from subprocess import call call(['./t1.sh']) Traceback (most recent call last): File stdin, line 1, in ? File /usr/lib/python2.4/subprocess.py, line 413, in call return Popen(*args, **kwargs).wait() File /usr/lib/python2.4/subprocess.py, line 543, in __init__ errread, errwrite) File /usr/lib/python2.4/subprocess.py, line 975, in _execute_child raise child_exception OSError: [Errno 8] Exec format error But running that directly through the shell works: call(['./t1.sh'], shell=True) t1 0 However this script works fine also without `shell=True` option: # t2.sh #!/bin/sh echo t2 call(['./t2.sh']) t2 0 HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for a good Python environment
While we're at it, do any of these debuggers implement a good way to debug multi-threaded Python programs? Wing now has multi-threaded debugging. I'm a big Wing (pro) fan. To be fair, when I undertook my huge IDE evaluation undertaking it was approx 2 years ago... at the time as far as what I would consider to be a full featured professional IDE it was IMO really only Wing and Komodo who could compete. The others were left in the dust. Unfortunately both cost money, but it became clear that at least in this instance you get what you pay for. Not a big deal for me because as far as professional development costs the cost is ridiculously low and I use it professionally, but I could see balking at the cost if strictly a hobbiest... although I would pay as I'd be lost without my Wing I think. At the time, I much preferred Wing to Komodo, but haven't tried Komodo more than sparingly since then. My bet is that the situation would still be similar since Wing has done nothing but get better over time. The support crew at Wing are great, too... the mailing list is excellent and the Wing developers typically respond very quickly to any support requests, and even feature requests (I've had a few things added due to the mailing list). The biggest missing feature in Wing at the moment is integrating GUI development. If you are into that, you may want to look elsewhere. Any GUI stuff I do I use wxPython and after starting with a template builder I just manually code the GUIs... painful at times, especially when you just want to whip up something small, but I've gotten used to it. Now that I type this, though, I think I'll go looking for what's new! Maybe Boa is less buggy now? Hmm. Prior to taking on my find the ultimate IDE quest I was using SPE and it was free and quite decent, just not comparable to Wing. http://pythonide.stani.be/ A quick look at the current state of SPE shows that it now has multi- threaded debugging via WinPDB (what I used to use for debugging thread issues). Interesting. Worth a look to see if it is integrated well. -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for a good Python environment
Russell Warren [EMAIL PROTECTED] writes: Wing now has multi-threaded debugging. Cool, is it windows-only? I'm using Linux. A quick look at the current state of SPE shows that it now has multi- threaded debugging via WinPDB (what I used to use for debugging thread issues). Interesting. Worth a look to see if it is integrated well. Same issue: this also sounds windows-specific. Thanks though. -- http://mail.python.org/mailman/listinfo/python-list
Re: Extended date and time
On Nov 10, 10:37 am, Jeremy Sanders jeremy [EMAIL PROTECTED] wrote: Hi - I need to add support to a program for dates and times. The built-in Python library seems to be okay for many purposes, but what I would like would be Unix epoch style times (seconds relative to some date), covering a large period from the past to the future. What would be nice would be a library which can take floating point seconds from an epoch. Does anyone know of a library which can convert from human style dates and times to a floating point epoch and back again? I expect I could fudge the fractional seconds with the built-in library, but I can't see how to get dates in the past. Thanks, Jeremy. -- Jeremy Sandershttp://www.jeremysanders.net/ Have you looked at mx.DateTime: http://www.egenix.com/products/python/mxBase/mxDateTime/ In matplotlib, I also use their Dates modules functions for conversions (see the near bottom of the page): http://matplotlib.sourceforge.net/matplotlib.dates.html In the scipy sandbox, you can also build a package called 'TimeSeries': http://www.scipy.org/SciPyPackages/TimeSeries I also have trouble with date/times with whats available. Off the top of my head... converting a numpy array of epochs to some datetime object and back. If I had the time I'd contribute additional functionality to Pierre's and Matt's TimeSeries module (the one in scipy). -dieter -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
DouhetSukd [EMAIL PROTECTED] writes: Ah, well, just noticed Ben's suggested this already. Mind you, his code, while correct in intent, does look a bit fishy (missing those square brackets) By missing those square brackets, what would be a list comprehension (allocating an entire list in memory at once before proceeding) becomes a generator expression (generating results from the sequence only as needed). Enter 'python generator expression' into your favourite search engine to find out more. -- \ What I resent is that the range of your vision should be the | `\ limit of my action. -- Henry James | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Extended date and time
On Nov 11, 4:46 pm, D.Hering [EMAIL PROTECTED] wrote: On Nov 10, 10:37 am, Jeremy Sanders jeremy I also have trouble with date/times with whats available. Off the top of my head... converting a numpy array of epochs to some datetime object and back. If I had the time I'd contribute additional functionality to Pierre's and Matt's TimeSeries module (the one in scipy). -dieter I made a request for this to Pierre and Matt on the scipy-user list. -- http://mail.python.org/mailman/listinfo/python-list
get java class loader within pathon
Hi, I have a java application with a UI compoennt of FlyoutPaletteComposite (an GEF class), this UI compoennt displays a scrollbar when needed. I am writing a Jython/Python script, and within this script, I want to grab the scrollbar and move the bar up and down to a specified location. I was told to get the class loader of the compoent, but don't know how to do it. Can anybody kindly help? Holly -- http://mail.python.org/mailman/listinfo/python-list
Information manager/organizer with tags question.
Hello, I would like to write an information manager/organizer type of app but first I'd like to ask if there is something like that already existing. I asked on yahoo questions but did not get a response. I also searched freshmeat but even though they have plenty of projects that are tangentially related, I was unable to find anything close enough. What I'm thinking about is this: a database with an interface that stores records by tags and allows filtering and sorting by these tags. When I enter a new record, I enter a title and any number of tags. Interface would have a filter by: pull down menu separated in two sections, favorite tags and recent tags. To the right of that would be a button to add another filter, which would create a new pull down menu to filter current results further. Then there would be a search field where you'd type in a word and it would show a list of all matching tags; then you would click on one of the tags to add it to last filter menu's 'recent' list. Interface would be two-pane with an option to switch to single pane, where one pane is a list of matching records and the other is current record. List of matching records would be sortable by clicking on column titles. Going into the record would bring up a screen with title and body text of the record, if the record is a file it'd show title, list of tags and a button that opens that file. (unless it's a text file that can be viewed and edited there). The idea is to have a central hub of all information, that is very easy to search and locate not only the exact document you're looking for but also a specific subset of documents, including all of the ones you do need and excluding ones that you do not, which allows you to work with them as a set without the need to specifically select each and every one you need. For the first version it'd be enough to have plain text body field. Later I'd like to have a rich document format, probably html. Later I'd also like to add an option for matching synonymous words to tags. If you search for certainty, it would match assurance tag if the option is on. For instance, if I wanted to find this message, I'd search for Usenet posts, tag, my name (as author). I would know that I only made one Usenet post about tags. If I made unrelated posts about html tags, for instance, I'd filter by 'information manager', and then I'd find this post and more posts that I might make about this. If I wanted to include possible replies, I'd remove my name from filters. Then I could sort by date to see latest posts. The reason for this idea is that right now I keep my information, or at least most of it, in an outliner program called treepad. It's a tree-like view program where you make a hierarchical structure similar to file system, where each 'file' is a text entry field. This is reasonably useful but is limited to only one possible subset, i.e. you could put all posts under 'Usenet posts/info manager/a, b, c' but it's impossible to filter it further or to combine it with some subset of a different topic. Many chunks of information belong to multiple topics and you can't always remember if you filed under one or the other. Therefore I think this tag-based approach would be much more flexible. I have experience with doing a few simple apps in Tkinter and also a db driven site in TurboGears. I'm not sure what framework I should use for this. I generally would prefer gtk because of responsiveness and nice looks, but it may be a bit tough since I never did any gtk development at all. Should I prototype in Tkinter? Would Django be better suited for this or TurboGears? Of course there isn't any need to do anything if there is already an app that does this. Please tell me if it does, or if there is something very close that could have this set of features added easily. I was thinking about wikis, in fact. I might be best off starting with a wiki done in TurboGears and going from there. I'd get html markup pages right away, with links, nice formatting.. TG has many components that could be useful for this app. -- http://mail.python.org/mailman/listinfo/python-list
Re: python - an eggs...
bruce schrieb: Hi Diez Forgot to mention, that when I did an unzip of the egg file, and placed the files in the ../python2.4/site-packages/durus dir, it still crashed... it's as if the egg file is needed... I doubt that. And I get the feeling that you did not read anything belonging to setuptools I pointed you to. I just did this: 192:/tmp deets$ easy_install-2.5 -Z durus Searching for durus Reading http://www.python.org/pypi/durus/ Couldn't find index page for 'durus' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://www.python.org/pypi/ Reading http://www.python.org/pypi/Durus/3.7 Reading http://www.mems-exchange.org/software/durus/ Best match: Durus 3.7 Downloading http://www.mems-exchange.org/software/durus/Durus-3.7.tar.gz Processing Durus-3.7.tar.gz Running Durus-3.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-WEWC6s/Durus-3.7/egg-dist-tmp--GlmRY zip_safe flag not set; analyzing archive contents... Adding Durus 3.7 to easy-install.pth file Installing durus script to /Library/Frameworks/Python.framework/Versions/2.5/bin Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg Processing dependencies for durus 192:/tmp deets$ find Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg find: Installed: No such file or directory /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/__init__.py /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/__init__.pyc /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/_persistent.py /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/_persistent.pyc /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/_persistent.so /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/btree.py snip/ As you can see, ONE simple setuptools-command sufficed to install durus, as unzipped egg so that you can see every single source file. I don't know what durus is, how to use it and I don't care about it, so I can't comment on your actual problems with durus itself. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: get java class loader within pathon
blueblueblue2005 schrieb: Hi, I have a java application with a UI compoennt of FlyoutPaletteComposite (an GEF class), this UI compoennt displays a scrollbar when needed. I am writing a Jython/Python script, and within this script, I want to grab the scrollbar and move the bar up and down to a specified location. I was told to get the class loader of the compoent, but don't know how to do it. Can anybody kindly help? FlyoutPaletteComposite.getClass().getClassLoader() Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: get java class loader within pathon
Diez B. Roggisch schrieb: blueblueblue2005 schrieb: Hi, I have a java application with a UI compoennt of FlyoutPaletteComposite (an GEF class), this UI compoennt displays a scrollbar when needed. I am writing a Jython/Python script, and within this script, I want to grab the scrollbar and move the bar up and down to a specified location. I was told to get the class loader of the compoent, but don't know how to do it. Can anybody kindly help? FlyoutPaletteComposite.getClass().getClassLoader() Oops. That should be FlyoutPaletteComposite.getClassLoader() of course. The above should work for an instance of FlyoutPaletteComposite. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: security code whit python
[EMAIL PROTECTED] wrote: have you got any example?pls :S I suggest you learn to use internet search. And if you already know it, please use it before asking that. 10 seconds of search (!) and I had: URL:http://www.google.de/search?hl=deq=pil%20python%20examplesbtnG=Google-Suchemeta= and from that: URL:http://www.pythonware.com/library/pil/handbook/introduction.htmhttp://www.pythonware.com/library/pil/handbook/introduction.htm /W -- http://mail.python.org/mailman/listinfo/python-list
Re: Extended date and time
On Nov 11, 2:37 am, Jeremy Sanders jeremy [EMAIL PROTECTED] wrote: Hi - I need to add support to a program for dates and times. The built-in Python library seems to be okay for many purposes, but what I would like would be Unix epoch style times (seconds relative to some date), covering a large period from the past to the future. What would be nice would be a library which can take floating point seconds from an epoch. Does anyone know of a library which can convert from human style dates and times to a floating point epoch and back again? I expect I could fudge the fractional seconds with the built-in library, but I can't see how to get dates in the past. What does dates in the past mean?? Please be more specific about the earliest date that you want to be able to handle. Python's datetime starts at 0001-01-01. Somebody mentioned the time module, which is implementation-dependent but typically starts at 1970-01-01 . What functionality do you need, other than two-way conversion between days_since_epoch and (proleptic Gregorian) date/time? -- http://mail.python.org/mailman/listinfo/python-list
Re: security code whit python
[EMAIL PROTECTED] wrote: I have setuped pyx i wonder i have mistake? You need a running TeX/LaTeX system for pyx. Sorry, forgot about that. Also, I suggest you follow Scotts advice in reading URL:http://www.catb.org/~esr/faqs/smart-questions.html. If you're really looking for a way to generate captchas though, PIL is what you want. /W -- http://mail.python.org/mailman/listinfo/python-list
RE: python - an eggs...
Hi Diez... I've never used setuptools, (it's not on the box) and i don't have easy_install tools installed... But in looking at your output, I have some questions... -The 1st, I'm assuming that easy_install works with python2.4.3? -The 2nd, In the output, is see the durus egg... with the durus path being relative to the egg... are the actual durus files in that dir?? -3rd question.. in searching the 'net, it appears that i have to download setuptools in order to get easy_install. Am I missing something here, or is this correct? Thanks for your pointers on this!! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Diez B. Roggisch Sent: Sunday, November 11, 2007 2:58 PM To: python-list@python.org Subject: Re: python - an eggs... bruce schrieb: Hi Diez Forgot to mention, that when I did an unzip of the egg file, and placed the files in the ../python2.4/site-packages/durus dir, it still crashed... it's as if the egg file is needed... I doubt that. And I get the feeling that you did not read anything belonging to setuptools I pointed you to. I just did this: 192:/tmp deets$ easy_install-2.5 -Z durus Searching for durus Reading http://www.python.org/pypi/durus/ Couldn't find index page for 'durus' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://www.python.org/pypi/ Reading http://www.python.org/pypi/Durus/3.7 Reading http://www.mems-exchange.org/software/durus/ Best match: Durus 3.7 Downloading http://www.mems-exchange.org/software/durus/Durus-3.7.tar.gz Processing Durus-3.7.tar.gz Running Durus-3.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-WEWC6s/Durus-3.7/egg-dist-tmp--GlmRY zip_safe flag not set; analyzing archive contents... Adding Durus 3.7 to easy-install.pth file Installing durus script to /Library/Frameworks/Python.framework/Versions/2.5/bin Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg Processing dependencies for durus 192:/tmp deets$ find Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg find: Installed: No such file or directory /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/__init__.py /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/__init__.pyc /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/_persistent.py /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/_persistent.pyc /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/_persistent.so /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/Durus-3.7-py2.5-macosx-10.3-fat.egg/durus/btree.py snip/ As you can see, ONE simple setuptools-command sufficed to install durus, as unzipped egg so that you can see every single source file. I don't know what durus is, how to use it and I don't care about it, so I can't comment on your actual problems with durus itself. Diez -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Questions about remembering and caching function arguments
Hi all, I have two questions about a class, which we'll call MyWrapperClass, in a package to which I'm contributing. 1) MyWrapperClass wraps functions. Each instance has an attribute called 'value' and a method called 'eval', which calls the wrapped function. An instance D that depends on instances A, B and C can be created as follows: @mywrapperclass def D(A, B, C): return foo(A.value, B.value, C.value) Now that D exists, the call D.eval() will work without any arguments (D remembers that the arguments are A, B and C and passes their values to foo). What is the standard terminology for such classes, and does anyone know of a package that implements them in a nice way? (It's easy enough to roll our own, but reading about other implementations might give us good ideas). 2) D.eval() will frequently be called multiple times in succession before A.value, B.value or C.value has had the chance to change. It would be _extremely_ helpful to have D detect this situation and skip recomputation. I'm looking for the fastest safe way to do this. There's no restriction on what kind of object A.value, etc. are, so unfortunately they might be mutable. Our current solution is to have D compare A.value, B.value and C.value to an internal cache using the 'is' operator (and put a big warning in the docs about not changing 'value' attributes in-place). Not exactly safe, but the speed savings over comparison with '==' will be significant. Is this OK, bad or an abomination? Again it would be helpful to know the terminology associated with the behavior I'm looking for and any packages that implement it nicely. Many thanks in advance and apologies for the long post, Anand -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyzzle development?
Dennis Lee Bieber wrote: On Sun, 11 Nov 2007 00:30:28 -0500, John Salerno [EMAIL PROTECTED] declaimed the following in comp.lang.python: Does anyone happen to know what's going on with the development of the Pyzzle engine (for creating Myst-like games with Python)? Seems stalled for a long time, but I'm not sure if it's just been abandoned. How would you pronounce that? G Maybe the developers were shown the dictionary entry for (to me) sound-alike pizzle... Heh, you never know. http://pyzzle.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: security code whit python
Ahh, crap! Wildemar Wildenburger wrote: [EMAIL PROTECTED] wrote: have you got any example?pls :S I suggest you learn to use internet search. And if you already know it, please use it before asking that. 10 seconds of search (!) and I had: Make that 2 seconds: URL:http://www.google.de/search?hl=deq=pil%20python%20examplesbtnG=Google-Suchemeta= and from that: URL:http://www.pythonware.com/library/pil/handbook/introduction.htmhttp://www.pythonware.com/library/pil/handbook/introduction.htm And make that, of course: URL:http://www.pythonware.com/library/pil/handbook/introduction.htm /W -- http://mail.python.org/mailman/listinfo/python-list
The Python Papers Monograph Series (TPPM): Call for Proposals
The editorial committee of The Python Papers (ISSN 1834-3147) calls for proposals for The Python Papers Monograph Series. Potential authors should contact the editors at [EMAIL PROTECTED] at an early stage of preparation. We await your indications of interests. Regards Maurice Ling Associate Editor, The Python Papers What is The Python Papers Monograph Series? === The Python Papers Monograph Series (ISSN under application) is a sub-publication of The Python Papers (ISSN 1834-3147). This monograph series provides a refereed format for publication of monograph-length reports including dissertations, conference proceedings, case studies, advanced-level lectures, and similar material of theoretical or empirical importance. It does so quickly, informally and at a high level, where the Python programming language is an integral aspect. In some cases, the timeliness of a manuscript is more important than its form, which may be unfinished or unpolished. Hence, it is possible that proofs may be outlined with an intention to publish elsewhere at a later date. Refereeing is done by members of the The Python Papers' editorial board and other authorities in the topic concerned and may be acknowledged in name in the published form. Scientific quality is the over-riding criterion for refereeing. Suggestions for publication, in the form of outlines and representative samples, are invited by the editorial board for assessment. Potential authors should contact the editors at [EMAIL PROTECTED] Publication in this monograph series is intended as a service to the Python users and scientific community at large. Work in this series is licensed under the Creative Commons 2.5 license subject to Attribution, Non-Commercial and Share-Alike conditions. The full legal code may be found at http://creativecommons.org/licenses/byncsa/2.1/au/. Once published and copyrighted, they can be documented and discussed in the scientific literature. = -- http://mail.python.org/mailman/listinfo/python-list
The Python Papers Monograph Series (TPPM): Call for Proposals
The editorial committee of The Python Papers (ISSN 1834-3147) calls for proposals for The Python Papers Monograph Series. Potential authors should contact the editors at [EMAIL PROTECTED] at an early stage of preparation. We await your indications of interests. Regards Maurice Ling Associate Editor, The Python Papers What is The Python Papers Monograph Series? === The Python Papers Monograph Series (ISSN under application) is a sub-publication of The Python Papers (ISSN 1834-3147). This monograph series provides a refereed format for publication of monograph-length reports including dissertations, conference proceedings, case studies, advanced-level lectures, and similar material of theoretical or empirical importance. It does so quickly, informally and at a high level, where the Python programming language is an integral aspect. In some cases, the timeliness of a manuscript is more important than its form, which may be unfinished or unpolished. Hence, it is possible that proofs may be outlined with an intention to publish elsewhere at a later date. Refereeing is done by members of the The Python Papers' editorial board and other authorities in the topic concerned and may be acknowledged in name in the published form. Scientific quality is the over-riding criterion for refereeing. Suggestions for publication, in the form of outlines and representative samples, are invited by the editorial board for assessment. Potential authors should contact the editors at [EMAIL PROTECTED] Publication in this monograph series is intended as a service to the Python users and scientific community at large. Work in this series is licensed under the Creative Commons 2.5 license subject to Attribution, Non-Commercial and Share-Alike conditions. The full legal code may be found at http://creativecommons.org/licenses/byncsa/2.1/au/. Once published and copyrighted, they can be documented and discussed in the scientific literature. = -- http://mail.python.org/mailman/listinfo/python-list
Re: Populating a dictionary, fast
On Nov 11, 11:51 am, Michael Bacarella [EMAIL PROTECTED] wrote: and see it take about 45 minutes with this: $ cat cache-keys.py #!/usr/bin/python v = {} for line in open('keys.txt'): v[long(line.strip())] = True On my system (windows vista) your code (using your data) runs in: 36 seconds with python 2.4 25 seconds with python 2.5 39 seconds with python 3000 i. -- http://mail.python.org/mailman/listinfo/python-list
how to know if folder contents have changed
hi i am trying to create a cache of digitized values of around 100 image files in a folder..In my program i would like to know from time to time if a new image has been added or removed from the folder.. one scheme suggested was to create a string from the names of sorted image files and give it as the cache name.. ie ,if i have one.jpg,three.jpg,new.jpg , i will name the cache as 'newonethree.cache' and everytime i want to check if new image added/removed i wd create a string from the contents of folder and compare it with cachename. this scheme is ok for a small number of files,.. can someone suggest a better way? i know it is a general programming problem..but i wish to know if a python solution exists -- http://mail.python.org/mailman/listinfo/python-list
Re: how to know if folder contents have changed
On Sun, 11 Nov 2007 21:03:33 -0800, [EMAIL PROTECTED] wrote: one scheme suggested was to create a string from the names of sorted image files and give it as the cache name.. ie ,if i have one.jpg,three.jpg,new.jpg , i will name the cache as 'newonethree.cache' and everytime i want to check if new image added/removed i wd create a string from the contents of folder and compare it with cachename. this scheme is ok for a small number of files,.. Not really. `xxx.jpg` - `xxx.cache` Now `xxx.jpg` is deleted and `x.jpg` and `xx.jpg` are created. `x.jpg`, `xx.jpg` - `xxx.cache` can someone suggest a better way? i know it is a general programming problem..but i wish to know if a python solution exists Don't store the names in the cache file name but in the cache file. Take a look at the `set()` type for operations to easily find out the differences between two set of names and the `pickle` module to store Python objects in files. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: Questions about remembering and caching function arguments
On Nov 12, 1:05 am, Anand Patil [EMAIL PROTECTED] wrote: Hi all, I have two questions about a class, which we'll call MyWrapperClass, in a package to which I'm contributing. 1) MyWrapperClass wraps functions. Each instance has an attribute called 'value' and a method called 'eval', which calls the wrapped function. An instance D that depends on instances A, B and C can be created as follows: @mywrapperclass def D(A, B, C): return foo(A.value, B.value, C.value) Now that D exists, the call D.eval() will work without any arguments (D remembers that the arguments are A, B and C and passes their values to foo). What is the standard terminology for such classes, and does anyone know of a package that implements them in a nice way? (It's easy enough to roll our own, but reading about other implementations might give us good ideas). 2) D.eval() will frequently be called multiple times in succession before A.value, B.value or C.value has had the chance to change. It would be _extremely_ helpful to have D detect this situation and skip recomputation. I'm looking for the fastest safe way to do this. There's no restriction on what kind of object A.value, etc. are, so unfortunately they might be mutable. Our current solution is to have D compare A.value, B.value and C.value to an internal cache using the 'is' operator (and put a big warning in the docs about not changing 'value' attributes in-place). Not exactly safe, but the speed savings over comparison with '==' will be significant. Is this OK, bad or an abomination? Again it would be helpful to know the terminology associated with the behavior I'm looking for and any packages that implement it nicely. Many thanks in advance and apologies for the long post, Anand Cells (A dataflow extension to CLOS) seems like what you want: http://common-lisp.net/project/cells/ I think there was talk of a Python version a while back... -- bjorn -- http://mail.python.org/mailman/listinfo/python-list
[issue1420] Unicode literals in tokenize.py and tests.
New submission from Ron Adam: Replaced Unicode literals in tokenize.py and it's tests files with byte literals. Added a compile step to the test to make sure the text file used in the test are valid python code. This will catch changes that need to be done in to the text (gold file) for future python versions. -- components: Library (Lib) files: tokenize_patch.diff messages: 57366 nosy: ron_adam severity: normal status: open title: Unicode literals in tokenize.py and tests. versions: Python 3.0 Added file: http://bugs.python.org/file8732/tokenize_patch.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1420 __Index: Lib/tokenize.py === --- Lib/tokenize.py (revision 58930) +++ Lib/tokenize.py (working copy) @@ -69,10 +69,10 @@ Single3 = r[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*''' # Tail end of string. Double3 = r'[^\\]*(?:(?:\\.|(?!))[^\\]*)*' -Triple = group([uU]?[rR]?''', '[uU]?[rR]?') +Triple = group([bB]?[rR]?''', '[bB]?[rR]?') # Single-line ' or string. -String = group(r[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*', - r'[uU]?[rR]?[^\n\\]*(?:\\.[^\n\\]*)*') +String = group(r[bB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*', + r'[bB]?[rR]?[^\n\\]*(?:\\.[^\n\\]*)*') # Because of leftmost-then-longest match semantics, be sure to put the # longest operators first (e.g., if = came before ==, == would get @@ -90,9 +90,9 @@ Token = Ignore + PlainToken # First (or only) line of ' or string. -ContStr = group(r[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)* + +ContStr = group(r[bB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)* + group(', r'\\\r?\n'), -r'[uU]?[rR]?[^\n\\]*(?:\\.[^\n\\]*)*' + +r'[bB]?[rR]?[^\n\\]*(?:\\.[^\n\\]*)*' + group('', r'\\\r?\n')) PseudoExtras = group(r'\\\r?\n', Comment, Triple) PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name) @@ -102,28 +102,28 @@ endprogs = {': re.compile(Single), '': re.compile(Double), ''': single3prog, '': double3prog, r''': single3prog, 'r': double3prog, -u''': single3prog, 'u': double3prog, -ur''': single3prog, 'ur': double3prog, +b''': single3prog, 'b': double3prog, +br''': single3prog, 'br': double3prog, R''': single3prog, 'R': double3prog, -U''': single3prog, 'U': double3prog, -uR''': single3prog, 'uR': double3prog, -Ur''': single3prog, 'Ur': double3prog, -UR''': single3prog, 'UR': double3prog, -'r': None, 'R': None, 'u': None, 'U': None} +B''': single3prog, 'B': double3prog, +bR''': single3prog, 'bR': double3prog, +Br''': single3prog, 'Br': double3prog, +BR''': single3prog, 'BR': double3prog, +'r': None, 'R': None, 'b': None, 'B': None} triple_quoted = {} for t in (''', '', r''', 'r', R''', 'R', - u''', 'u', U''', 'U', - ur''', 'ur', Ur''', 'Ur', - uR''', 'uR', UR''', 'UR'): + b''', 'b', B''', 'B', + br''', 'br', Br''', 'Br', + bR''', 'bR', BR''', 'BR'): triple_quoted[t] = t single_quoted = {} for t in (', '', r', 'r', R', 'R', - u', 'u', U', 'U', - ur', 'ur', Ur', 'Ur', - uR', 'uR', UR', 'UR' ): + b', 'b', B', 'B', + br', 'br', Br', 'Br', + bR', 'bR', BR', 'BR' ): single_quoted[t] = t tabsize = 8 Index: Lib/test/test_tokenize.py === --- Lib/test/test_tokenize.py (revision 58930) +++ Lib/test/test_tokenize.py (working copy) @@ -183,17 +183,26 @@ next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL +# Validate the tokenize_tests.txt file. +# This makes sure it's compiles and displays any errors in it. +f = open(findfile('tokenize_tests.txt')) +sf = f.read() +f.close() +cf = compile(sf, 'tokenize_tests.txt', 'exec') + # This displays the tokenization of tokenize_tests.py to stdout, and # regrtest.py checks that this equals the expected output (in the # test/output/ directory). f = open(findfile('tokenize_tests.txt')) tokenize(f.readline) f.close() - -# Now run test_roundtrip() over tokenize_test.py too, and over all + +# Now run test_roundtrip() over test_tokenize.py too, and over all # (if the compiler resource is enabled) or a small random sample (if # compiler is not enabled) of the test*.py files. -f = findfile('tokenize_tests.txt') +f = findfile('test_tokenize.py') +if verbose: +print('round trip: ', f, file=sys.__stdout__) test_roundtrip(f) testdir = os.path.dirname(f) or os.curdir Index: Lib/test/tokenize_tests.txt
[issue1421] python.org: outdated and false information
New submission from Christian Heimes: Short of a bug tracker for errors on python.org I'm using this bug tracker to support some problems. http://www.python.org/dev/process/ Documenting Python still mentions LaTeX as the system for documentation of Python. http://www.python.org/dev/implementations/ Python for .NET is either describing a totally different project or the author of the chapter didn't understand the design goals of Python for .NET written by Brian Lloyd. It's a bridge between CPython and .NET/Mono that allows developers to use CPython code and C extensions in .NET or .NET assemblies in CPython. Compiling Python code to CLR / IL byte code is not the intention of the project. The project homepage is wrong (http://pythonnet.sourceforge.net/) and the project is still maintained. I myself has fixed several bugs this summer and ported it to Python 2.5, Python 2.6, UCS-4 builds of Python and Mono. -- components: Documentation messages: 57367 nosy: tiran priority: high severity: normal status: open title: python.org: outdated and false information __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1421 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Christian Heimes added the comment: By the way I've found the daily builds you were asking for, Raghuram. http://www.python.org/dev/daily-msi/ :) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1395 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1419] ssl module version 1.10 causes TypeError when accepting connection
Changes by Georg Brandl: -- assignee: - janssen nosy: +janssen __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1419 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1422] Writing to an invalid fd doesn't raise an exception
New submission from Christian Heimes: The bug is related to http://bugs.python.org/issue1415 and occurs only with the latest patch from #1415. Writing to an invalid fd doesn't raise an exception: f = open(100, 'w') f.fileno() 100 f.write(test) 4 However reading or opening an invalid fd for reading and writing raises an exception. f = open(100, 'r') f.read() Traceback (most recent call last): File stdin, line 1, in module File /home/heimes/dev/python/py3k/Lib/io.py, line 1253, in read res += decoder.decode(self.buffer.read(), True) File /home/heimes/dev/python/py3k/Lib/io.py, line 756, in read current = self.raw.read(to_read) IOError: [Errno 9] Bad file descriptor f = open(100, 'w+') Traceback (most recent call last): File stdin, line 1, in module File /home/heimes/dev/python/py3k/Lib/io.py, line 195, in __new__ return open(*args, **kwargs) File /home/heimes/dev/python/py3k/Lib/io.py, line 169, in open buffer = BufferedRandom(raw, buffering) File /home/heimes/dev/python/py3k/Lib/io.py, line 948, in __init__ raw._checkSeekable() File /home/heimes/dev/python/py3k/Lib/io.py, line 301, in _checkSeekable if msg is None else msg) IOError: File or stream is not seekable. I expected that fileio_write() raises an exception when fd is invalid: n = write(self-fd, ptr, n); if (n 0) { if (errno == EAGAIN) Py_RETURN_NONE; PyErr_SetFromErrno(PyExc_IOError); return NULL; } -- assignee: tiran components: Interpreter Core keywords: py3k messages: 57372 nosy: tiran priority: normal severity: normal status: open title: Writing to an invalid fd doesn't raise an exception type: behavior versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1422 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails because std streams a missing
Guido van Rossum added the comment: Hmm... In internal_close() there's still a test for self-fd = 0. I'm not sure if this is an oversight or intentional. Also, I don't understand under what circumstances fds 0 can occur. I presume this is only on Windows. Can you point me to docs for this fact? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails because std streams a missing
Christian Heimes added the comment: Guido van Rossum wrote: Hmm... In internal_close() there's still a test for self-fd = 0. I'm not sure if this is an oversight or intentional. I'll check it later. The patch still contains some debugging code that redirects stdout and stderr to a file when PY_STDERR_FILE is defined. Also, I don't understand under what circumstances fds 0 can occur. I presume this is only on Windows. Can you point me to docs for this fact? It happens when a script is run with pythonw.exe (pyw extension). PythonW.exe isn't a console application but a GUI app which doesn't create a console window. However GUI apps don't have valid standard streams because stdin, stdout and stderr aren't connected. Here are some links that shed some light on the problem: http://mail.python.org/pipermail/python-dev/2001-January/011423.html http://www.halcyon.com/~ast/dload/guicon.htm http://msdn2.microsoft.com/en-us/library/3x292kth(VS.80).aspx The patch creates another problem: http://bugs.python.org/issue1422 Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1417] Weakref not working properly
MHOOO added the comment: Well, too bad. My workaround (to make weakrefs work) is attached as a file. Added file: http://bugs.python.org/file8733/myhacks.py __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1417 __ Some hacks. Written by Thomas Karolski ([EMAIL PROTECTED]). Last edit: 11.11.07 def getframe(level=0): try: raise Exception() # make an error happen except: # and return the caller's frame import sys frame = sys.exc_traceback.tb_frame.f_back i = level while i 0: if not hasattr(frame,'f_back') or frame.f_back == None: raise Exception(Can't get back +str(level)+ levels) frame = frame.f_back i += 1 return frame import types import weakref from functools import wraps class WeaklyReferencableMethod: def __init__(self, method): self._im_self = weakref.ref(method.im_self) self._im_class = method.im_class self._im_func = method.im_func #update_wrapper(self._im_func, method) im_self = property(fget=lambda s: s._im_self()) im_class = property(fget=lambda s: s._im_class) im_func = property(fget=lambda s: s._im_func) def __call__(self, *args, **dargs): return self.im_func(self.im_self, *args, **dargs) import types def weakrefhack( what ): weakrefhack( method ) Checks whether method exists as an attribute inside method.im_self. If it does, a wrapper function is created which calls a WeaklyReferencableMethod class. The class only stores a weak reference to the original methods object instance (im_self). Thus we get 'real' weakly referencable methods. class A: def method( self ): pass a = A() referencable = weakrefhack(a.method) # referencable is a.method now ref = weakref.ref(a.method) what_type = type(what) if what_type==types.MethodType: for attrname in dir(what.im_self): if getattr(what.im_self, attrname)==what: wrm = WeaklyReferencableMethod(what) @wraps(what) def wrapper(*args, **dargs): wrm(*args, **dargs) wrapper.im_self = wrm.im_self wrapper.im_func = wrm.im_func wrapper.im_class = wrm.im_class setattr(what.im_self, attrname, wrapper) return wrapper #import weakref #class a: # def m(): # pass # #mya = a() #weakrefhack(mya.m) #ref = weakref.ref(mya.m) #print ref #ref = weakref.ref(mya.m) #print ref___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1422] Writing to an invalid fd doesn't raise an exception
Christian Heimes added the comment: Python 2.5 and probably 2.6 suffer from the same problem although it's harder to trigger it. Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type help, copyright, credits or license for more information. import os f = open(/tmp/test, 'w') f.fileno() 3 os.close(f.fileno()) f.write(test) f.write(test) close failed: [Errno 9] Bad file descriptor $ ls -la /tmp/test -rw-r- 1 heimes heimes 0 2007-11-11 20:46 /tmp/test -- versions: +Python 2.5, Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1422 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1423] wave sunau aifc 16bit errors
New submission from jeroen: When you write sound files wav sunau of aifc and you are using 16 bits samples. The number of frames in the files is incorrect. close function which updates the headers makes a mistake I assume. For the sunau type I had to double the number of frames in the close function to make it correct. If you do not correctg number of frames a 10 second file will play 5 seconds -- components: Library (Lib) messages: 57377 nosy: jeroen severity: normal status: open title: wave sunau aifc 16bit errors versions: Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1423 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1424] py3k: readline and rlcompleter doesn't list choices
New submission from Christian Heimes: Python 2.5: import readline; import rlcompleter; readline.parse_and_bind(tab: complete) import sys sys.stdtabtab sys.stderr sys.stdin sys.stdout Python 3.0: import readline; import rlcompleter; readline.parse_and_bind(tab: complete) import sys import sys.stdtabtab # nothing -- components: Extension Modules, Library (Lib) keywords: py3k messages: 57378 nosy: tiran priority: low severity: normal status: open title: py3k: readline and rlcompleter doesn't list choices versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1424 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1419] ssl module version 1.10 causes TypeError when accepting connection
Bill Janssen added the comment: Good catch. I found this in the 3K branch, but hadn't backported it to the SSL PyPI module yet. -- resolution: - accepted __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1419 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1419] ssl module version 1.10 causes TypeError when accepting connection
Bill Janssen added the comment: I've uploaded a fixed ssl-1.12 to PyPI. -- resolution: accepted - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1419 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1425] readline: no display matches hook set
New submission from Christian Heimes: In Python 2.6 and 3.0 the readline module has changed. A new hook to set a display matches was introduced but no default method is set thus rendering rlcompleter partly useless. -- components: Extension Modules, Library (Lib) keywords: py3k messages: 57381 nosy: tiran severity: normal status: open title: readline: no display matches hook set versions: Python 2.6, Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1425 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1425] readline: no display matches hook set
Christian Heimes added the comment: http://bugs.python.org/issue1388440 http://bugs.python.org/issue1424 -- assignee: - loewis nosy: +loewis priority: - normal superseder: - py3k: readline and rlcompleter doesn't list choices __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1425 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1426] readline module needs a review
New submission from Christian Heimes: The readline module needs a review and cleanup. Several functions don't do enough error checks and the indention is partly borked with mixes of tab and 2 space indention. -- keywords: py3k messages: 57383 nosy: tiran priority: high severity: normal status: open title: readline module needs a review versions: Python 2.6, Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1426 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1427] Error in standard module calendar
New submission from Damjan Georgievski: This is LocaleTextCalendar.__init__ def __init__(self, firstweekday=0, locale=None): TextCalendar.__init__(self, firstweekday) if locale is None: locale = locale.getdefaultlocale() self.locale = locale Which can not work, obviosly ... let me hilight the important part if locale is None: locale = locale.getdefaultlocale() ??? Attached is a patch that corrects this and keeps the signature of the method with the locale=None keyword. -- components: Extension Modules files: calendar.diff messages: 57384 nosy: gdamjan severity: normal status: open title: Error in standard module calendar type: behavior versions: Python 2.5 Added file: http://bugs.python.org/file8734/calendar.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1427 __ calendar.diff Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1428] Update to property.__doc__
New submission from Christian Heimes: The patch adds the new syntax to the doc string of property: Decorators makes defining new or modifying existing properties easy: class C(object): @property def x(self): return self.__x @x.setter def x(self, value): self.__x = value @x.deleter def x(self): del self.__x -- assignee: gvanrossum components: Interpreter Core files: property_docstring.patch keywords: patch messages: 57385 nosy: gvanrossum, tiran priority: low severity: normal status: open title: Update to property.__doc__ type: rfe versions: Python 2.6, Python 3.0 Added file: http://bugs.python.org/file8735/property_docstring.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1428 __Index: Objects/descrobject.c === --- Objects/descrobject.c (Revision 58931) +++ Objects/descrobject.c (Arbeitskopie) @@ -1271,7 +1271,17 @@ def getx(self): return self.__x\n def setx(self, value): self.__x = value\n def delx(self): del self.__x\n -x = property(getx, setx, delx, \I'm the 'x' property.\)); +x = property(getx, setx, delx, \I'm the 'x' property.\)\n +\n +Decorators makes defining new or modifying existing properties easy:\n +class C(object):\n +@property\n +def x(self): return self.__x\n +@x.setter\n +def x(self, value): self.__x = value\n +@x.deleter\n +def x(self): del self.__x\n +); static int property_traverse(PyObject *self, visitproc visit, void *arg) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1427] Error in standard module calendar
Christian Heimes added the comment: My patch uses import locale as _locale to avoid ambiguous variables. It also fixes some additional bugs. I still don't understand how prweek() should work. self.week is missing. -- keywords: +patch nosy: +tiran priority: - normal versions: +Python 2.6, Python 3.0 Added file: http://bugs.python.org/file8736/calendar.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1427 __--- /usr/lib/python2.5/calendar.py~ 2007-11-04 02:44:03.0 +0100 +++ /usr/lib/python2.5/calendar.py 2007-11-04 02:49:10.0 +0100 @@ -502,9 +502,11 @@ def __init__(self, firstweekday=0, locale=None): TextCalendar.__init__(self, firstweekday) -if locale is None: -locale = locale.getdefaultlocale() -self.locale = locale +lok = locale +if lok is None: +import locale +lok = locale.getdefaultlocale() +self.locale = lok def formatweekday(self, day, width): with TimeEncoding(self.locale) as encoding: ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1427] Error in standard module calendar
Changes by Christian Heimes: Removed file: http://bugs.python.org/file8736/calendar.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1427 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1427] Error in standard module calendar
Christian Heimes added the comment: wrong file Added file: http://bugs.python.org/file8737/calendar_fix.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1427 __Index: Lib/calendar.py === --- Lib/calendar.py (Revision 58931) +++ Lib/calendar.py (Arbeitskopie) @@ -6,7 +6,9 @@ set the first day of the week (0=Monday, 6=Sunday). from __future__ import with_statement -import sys, datetime, locale +import sys +import datetime +import locale as _locale __all__ = [IllegalMonthError, IllegalWeekdayError, setfirstweekday, firstweekday, isleap, leapdays, weekday, monthrange, @@ -485,11 +487,11 @@ self.locale = locale def __enter__(self): -self.oldlocale = locale.setlocale(locale.LC_TIME, self.locale) -return locale.getlocale(locale.LC_TIME)[1] +self.oldlocale = _locale.setlocale(_locale.LC_TIME, self.locale) +return _locale.getlocale(_locale.LC_TIME)[1] def __exit__(self, *args): -locale.setlocale(locale.LC_TIME, self.oldlocale) +_locale.setlocale(_locale.LC_TIME, self.oldlocale) class LocaleTextCalendar(TextCalendar): @@ -503,7 +505,7 @@ def __init__(self, firstweekday=0, locale=None): TextCalendar.__init__(self, firstweekday) if locale is None: -locale = locale.getdefaultlocale() +locale = _locale.getdefaultlocale() self.locale = locale def formatweekday(self, day, width): @@ -537,7 +539,7 @@ def __init__(self, firstweekday=0, locale=None): HTMLCalendar.__init__(self, firstweekday) if locale is None: -locale = locale.getdefaultlocale() +locale = _locale.getdefaultlocale() self.locale = locale def formatweekday(self, day): @@ -658,9 +660,11 @@ parser.error(if --locale is specified --encoding is required) sys.exit(1) +locale = options.locale, options.encoding + if options.type == html: if options.locale: -cal = LocaleHTMLCalendar(locale=options.locale) +cal = LocaleHTMLCalendar(locale=locale) else: cal = HTMLCalendar() encoding = options.encoding @@ -676,7 +680,7 @@ sys.exit(1) else: if options.locale: -cal = LocaleTextCalendar(locale=options.locale) +cal = LocaleTextCalendar(locale=locale) else: cal = TextCalendar() optdict = dict(w=options.width, l=options.lines) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1428] Update to property.__doc__
Guido van Rossum added the comment: I would use _x instead of __x. Otherwise looks good. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1428 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1428] Update to property.__doc__
Christian Heimes added the comment: Applied in r58935 (trunk) -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1428 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1427] Error in standard module calendar
Christian Heimes added the comment: I've applied my patch in r58936 (trunk) and r58937 (2.5 branch). I'm assigning the bug to Walter. Maybe he is able to shed some light on the prweek() issue. $ svn ann Lib/calendar.py | grep self\.week 43483 walter.doerwald print self.week(theweek, width), -- assignee: - doerwalter nosy: +doerwalter __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1427 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1425] readline: no display matches hook set
Martin v. Löwis added the comment: Thanks for the report. This is now fixed in r58940. -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1425 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1420] Unicode literals in tokenize.py and tests.
Martin v. Löwis added the comment: I think this patch is wrong. Python source code is inherently text, so generate_tokens should decode the input, rather than operating on bytes. -- nosy: +loewis __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1420 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1418] Python/hypot.c is never used
Martin v. Löwis added the comment: Thanks for the patch. Committed as r58941. -- resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1418 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com