Re: Help with generators outside of loops.

2004-12-08 Thread Andrea Griffini
David Eppstein wrote: In article <[EMAIL PROTECTED]>, "Robert Brewer" <[EMAIL PROTECTED]> wrote: But I'm guessing that you can't index into a generator as if it is a list. row = obj.ExecSQLQuery(sql, args).next() I've made it a policy in my own code to always surround explicit calls to next()

Re: simple GUI question

2004-12-08 Thread Brian van den Broek
Roose said unto the world upon 2004-12-08 02:23: You want somthing like: root = Tkinter.Tk() root.withdraw() msg = tkMessageBox.showwarning("Ooops", "Some warning") Awesome thanks! Any chance you know about the font thing : ) Nah I'll stop being lazy and hack it... but for some reason Tkinter doe

Re: simple GUI question

2004-12-08 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2004-12-08 03:16: Hi, I don't know Tkinter past a hour of playing, so I cannot show you how. I can, however, show you a good place to start looking: Best, Bria

guarding for StopIteration (WAS: Help with generators outside of loops.)

2004-12-08 Thread Steven Bethard
David Eppstein wrote: I've made it a policy in my own code to always surround explicit calls to next() with try ... except StopIteration ... guards. Otherwise if you don't guard the call and you get an unexpected exception from the next(), within a call chain that includes a for-loop over anoth

Re: guarding for StopIteration (WAS: Help with generators outside of loops.)

2004-12-08 Thread Steven Bethard
Steven Bethard wrote: Just to clarify here, the only time code raising a StopIteration will cause a for-loop to exit silently is if the StopIteration is raised in an __iter__ method, e.g.: That was a little imprecise. What I should have said is "the only time code raising a StopIteration will c

Re: why python is slower than java?

2004-12-08 Thread Andrew Dalke
JanC: > That person might be a student in some third-world country... Then think of the extra incentive to provide useful answers. Also, Eric had pointed out that payment included "money, sex, chocolate" and other non-monetary possibilities. Personally I think it'll be hard to put a monetary mi

creating generators from function

2004-12-08 Thread Simon Wittber
I use a coroutine/generator framework for simulating concurrent processes. To do this, I write all my functions using the general form: while True: do stuff yield None To make these generator functions compatible with a standard thread interface, I attempted to write a decorator which co

os.path.islink()

2004-12-08 Thread Egor Bolonev
hi all i want my program to ignore ntfs links, but os.path.islink() isnt work as i expect print os.path.islink('''C:\Documents and Settings\Егор\My Documents\Scripts\Antiloop\) outputs False far file manager said 'C:\Documents and Settings\Егор\My Documents\Scripts\Antiloop\' is link h

Re: How is Python designed?

2004-12-08 Thread Limin Fu
Of course for such simple expression, that function will not run recursively, but for more complex expressions, it will, as a example: a + b * ( c + ( d - e ) / f )... --- LutherRevisited <[EMAIL PROTECTED]> wrote: > Kinda off subject, just thought I'd add that 0! = 1 > for that recursion examp

Re: os.path.islink()

2004-12-08 Thread Peter Maas
Egor Bolonev schrieb: far file manager said 'C:\Documents and Settings\ÐÐÐÑ\My Documents\Scripts\Antiloop\' is link how to detect ntfs links? There are no ntfs links. What appears as a link on GUI level is nothing but a plain file with special content, so that os.path.islink() tells the truth. W

Re: creating generators from function

2004-12-08 Thread Steven Bethard
Simon Wittber wrote: I use a coroutine/generator framework for simulating concurrent processes. To do this, I write all my functions using the general form: while True: do stuff yield None To make these generator functions compatible with a standard thread interface, I attempted to write a

Re: cookie lib policy how-tp?

2004-12-08 Thread Riko Wichmann
Tried that already. At least, I hope I guessed at least one of the possible identifiers correct: MSIE6.0, MSIE 6.0, MSIE/6.0 When my opera is set to identify as MSIE, it sends "Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.54 [en]". Hi Marc, thanks for the hint! that brought me a

spawn or fork

2004-12-08 Thread C Gillespie
Dear All, I have a function def printHello(): fp = open('file','w') fp.write('hello') fp.close() I would like to call that function using spawn or fork. My questions are: 1. Which should I use 2. How do I call that function if it is defined in the same file. Many thanks Colin --

Connecting to numarray. Problem with the setup program

2004-12-08 Thread Jean Moser
I tried many times to connect to numarray without success. I choosed the release: numarray-1.1.1.win32py2.2.exe then I went to the setup program made by Greenfield and I tried to follow the commands.The mentioned Python directory is C:\PROGRA~2 which is not covenient. I tried to change it but witho

Re: os.path.islink()

2004-12-08 Thread Egor Bolonev
On Wed, 08 Dec 2004 10:23:13 +0100, Peter Maas <[EMAIL PROTECTED]> wrote: Egor Bolonev schrieb: far file manager said 'C:\Documents and Settings\Егор\My Documents\Scripts\Antiloop\' is link how to detect ntfs links? There are no ntfs links. What appears as a link on GUI level is nothing but a p

Re: os.path.islink()

2004-12-08 Thread Egor Bolonev
On Wed, 08 Dec 2004 20:29:27 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote: gui folder link is a .lnk file i want to detect "'s" C:\Documents and Settings\Егор\My Documents>dir Том в устройстве C не имеет метки. Серийный номер тома: 386D-F630 Содержим

Re: os.path.islink()

2004-12-08 Thread Erik Max Francis
Egor Bolonev wrote: gui folder link is a .lnk file What he's telling you is that Windows doesn't implement symbolic links. os.path.islink does not detect what you think it does. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM e

Re: simple GUI question

2004-12-08 Thread Eric Brunel
Roose wrote: [snip] Another thing I would *like* but is not strictly necessary would be to change the font size and color of the text within the box. Is there a good way of doing that? I have googled around but can't find any decent example code for some reason. Short answer: you can't. The tkMes

Re: spawn or fork

2004-12-08 Thread Miki Tebeka
Hello Colin, > I have a function > def printHello(): > fp = open('file','w') > fp.write('hello') > fp.close() > > I would like to call that function using spawn or fork. My questions are: > > 1. Which should I use spawn and fork are very different functions. Read the documentation on

Re: creating generators from function

2004-12-08 Thread Peter Otten
Simon Wittber wrote: > I use a coroutine/generator framework for simulating concurrent processes. > > To do this, I write all my functions using the general form: > > while True: > do stuff > yield None > > To make these generator functions compatible with a standard thread > interface, I attem

Re: Python for Palm OS?

2004-12-08 Thread 'Dang' Daniel Griffith
On Wed, 08 Dec 2004 04:48:42 GMT, Maurice LING <[EMAIL PROTECTED]> wrote: >As mentioned, since Pippy is pretty old or rather based on rather old >code base, can it be assumed that not much is happening at this front? > >This might be dumb to ask then, does anyone know if Pippy had been used >in

Re: deferred decorator

2004-12-08 Thread Nick Coghlan
Bryan wrote: i'm also curious if it's possible to write this recipe using the new class style for the Deffered class.it appears you can nolonger delegate all attributes including special methods to the contained object by using the __getattr__ or the new __getattribute__ methods. does anyo

Re: spawn or fork

2004-12-08 Thread C Gillespie
"Miki Tebeka" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Colin, > > > I have a function > > def printHello(): > > fp = open('file','w') > > fp.write('hello') > > fp.close() > > > > I would like to call that function using spawn or fork. My questions are: > > >

Re: Sorting in huge files

2004-12-08 Thread Jeremy Sanders
On Tue, 07 Dec 2004 12:27:33 -0800, Paul wrote: > I have a large database of 15GB, consisting of 10^8 entries of > approximately 100 bytes each. I devised a relatively simple key map on > my database, and I would like to order the database with respect to the > key. You won't be able to load this

Re: How do I do this? (eval() on the left hand side)

2004-12-08 Thread Nick Coghlan
It's me wrote: Yes, Russell, what you suggested works. I have to chew more on the syntax to see how this is working. because in the book that I have, it says: exec code [ in globaldict [, localdict] ] The [] indicate the last two parts are optional. If you don't supply them, exec just uses the

Re: writing to mailboxes

2004-12-08 Thread Thomas Guettler
Am Tue, 07 Dec 2004 15:30:13 -0500 schrieb Eric S. Johansson: > I've been searching around for the equivalent to the mailbox module > except with the capability of writing messages as well as reading. If > it makes it easier, I only need to write to maildir mailboxes. Hi, there is a script ca

Google's MapReduce

2004-12-08 Thread bearophileHUGS
(This Google article suggestion comes from the CleverCS site): http://labs.google.com/papers/mapreduce-osdi04.pdf "MapReduce is a programming model and an associated implementation for processing and generating large data sets. Users specify a map function that processes a key/value pair to gener

Re: How do I do this? (eval() on the left hand side)

2004-12-08 Thread Nick Coghlan
Caleb Hattingh wrote: '>>> a # The value of a is changed. 8 '>>> The value of a is changed. . . *maybe*. The Python language definition states explicitly that updates to the dictionary returned by locals() may not actually alter the local variables. Generally, altering the contents o

Re: [BUG] IMO, but no opinions? Uncle Tim? was: int(float(sys.maxint)) buglet ?

2004-12-08 Thread Nick Coghlan
In the absence of identifying an actual problem this would solve, I would oppose adding *gratuitous* complication. Abusing your sense of aesthetics isn't "an actual problem" in this sense to me, although it may be to you. Of course you're welcome to make any code changes you like in your own copy

Re: Quixote+Nevow+LivePage

2004-12-08 Thread mirnazim
[EMAIL PROTECTED] wrote: > I am really sorry if i sounded a bit bad, i did not mean that. > what i meant was that , i got my answer to Q2 that livepage is for > twisted only. but Q1 and Q2 still stand. > > I m sorry again. comp.lang.python is a wonderful community. Most tolerant community. Most h

Re: cookie lib policy how-tp?

2004-12-08 Thread Marc Christiansen
Riko Wichmann <[EMAIL PROTECTED]> wrote: >>>Tried that already. At least, I hope I guessed at least one of the >>>possible identifiers correct: MSIE6.0, MSIE 6.0, MSIE/6.0 >> >> >> When my opera is set to identify as MSIE, it sends >> "Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7

Re: Unknown locale nb_NO ?

2004-12-08 Thread StasZ
On Wed, 08 Dec 2004 10:31:31 +0300, Denis S. Otkidach wrote: > On Tue, 07 Dec 2004 17:06:12 +0100 > Stas Z <[EMAIL PROTECTED]> wrote: > >> When I 'googled' for it, I saw that no_NO has become nn_NO/nb_NO. >> However it strikes me as odd, that Python2.3.4 raises an exception when >> querying for a

new comp.lang.python mirror at lampfroums.org--any Linux, Apache, MYSQL, Python Apps?

2004-12-08 Thread astro
Hello all, We have set up new linux, apache, mysql, python, perl, and php forums at http://lampforums.org . comp.lang.python is at: http://lampforums.org/forumdisplay.php?f=18 The interface allows your posts to appear immediately on the forums, and also to private message other users. Your post

Re: spawn or fork

2004-12-08 Thread Eric Brunel
C Gillespie wrote: Dear All, I have a function def printHello(): fp = open('file','w') fp.write('hello') fp.close() I would like to call that function using spawn or fork. My questions are: 1. Which should I use 2. How do I call that function if it is defined in the same file. spawn exe

Re: PIL for Windows for Python 2.4

2004-12-08 Thread Scott F
Peter Hansen <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Actually, you're just seeing the repr() of the filename. > You really are missing that file in the place where it's > looking. > > -Peter > Give the man a beer! Thanks. I had ImConfig.h.win so I changed setup.py to t

problem with win32file.RemoveDirectory

2004-12-08 Thread me
Hello python world. Since yesterday I'm using Python 2.4/PythonWin (build 203) on my Win98 system. My problem - that did not occured in the previous version Python 2.3.4/PythonWin (build 163) - is the following: The command i. e. 'win32file.RemoveDirectory("C:\\Python 2.4\\folder")' causes the

Re: How is Python designed?

2004-12-08 Thread Diez B. Roggisch
> Of course for such simple expression, that function > will not run recursively, but for more complex > expressions, it will, as a example: > a + b * ( c + ( d - e ) / f )... No, it won't. You seem to not properly understand what recursion is, and confuse it with overloaded methods. The compute-

Re: spawn or fork

2004-12-08 Thread Diez B. Roggisch
> Thanks, but can I call it using spawn? No, but you can spawn a python interpreter that calls it. Like this: spawnv(P_, sys.executable, ['-c', 'import myfile; foo()']) But I suggest you use fork - then you can call it in the interpreter itself. -- Regards, Diez B. Roggisch -- http://mail.pyt

Re: spawn or fork

2004-12-08 Thread C Gillespie
> What are you trying to do exactly? If you provide more explanations, we may > provide a better help than the simplistic one above. Dear All, Thanks for the suggestions. Basically, I have the situation where a user (via the web) requests data from a database that has to be written to file. Howe

Re: creating generators from function

2004-12-08 Thread Simon Wittber
> I'm a little confused as to what you're trying to do here. The f() > function, in particular, doesn't make much sense I see I am misunderstood. The example was contrived, and it seems, incorrect. I simulate threads, using generator functions and a scheduler. My implementation lives here: http

Re: creating generators from function

2004-12-08 Thread Timo Virkkala
Simon Wittber wrote: I guess this changes my question to: Can I convert a function containing an infinite loop, into a generator which will yield on each iteration? Why don't you just use threads? It would probably be easier in the long run... -- Timo Virkkala -- http://mail.python.org/mailman/lis

Re: deferred decorator

2004-12-08 Thread Bryan
Nick Coghlan wrote: Bryan wrote: i'm also curious if it's possible to write this recipe using the new class style for the Deffered class.it appears you can nolonger delegate all attributes including special methods to the contained object by using the __getattr__ or the new __getattribute__

Re: How is Python designed?

2004-12-08 Thread Limin Fu
It seems that we focused on different things. I was talking about the example I have given for arithmetic evaluation. And you focused the AST-based evaluation, which, I belive, is different from my example. I also agree that they called the functions for the same number of times, the difference is

Re: os.path.islink()

2004-12-08 Thread Tim G
You may well be able to do it with the win32file module functions: GetFileAttributesEx or GetFileInformationByHandle It's not my area of expertise, but usually a bit of poking around in msdn.microsoft.com yields some results, as does Googling around for other people (often VB or Delphi-based) who h

Re: How do I do this? (eval() on the left hand side)

2004-12-08 Thread Peter Hansen
Nick Coghlan wrote: Generally, altering the contents of the dicts returned by locals() and globals() is unreliable at best. Nick, could you please comment on why you say this about globals()? I've never heard of any possibility of "unreliability" in updating globals() and, as far as I know, a larg

Re: spawn or fork

2004-12-08 Thread Eric Brunel
C Gillespie wrote: What are you trying to do exactly? If you provide more explanations, we may provide a better help than the simplistic one above. Dear All, Thanks for the suggestions. Basically, I have the situation where a user (via the web) requests data from a database that has to be written t

Re: Help with generators outside of loops.

2004-12-08 Thread Christopher J. Bottaro
Steven Bethard wrote: > I don't do much with SQL/databases stuff, but if you really know the > result will be a single row, you can take advantage of tuple unpacking > and do something like: > > row, = obj.ExecSQLQuery(sql, args) > > or > > [row] = obj.ExecSQLQuery(sql, args) > > This has the a

Re: Python 2.3.5 ?

2004-12-08 Thread Stefan Behnel
Stefan mails! the way you read it doesn't reflect why top-posting is bad: It's me wrote: Not to mention that there are packages out there that doesn't work (yet) with 2.4. Pynum is one such package. -- It's me "Larry Bates" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Just because 2

Re: How is Python designed?

2004-12-08 Thread Diez B. Roggisch
> I'm sure the code in my example is recursive. As I > have said, you may show those codes I gave as example > to somebody know C++ well to check if it is recursive. I just had second thoughts about tree-traversal beeing recursive - and I have to admit that I'm not entirely sure if I can hold up t

Re: How is Python designed?

2004-12-08 Thread Diez B. Roggisch
> agree that they called the functions for the same > number of times, the difference is how they are > called. What do you mean by difference in calling - a call is a call, no? -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: creating generators from function

2004-12-08 Thread Terry Reedy
"Simon Wittber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I guess this changes my question to: Can I convert a function > containing an infinite loop, into a generator which will yield on each > iteration? A function containing an infinite loop will never return, so it is bug

updating locals() and globals() (WAS: How do I do this? (eval() on the left hand side))

2004-12-08 Thread Steven Bethard
Peter Hansen wrote: Nick Coghlan wrote: Generally, altering the contents of the dicts returned by locals() and globals() is unreliable at best. Nick, could you please comment on why you say this about globals()? I've never heard of any possibility of "unreliability" in updating globals() and, as

I need to create the table and I want to edit its content from www level.

2004-12-08 Thread Rootshell
Hello. I have one more problem with 'tabla.py' file: Can't do the compilation 'cause something wrong is happening with module 'posix'. The message is as follows: "no module name posix". I guess that it is necessary to import it. Unfortunately 'posix' seems to be the unix module and my platform

Re: Problem while trying to extract a directory from a zipfile.

2004-12-08 Thread vincent wehren
ralobao wrote: I have this code: try: file = zipfile.ZipFile(nome_arquivo) Gauge.start() #inicia o Gauge for element in file.namelist(): try: newFile = open(diretorio + element,"wb") except: newFile = open(diretorio

Re: Help with generators outside of loops.

2004-12-08 Thread Steven Bethard
Christopher J. Bottaro wrote: Wow, good advice. One question, how is the generator class implemented so that if assigned to a tuple/list, it knows what to do? Is it possible to overload the assignment operator kinda like in C++? Tuple unpacking works with generators because generators implement t

Re: How is Python designed?

2004-12-08 Thread Limin Fu
> So maybe you're right in claiming it beeing > recursive. But then, > depth-traversal is recursive, too. No, in the depth-traversal implementation, a function can avoid calling itself (at least in my implementation it's like this). Because you can write seperate functions: a function for depth

Re: spawn or fork

2004-12-08 Thread sjdevnull
Eric Brunel wrote: > > Basically, I have the situation where a user (via the web) requests data > > from a database that has to be written to file. However, this takes a couple > > of minutes. So the way I thought of doing this is: > > 1. create an empty file. > > 2a. tell the user where to look fo

Re: I need to create the table and I want to edit its content from www level.

2004-12-08 Thread Gerhard Haering
On Wed, Dec 08, 2004 at 09:03:54AM -0800, Rootshell wrote: > Hello. > > I have one more problem with 'tabla.py' file: We don't know about the files on your harddisk ;-) > Can't do the compilation 'cause something wrong is happening with > module 'posix'. Whoever wrote tabla.py probably didn't

Bug 834351 - Mouse wheel crashes program

2004-12-08 Thread Gary Richardson
Has this bug been fixed in 2.3.5 or 2.4? Does it exist in XP systems? #- from Tkinter import * def _onMouseWheel(event): print event root = Tk() root.bind('',_onMouseWheel) root.mainloop() -- http://mail.python.org/mailman/listinfo/python-list

Re: 2D array

2004-12-08 Thread Adam DePrince
On Tue, 2004-12-07 at 23:02, Steven Bethard wrote: > LutherRevisited wrote: > > I'm wanting to do something with a list that is basically a 2 dimensional > > array. I'm not so good with lists so can someone give me an example of how > > I > > might implement this in Python? thanks. > > If you'r

Re: How is Python designed?

2004-12-08 Thread Diez B. Roggisch
> No, in the depth-traversal implementation, a function > can avoid calling itself (at least in my > implementation it's like this). How so? It has to keep state of which nodes to visit - so instead of calling trav, you call functions to store and fetch nodes in a container like a stl-list. That's

Python Docs. Hardcopy 2.4 Library Reference, interested?

2004-12-08 Thread Brad Clements
Is anyone interested in purchasing a hardcopy version of the Python 2.4 Library reference? That is, assuming it was NOT a direct print of current html/pdf versions. So, nicely formatted for a printed book (spiral bound probably), with several indexes as appropriate, or perhaps a permutted index.

Re: Google's MapReduce

2004-12-08 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > (This Google article suggestion comes from the CleverCS site): > > http://labs.google.com/papers/mapreduce-osdi04.pdf > > "MapReduce is a programming model and an associated implementation for > processing and generating large data set

Re: new comp.lang.python mirror at lampfroums.org--any Linux, Apache, MYSQL, Python Apps?

2004-12-08 Thread Terry Reedy
"astro" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Hello all, > We have set up new linux, apache, mysql, python, perl, and php forums > at http://lampforums.org . Perhaps you could say at the top of that page what LAMP means. My guess: Linux-Apache-Mysql-Planguage -- but why

Re: Recursive list comprehension

2004-12-08 Thread Adam DePrince
On Mon, 2004-12-06 at 10:01, Timothy Babytch wrote: > Serhiy Storchaka wrote: > > >>>sum([['N', 'F'], ['E'], ['D']], []) > ['N', 'F', 'E', 'D'] > > THE BEST! > > -- > Timothy Babytch, PHP-dev Teamleader Sum certainly takes the cake for hackish elegance, and would be my choice if I was absolut

Re: after embedding and extending python (using swig) problem importing (non-core) modules

2004-12-08 Thread stefan
thanks a lot for the quick answer. I had to provide the debug-versions, since I was in debug mode, like you already expected! thanks a lot again! -stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: HTML Structure Extraction

2004-12-08 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > I'm going to write a program that extracts the structure of HTML > documents. The structure would be in the form of a tree, separating the > tags and grouping the start and end tags. I think I will use > htmllib.HTMLParser, is it appropriate for my application? If so,

Re: How is Python designed?

2004-12-08 Thread Limin Fu
I think code says thing clearer, here I pasted a simplified version of my implementation with depth-tranverse. Note: this simplified version cannot handle unary computation. To read the real version, please read one source file of Yuan at: http://cvs.sourceforge.net/viewcvs.py/yuan-language/yuan_de

Re: Help with generators outside of loops.

2004-12-08 Thread David Eppstein
In article <[EMAIL PROTECTED]>, Andrea Griffini <[EMAIL PROTECTED]> wrote: > Isn't the handling of StopIteration confined in the very moment of > calling .next() ? This was what I expected... and from a simple test > looks also what is happening... Not if someone farther back in the call chain i

Re: guarding for StopIteration (WAS: Help with generators outside of loops.)

2004-12-08 Thread David Eppstein
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: > David Eppstein wrote: > > I've made it a policy in my own code to always surround explicit calls > > to next() with try ... except StopIteration ... guards. > > > > Otherwise if you don't guard the call and you get an u

Re: ming for python

2004-12-08 Thread Jack Diederich
On Tue, Dec 07, 2004 at 07:55:09PM +0100, titouille wrote: > Hello everybody !! > > anyone has try to build ming0.3beta1 for python 2.3.3 under windows ?? > > Since three days, I try to build it with mingw32, and finally, I am > stopped with C declarations error in src/actioncompiler/swf4compile

Re: sys.stdin.read question

2004-12-08 Thread Caleb Hattingh
I don't have much experience with popen3. I do know that IDLE (interactive interpreter) does something to sys.stdin, and that is probably the problem you are seeing. Try your commands through the python interactive interpreter started from a shell (DOS or Bash), see if it still happens.

Re: How do I do this? (eval() on the left hand side)

2004-12-08 Thread Caleb Hattingh
Peter, I second that. Nick In what way is it unreliable? I can't seem to create a situation where the update through globals and locals doesn't work. Are you referring perhaps to the possibility of variables being garbage collected and then not being around later when one tries to access t

Re: Sorting in huge files

2004-12-08 Thread Adam DePrince
On Tue, 2004-12-07 at 16:47, Paul wrote: > I really do need to sort. It is complicated and I haven't said why, but > it will help in finding similar keys later on. Sorry I can't be more > precise, this has to do with my research. Precision is precisely what we require to give you an answer more me

Re: How do I do this? (eval() on the left hand side)

2004-12-08 Thread Peter Otten
Caleb Hattingh wrote: > In what way is it unreliable?  I can't seem to create a situation where > the update through globals and locals doesn't work.   Are you referring Updates to a locals() dictionary may not be reflected by the variables in the local scope, e. g.: >>> def f(): ... locals(

Re: updating locals() and globals() (WAS: How do I do this? (eval() on the left hand side))

2004-12-08 Thread Caleb Hattingh
Steve, I don't think I understand. Here is what I just tried: '>>> def f(): x = 3 d = locals() print x print d['x'] d['x'] = 5 print x '>>> f() 3 3 3 '>>> In your example, x had not yet been initialised, maybe. What I am seeing is that "x

MP3 - VBR - Frame length in time

2004-12-08 Thread Ivo Woltring
Dear Pythoneers, I have this problem with the time calculations of an VBR (variable bit rate) encoded MP3. I want to make a daisy writer for blind people. To do this I have to know exactly what the length in time of an mp3 is. With CBR encoded files I have no real problems (at least with version 1

Re: new comp.lang.python mirror at lampfroums.org--any Linux, Apache, MYSQL, Python Apps?

2004-12-08 Thread astro
The top of the page at http://lampforums.org has a few places where LAMP is spelled out as Linux, Apache, MYSQL, and PHP/Perl/Python. I could make it more clear, I suppose--any suggestions as to how to word it would be great! The LAMP acronym has been around for awhile--I think there are even a

Re: Recursive list comprehension

2004-12-08 Thread Steven Bethard
Adam DePrince wrote: def flatten( i ): try: i = i.__iter__() while 1: j = flatten( i.next() ) try: while 1: yield j.next() except StopIteration: pass except AttributeError: yield

Re: 2D array

2004-12-08 Thread Steven Bethard
Adam DePrince wrote: If your data is sparse you might want to consider using a dictionary where the key is a tuple representing the coordinates. a = {} a[(0,0)] = 0 a[(0,1)] = 1 [snip] print a.get( (5,0), None ) Good point. Note that you don't need the parentheses in the assignments or item acces

Re: updating locals() and globals() (WAS: How do I do this? (eval() on the left hand side))

2004-12-08 Thread Steven Bethard
Caleb Hattingh wrote: Steve, I don't think I understand. Here is what I just tried: '>>> def f(): x = 3 d = locals() print x print d['x'] d['x'] = 5 print x '>>> f() 3 3 3 '>>> In your example, x had not yet been initialised, maybe. What I am seeing is that "x" doe

Re: Recursive list comprehension

2004-12-08 Thread Peter Otten
Adam DePrince wrote: > def flatten( i ): > try: > i = i.__iter__() > while 1: > j = flatten( i.next() ) > try: > while 1: > yield j.next() > except StopIteration: > pass > except Attribu

jython and swing

2004-12-08 Thread Nandan
hello, can I ask a jython question here? when I use the jython interpreter I have no problem with the statement: from java import lang from javax import swing but when I put this in a script, I get a package not found error. what am I doing wrong? the script header is #!/bin/env jython -- Nan

Re: How do I do this? (eval() on the left hand side)

2004-12-08 Thread Caleb Hattingh
Thx Peter I verified this situation myself with a post from Steven Bethard earlier (trying to use "locals" within a function definition). I am convinced now that locals() doesn't work as (I) expected. Steven says there was some or other reason why locals() as used in this context is not wri

Multiple concurrent telnet sessions

2004-12-08 Thread Tony Pryor
Hello, Anyone know if running two client telnet sessions at the same time should be an inherent problem? They don't seem to want to share a port or are they trying to use the same console for interaction with the connected servers? -Tony Hello from parent loop 1 ipaddress1 Hello from parent l

Re: Recursive list comprehension

2004-12-08 Thread Nick Craig-Wood
Adam DePrince <[EMAIL PROTECTED]> wrote: > def flatten( i ): > try: > i = i.__iter__() > while 1: > j = flatten( i.next() ) > try: > while 1: > yield j.next() > except StopIteration: >

ANN: mkplaylist.py 0.3

2004-12-08 Thread Marc 'BlackJack' Rintsch
Hi, Hereby I'm announcing the first version of my playlist generating Python script that not only replaces the functionality of the simple Bash script I used to create playlists beforem but also reads meta data (tags, comments) from MP3 and Ogg Vorbis files and writes extended M3U playlists. The

Re: Recursive list comprehension

2004-12-08 Thread Steven Bethard
Peter Otten wrote: I noted that strings don't feature an __iter__ attribute. Therefore obj.__iter__() is not equivalent to iter(obj) for strings. Do you (plural) know whether this is a CPython implementation accident or can be relied upon? Nick Craig-Wood wrote: > With a little more investigation I

Re: Python Docs. Hardcopy 2.4 Library Reference, interested?

2004-12-08 Thread Paul Rubin
"Brad Clements" <[EMAIL PROTECTED]> writes: > Is anyone interested in purchasing a hardcopy version of the Python 2.4 > Library reference? > > That is, assuming it was NOT a direct print of current html/pdf versions. > > So, nicely formatted for a printed book (spiral bound probably), with > sev

Re: Import a module without executing it?

2004-12-08 Thread Kent Johnson
Andy, this is a nice example. It prompted me to look at the docs for compiler.visitor. The docs are, um, pretty bad. I'm going to attempt to clean them up a little. Would you mind if I include this example? Thanks, Kent Andy Gross wrote: Here's a quick example that will pull out all functions de

Re: Recursive list comprehension

2004-12-08 Thread Adam DePrince
On Wed, 2004-12-08 at 15:02, Steven Bethard wrote: > Adam DePrince wrote: > > def flatten( i ): > > try: > > i = i.__iter__() > > while 1: > > j = flatten( i.next() ) > > try: > > while 1: > > yield j.next() > >

Help beautify ugly heuristic code

2004-12-08 Thread Stuart D. Gathman
I have a function that recognizes PTR records for dynamic IPs. There is no hard and fast rule for this - every ISP does it differently, and may change their policy at any time, and use different conventions in different places. Nevertheless, it is useful to apply stricter authentication standards

Re: [SPAM] Re: Import a module without executing it?

2004-12-08 Thread Andy Gross
On Dec 8, 2004, at 5:44 AM, Kent Johnson wrote: Andy, this is a nice example. It prompted me to look at the docs for compiler.visitor. The docs are, um, pretty bad. I'm going to attempt to clean them up a little. Would you mind if I include this example? Be my guest! /arg -- http://mail.python.or

Re: 2D array

2004-12-08 Thread Adam DePrince
On Wed, 2004-12-08 at 15:06, Steven Bethard wrote: > Adam DePrince wrote: > > If your data is sparse you might want to consider using a dictionary > > where the key is a tuple representing the coordinates. > > > > a = {} > > a[(0,0)] = 0 > > a[(0,1)] = 1 > [snip] > print a.get( (5,0), None ) >

Re: opinions comments needed for improving a simple template engine.

2004-12-08 Thread fuzzylollipop
the ONLY way to tell what is slow is to actually profile each of the operations, that said, start with examining object creation / memory allocation. string concationation usually does both . . . -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive list comprehension

2004-12-08 Thread Steven Bethard
Adam DePrince wrote: On Wed, 2004-12-08 at 15:02, Steven Bethard wrote: Note that I special-case strings because, while strings support the iterator protocol, in this case we want to consider them 'atomic'. By catching the TypeError instead of an AttributeError, I can support old-style iterator

Re: 2D array

2004-12-08 Thread Steven Bethard
Adam DePrince wrote: The use of None as the default parameter was on purpose; the lack of "magic" in python is often cited in religious wars between python and perl aficionados. Use of get(something, None) was on purpose, the level of familiarity with the language implied by the original question

Re: Multiple concurrent telnet sessions

2004-12-08 Thread Lee Harr
On 2004-12-08, Tony Pryor <[EMAIL PROTECTED]> wrote: > Hello, > > Anyone know if running two client telnet sessions at the same time > should be an inherent problem? They don't seem to want to share a port > or are they trying to use the same console for interaction with the > connected servers? >

Re: Bug 834351 - Mouse wheel crashes program

2004-12-08 Thread "Martin v. Löwis"
Gary Richardson wrote: Has this bug been fixed in 2.3.5 or 2.4? Does it exist in XP systems? To my knowledge, it has not been fixed. I have not even tried to reproduce it, yet. Contributions are welcome. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: MP3 - VBR - Frame length in time

2004-12-08 Thread Lonnie Princehouse
It might be much easier to use an external program to figure out the length. Here's an example that uses sox to convert just about any audio file into a raw format, and then determines duration by dividing length of the raw output by number of bytes per frame. I don't know if they make sox for Win

  1   2   >