Re: Strange __future__ behavior in Python 2.5
Georg Brandl wrote: > This is a bug and has now been fixed in the SVN repo. > Thanks for bringing it up. Ouch, I feel bad now. I've been noticing this behavior since 2.5B1 but I didn't realize it was a bug. -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange __future__ behavior in Python 2.5
[EMAIL PROTECTED] wrote: > My understanding of the __future__ statement is that you may say > something like: > > from __future__ import foo, bar > > to enable more than one feature. However, this does not seem to be > working properly in 2.5; it behaves as expected when typed into the > interactive interpreter, but not when it is in a module. When I try to > import the following module: *snip* > Is this a bug, or am I misunderstanding something? I'm using the final > release of Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) on Mac OS X. Only one "from __future__" can be imported per line. So, from __future__ import foo from __future__ import bar etc. It will only import the first if you give multiple. Why this is, I don't know. -- http://mail.python.org/mailman/listinfo/python-list
Re: More int and float attributes
It seems as though just about all of those would be rarely, if ever, used by the vast majority of programmers. Plus, python already handles the two most important (NaN and complex) well. -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython font color
Fonts don't have colors. You need to either change the text color in whatever widget the test is going or change the wx.Brush in your Paint method. Kiran wrote: > hey everybody, > i cant seem to find a way to create a font with a non-default color > using the wx.Font constructor. anybody know how to change hte color? > > thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite3 in Python 2.5b1: my out-of-the-box experience
John Machin wrote: > Apologies in advance if this is a bit bloggy, but I'd like to get > comments on whether I've lost the plot (or, more likely, failed to > acquire it) before I start reporting bugs etc. These are not, in fact, bugs. One of SQLite's features is that it does not enforce type, meaning that with the exception of INTEGER PRIMARY KEY you can stick whatever you want into whatever field you want. The philosophy of SQLite is that type checking is a "mis-feature" that goes against some of the principles of the relational model. Taking this into consideration, how would pysqlite handle opening a database that mixes strings and integers in datetime fields? The short answer is that it can't, so instead it is up to the developer to ensure proper handling of type (sounds like python duck-typing, doesn't it?) -- http://mail.python.org/mailman/listinfo/python-list
Re: Controlling Windows Media Player from Python
Jeffrey Barish wrote: > Is there a way to interact with Windows Media Player from Python? I would > like to be able to do things like tell WMP to play a given sound file or to > ask WMP for metadata about a sound file. > -- > Jeffrey Barish The fact of the matter is that python doesn't need to ask WMP for the metadata. Python can get the metadata from the file itself and then tell the computer to play the file. If you're looking to do something more complicated, try PyMedia or even download wxPython and take a look at the examples. There's an embedded WMP example. By the way, someone has most likely made a module specifically for reading the metadata from many types of music files, but I don't have time to look. Maybe someone else can point you in the right direction. For telling WMP to play the file you want one of the os.exec variants. -- http://mail.python.org/mailman/listinfo/python-list
Re: performance difference between OSx and Windows
> Can I ask why that is, and if there is a way to take advantage > of all 4 within python? Sure. All major programming languages handle concurrency in one of two ways: multithreading or parallel processes. In the standard python interpreter, there is the Global Interpreter Lock (GIL for short) that only allows one thread to run at once. So your option for python are limited to running multiple processes or using a different interpreter. What you are testing, however, is not easily parallizable since the slow concat in particular is very dependent on sequential results. If you want test the quad cores you'll have to run the test multiple times with many different threads to truly stress them. -- http://mail.python.org/mailman/listinfo/python-list
Re: performance difference between OSx and Windows
Brian wrote: > I have been a Mac and linux guy since 1998 and except for a handful of > times, have not touched a MS box since then. This changes a few days > ago when I needed to get a MS box for another project. This leads me > to my question... > > A while ago, I borrowed a python script from someone's blog that showed > some interesting profiling schemes. I made some modifications to it, > ran it and until I got this new machine forgot about it. Just for > kicks I ran it again on both boxes to see what the differences were. > To say I was surprised is an understatement. Here is the code: *snip* > > While the CPU speed on the G5 was faster the total execution time was > much quicker on the MS box. Can anyone give some suggestions as to why > this is? > > Thanks, > Brian 1. Your test only makes use of one core. So it's a comparison between a G5 and an Athlon 64. Which brings us to... 2. The K8 architecture is, in most operations, far superior to the G5 architecture, Apple's benchmarks notwithstanding. You see, the way IBM cut down its Power 4 to make the PPC970 left it a bit weak it the heavy lifting ability. The K8, however, is heir to the amazing Alpha architecture's legacy. While the G5 has no problems beating out the marketing-driven P4 architecture, it can't compete clock for clock with the K8. -- http://mail.python.org/mailman/listinfo/python-list
Re: hyperthreading locks up sleeping threads
No lockup for me after 28 hours. Of course, I don't have HT. It's a dual Opteron system with WinXP. -- http://mail.python.org/mailman/listinfo/python-list
Re: Events in Python?
[EMAIL PROTECTED] wrote: > Here is another non-pythonic question from the Java Developer. (I beg > for forgiveness...) > > Does Python have a mechanism for events/event-driven programming? > > I'm not necessarily talking about just GUIs either, I'm interested in > using events for other parts of an application as well. > > If there isn't some sort of event mechanism built into Python, where > might I find some information about implementing one? > > Thanks, > > Scott Huey Technically this is a question more of perception than capability. All programming languages are event driven. Calling a function is an event, for instance. What I suspect you mean is an event management system, which is what OO state machines are all about. If you actually mean something akin in function to GUI event systems, you're really talking about message passing. In the case of message passing you just need to build a simple event manager class that echoes a message to all subscribed listening objects. In python that message can be a function, object, arguments, text, etc. This is easily done without threading, in case you're worried about that. The function of the event manager that is used for the purpose of initiating events can simply call a particular method of all subscribing objects held in a list. Simple as can be :) ~Brendan Kohler -- http://mail.python.org/mailman/listinfo/python-list
Re: Eclipse best/good or bad IDE for Python?
Though I tried most the above listed IDEs, sticking with a few for awhile, I always find myself gravitating back to the one no one ever mentions: IDLE. It's simple, fast, and with multiple monitors the lack of tabs really isn't much of a problem. The biggest reason I've found myself using IDLE is the colorizing...I've found little support in other editors for builtins having their own color. Granted, I haven't gotten far enough to bother with that in some editors. Eclipse, for example, performs like a dog on my dual opteron workstation w/ 2GB of RAM, which is more than enough to annoy me. I shouldn't have to wait more than about 1 second for an editor to start and then open what is essentially a text file :-P. -- http://mail.python.org/mailman/listinfo/python-list