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

2004-12-08 Thread Peter Otten
Peter Hansen wrote: > Caleb Hattingh wrote: >> 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 writable - Do you know why this is? I really do not >> like guidelines like "may not work",

Parse XML using Python

2004-12-08 Thread anilby
Hi, I wanted to write a script that will read the below file: . .. .. .. .. .. . . . .. .. .. and so on The output of the script shud be ABC ..EFGA ABDG ..MON A1 ..FGA BG Please help me in writing a Python script for the above task. Regards, Anil. -- h

A new - good usergroup for VoIP

2004-12-08 Thread erika_angella
Hi, I would like to introduce a new VoIP(Voice Over Internet Protocol) Usergroup to you. The link is: http://www.techieindex.com/ug/voip/index.jsp Voice Over Internet Protocol (VoIP) Portal includes VoIP White papers, VoIP Articles, VoIP Books, VoIP magazines, VoIP events, VoIP faqs, VoIP news,

Re: swig & Python question

2004-12-08 Thread It's me
"It's me" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am playing around with SWING building a Python module using the no brainer > example in http://www.swig.org/tutorial.html. With that first example, > Oops! Soapy fingers. "SWIG" - not "SWING". -- It's me. -- http:/

swig & Python question

2004-12-08 Thread It's me
I am playing around with SWING building a Python module using the no brainer example in http://www.swig.org/tutorial.html. With that first example, /* File : example.c */ #include double My_variable = 3.0; int fact(int n) { if (n <= 1) return 1; else return n*fact(n-1); } int

Re: Recursive list comprehension

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

Re: Class Variable Inheritance

2004-12-08 Thread Craig Ringer
On Thu, 2004-12-09 at 08:55, Brian Jones wrote: > I'm sure the solution may be obvious, but this problem is driving me > mad. The following is my code: > > class a(object): > > mastervar = [] > > def __init__(self): > print 'called a' > > class b(a): > > def _

Re: Setting Focus in WxTextCtrl

2004-12-08 Thread Greg Krohn
LutherRevisited wrote: I know in .NET text boxes have a focus method which will do this, but I can't find anything similar in the places I've looked so far. wxPython does, in fact have such a method. It's called SetFocus. It's actually a wx.Window method, so all controls have it. hth greg -- http

Re: creating generators from function

2004-12-08 Thread Isaac To
> "Mike" == Mike Meyer <[EMAIL PROTECTED]> writes: Mike> I think it's a bit abnormal, because you have to scan the Mike> loop body for breaks. I tend to write: Mike> condition = True Mike> while condition: # corrected Mike> #code which iterates my simulation Then you

Setting Focus in WxTextCtrl

2004-12-08 Thread LutherRevisited
I'm wanting to know how I would go about setting the focus to the next text field after I press enter. I'm guessing it's gonna be EVT_TEXT_ENTER(yada yada) calling some function which will move the focus, but I don't know how to move the focus. I know in .NET text boxes have a focus method which

ElementTree and XPATH

2004-12-08 Thread dayzman
Hi, I'm using ElementTree from effbot (http://effbot.org/zone/element.htm) and I'm having some problems finding nodes that have the same name. I know in XPATH, we can use an index to identify which node we need, but it seems to be invalid syntax if I give "/a/b[0]" to the findall() method. Does an

Re: MP3 - VBR - Frame length in time

2004-12-08 Thread JanC
Dmitry Borisov schreef: > It has something to deal with the VBR tags( XING header ). *If* there is a VBR tag (it's a custom extension) and *if* that VBR tag contains a correct value. -- JanC "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principles of the Inte

Re: Recursive list comprehension

2004-12-08 Thread Steven Bethard
Terry Reedy wrote: This is a ways off, if ever, but I think the general advice for user code is to use the newer protocol. Yes, definitely. I hope no one misconstrued me to be suggesting that you should use the 'sequence protocol' for iterators (e.g. using __getitem__ and raising an IndexError)

Re: Ideas for projects

2004-12-08 Thread Phillip Bowden
On 2004-12-08 21:47:49 -0600, Mike Meyer <[EMAIL PROTECTED]> said: Phillip Bowden <[EMAIL PROTECTED]> writes: I feel that I've learned the language pretty well, but I'm having trouble thinking of a medium to large project to start. What are some projects that you have written in the past with Pyth

Re: Class Variable Inheritance

2004-12-08 Thread Steven Bethard
Brian "bojo" Jones wrote: It became clear to me that mastervar inside of class a is a static variable, and is associated with all instances of classes that extend class a. Yeah, that's basically what's happening. AFAICT, a variable declared at class level is shared with all subclasses (and is a

Re: Class Variable Inheritance

2004-12-08 Thread Jeremy Bowers
On Wed, 08 Dec 2004 16:49:34 -0900, Brian "bojo" Jones wrote: > class a(object): > > def __init__(self): > self.map = mapper() > print 'called a' What is the advantage of this over def __init__(self): self.map = [] ? -- http://mail.python.org/mailman/l

Re: Ideas for projects

2004-12-08 Thread Mike Meyer
Phillip Bowden <[EMAIL PROTECTED]> writes: > I feel that I've learned the language pretty well, but I'm having > trouble thinking of a medium to large project to start. What are some > projects that you have written in the past with Python? Why start with a medium to large project when you can d

Re: exec'ing functions (WAS: updating locals() and globals())

2004-12-08 Thread Steven Bethard
Jeff Shannon wrote: Steven Bethard wrote: Jeff Shannon wrote: Note also that functions which use exec cannot use the static namespace optimization, and thus tend to be *much* slower than normal functions In what circumstances will this be true? I couldn't verify it: [snip] I was referring to fu

Re: creating generators from function

2004-12-08 Thread Mike Meyer
Simon Wittber <[EMAIL PROTECTED]> writes: >> A function containing an infinite loop will never return, so it is bugged >> and useless unless it does has an external effect with something like >> 'print xxx' within the loop. > > I thought the idiom: > > while True: > #code which iterates my s

Re: os.path.islink()

2004-12-08 Thread JanC
Peter Maas schreef: > Egor Bolonev schrieb: > >> how to detect ntfs links? > > There are no ntfs links. You're wrong, NTFS supports symlinks for directories and hard links for files:

Ideas for projects

2004-12-08 Thread Phillip Bowden
I feel that I've learned the language pretty well, but I'm having trouble thinking of a medium to large project to start. What are some projects that you have written in the past with Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive list comprehension

2004-12-08 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What is the getnext protocol? Is that the same thing that the iter() > docs call the sequence protocol? Yes. (I meant to write getitem rather than getnext.) > Because this definitely still works with itertools: Y

wxPython bug

2004-12-08 Thread Jive
Anyone know what's up with this, and how to fix it? (I'm running MS Windows 2000 Pro, SP 4) In wxPython 2.5, run the demo, samples/wxProject/wxProject.py Create a new project and add a file to it. In the console window you will probably see something like this:

Re: Creating Fixed Length Records

2004-12-08 Thread Stuart D. Gathman
On Wed, 08 Dec 2004 17:29:19 -0600, Greg Lindstrom wrote: > One thought I had, which might lead to an addition to the language, was > to use the struct module. If I could feed the pack method a format > string then a tuple of values (instead of individual values), then I > could create the fo

Re: Class Variable Inheritance

2004-12-08 Thread Ken Rowlands
On Wed, 08 Dec 2004 15:55:09 -0900, Brian Jones wrote: > I'm sure the solution may be obvious, but this problem is driving me > mad. The following is my code: > > class a(object): > > mastervar = [] > > def __init__(self): > print 'called a' > > class b(a): > >

Re: MP3 - VBR - Frame length in time

2004-12-08 Thread Dmitry Borisov
"Ivo Woltring" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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

Re: creating generators from function

2004-12-08 Thread Terry Reedy
"Simon Wittber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I thought the idiom: > > while True: >#code which iterates my simulation >if condition: break > > wat quite normal. This is the style loop I am using. Yes, quite normal. This is Python's version of do...until,

Re: Creating Fixed Length Records

2004-12-08 Thread Jeff Shannon
Greg Lindstrom wrote: [...] I concatenate the field to the text segment. I have been led to believe this is bad form because Python will copy the entire segment each time I add a field. Up until now, it was not a big deal because the segments had at most 20 fields. I have just been handed a r

Fw: Message vtkUser

2004-12-08 Thread Michel Audette
Hello everyone, my student had the following problem with a python program featuring multiple vtkTkRenderWidget calls. See below... Can anyone suggest a workaround? Best regards, Michel Michel Audette, Ph.D., Research Fellow, Surgical Simulation, Surgical Assist Technology Group, AIST, Namiki

Re: why python is slower than java?

2004-12-08 Thread JanC
Andrew Dalke schreef: > 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 micropayment > into place because at th

Re: Class Variable Inheritance

2004-12-08 Thread Brian \"bojo\" Jones
It became clear to me that mastervar inside of class a is a static variable, and is associated with all instances of classes that extend class a. To get around this, I implemented a seperate mapping class: class mapper: def __init__(self): self.mastermap = [] def

Re: Help beautify ugly heuristic code

2004-12-08 Thread Stuart D. Gathman
On Wed, 08 Dec 2004 19:52:53 -0500, Lonnie Princehouse wrote: > I don't think a Bayesian classifier is going to be very helpful here, > unless you have tens of thousands of examples to feed it, or unless it We do have tens of thousands of examples to feed it. > The series of if host.find(...) li

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

2004-12-08 Thread Terry Reedy
To respond to and summarize several posts in this discussion: Within a function, where the local namespace is distinct from the global (module) namespace, CPython usually implements the local namespace internally as a fixed-length array. When this is true, locals() is a *copy* of the local nam

Re: exec'ing functions (WAS: updating locals() and globals())

2004-12-08 Thread Jeff Shannon
Steven Bethard wrote: Jeff Shannon wrote: Note also that functions which use exec cannot use the static namespace optimization, and thus tend to be *much* slower than normal functions In what circumstances will this be true? I couldn't verify it: [...] exec """\ def fib2(n): a, b = 0, 1

Re: creating generators from function

2004-12-08 Thread Simon Wittber
> A function containing an infinite loop will never return, so it is bugged > and useless unless it does has an external effect with something like > 'print xxx' within the loop. I thought the idiom: while True: #code which iterates my simulation if condition: break wat quite normal. T

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

2004-12-08 Thread Bengt Richter
On Tue, 7 Dec 2004 16:44:56 -0500, Tim Peters <[EMAIL PROTECTED]> wrote: >[Tim Peters] >>> ... there's no promise anywhere, e.g., that Python will return an int >>> whenever it's physically possible to do so. > >[Bengt Richter] >> Ok, I understand the expediency of that policy, but what is now the

Re: Recursive list comprehension

2004-12-08 Thread Steven Bethard
Terry Reedy wrote: "Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Probably you want to catch a TypeError instead of an AttributeError; objects may support the iterator protocol without defining an __iter__ method: No, having an __iter__ method that returns an iter

Re: Help beautify ugly heuristic code

2004-12-08 Thread Lonnie Princehouse
I don't think a Bayesian classifier is going to be very helpful here, unless you have tens of thousands of examples to feed it, or unless it was specially coded to first break addresses into better tokens for classification (such as alphanumeric strings and numbers). The series of if host.find(...

Class Variable Inheritance

2004-12-08 Thread Brian Jones
I'm sure the solution may be obvious, but this problem is driving me mad. The following is my code: class a(object): mastervar = [] def __init__(self): print 'called a' class b(a): def __init__(self): print 'called b' self.m

exec'ing functions (WAS: updating locals() and globals())

2004-12-08 Thread Steven Bethard
Jeff Shannon wrote: Note also that functions which use exec cannot use the static namespace optimization, and thus tend to be *much* slower than normal functions In what circumstances will this be true? I couldn't verify it: > cat fib.py def fib1(n): a, b = 0, 1 while True: a, b

Re: 2D array

2004-12-08 Thread Carl Banks
I am also not here to criticize style here, but I want to point something out. Something like a[1,2] might look wrong, but it's actually parsed specially by Python to accommodate slicing of multidimensional arrays. The difference is that, inside [], you can use slicing syntax, as in a[1:2,3:4]. B

Re: Recursive list comprehension

2004-12-08 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Probably you want to catch a TypeError instead of an AttributeError; > objects may support the iterator protocol without defining an __iter__ > method: No, having an __iter__ method that returns an iterator is an es

Directory structure inside a ZipFile object

2004-12-08 Thread Bulba!
Hello everyone, I'm a newbie to Python, learning it and tried to write the script that would read file, zip it, and put in the target directory. I used ZipFile module (code below). It works nice, except the zipfile created contains the directory path of the source file -- which I do NOT want to r

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

2004-12-08 Thread Steven Bethard
Jeff Shannon wrote: (Note also that functions which use exec cannot use the static namespace optimization, and thus tend to be *much* slower than normal functions (in addition to being a huge security problem). I don't know, however, whether locals() can update the local namespace in such un-op

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] > > 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. Once I understood that that is what you are doing, it became obvious that that is what

Re: Help beautify ugly heuristic code

2004-12-08 Thread Stuart D. Gathman
On Wed, 08 Dec 2004 18:39:15 -0500, Lonnie Princehouse wrote: > Regular expressions. > > It takes a while to craft the expressions, but this will be more > elegant, more extensible, and considerably faster to compute (matching > compiled re's is fast). I'm already doing that with the rehmac rege

Re: Help beautify ugly heuristic code

2004-12-08 Thread Carlos Ribeiro
On 8 Dec 2004 15:39:15 -0800, Lonnie Princehouse <[EMAIL PROTECTED]> wrote: > Regular expressions. > > It takes a while to craft the expressions, but this will be more > elegant, more extensible, and considerably faster to compute (matching > compiled re's is fast). I think that this problem is p

Re: Why I can't launch python 2.4 final IDLE?

2004-12-08 Thread AnkyHe
I feel so sorry that I did miss the answer to the first one. And I have already resolved the problem. Thanks! Jean Brouwers wrote: This is the second time you ask the same question. Did you miss the answer to the first one? This is a known problem. More details at

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

2004-12-08 Thread Jeff Shannon
Steven Bethard wrote: I remember hearing an explanation of why locals() is not writable that had to do with something about efficiency and the call stack (or something like that)... IIRC, the function local namespace (in CPython) is kept internally as a static array, rather than as a dictionary

Re: Help beautify ugly heuristic code

2004-12-08 Thread Lonnie Princehouse
Regular expressions. It takes a while to craft the expressions, but this will be more elegant, more extensible, and considerably faster to compute (matching compiled re's is fast). Example using the top five from your function's comments: . host_patterns = [ . '^1Cust\d+\.tnt\d+\..*\.da\.uu\

Re: Help beautify ugly heuristic code

2004-12-08 Thread Stuart D. Gathman
On Wed, 08 Dec 2004 18:00:06 -0500, Mitja wrote: > On Wed, 08 Dec 2004 16:09:43 -0500, Stuart D. Gathman <[EMAIL PROTECTED]> > wrote: > >> I have a function that recognizes PTR records for dynamic IPs Here >> is the very ugly code so far. >> ... >> # examples we don't yet recognize: >> ... >

Re: 3D plotting library / OpenGL

2004-12-08 Thread Robert Kern
Andrew Dalke wrote: Robert Kern: Here are the instructions that I posted to the PythonMac mailing list a while ago: Thanks. I am able to build and install VTK as per your instructions, except that I don't see an option for Toggle VTK_USE_GL2PS on (useful for printing). Oops. Sorry. Press 't' to

Creating Fixed Length Records

2004-12-08 Thread Greg Lindstrom
Hello- I'm creating fixed-length record layouts for various record translations I need to perform. I have been using a home-grown object, "FixedLengthRecord" for about 4 years now and am very happy with it. Almost. The burr under my saddle occurs when I serialize the record. Currently, I cr

Re: a newbie question

2004-12-08 Thread Peter Hansen
chris wrote: In what directory are the preinstalled python libraries located on a Linux RH9 machine? Run python and at the prompt type "import sys" and then "sys.path". This should show you where all kinds of things are installed... If that's not what you wanted, try specifying what you mean by "p

Re: Connecting to numarray. Problem with the setup program

2004-12-08 Thread Colin J. Williams
Jean Moser wrote: 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 c

Re: 3D plotting library / OpenGL

2004-12-08 Thread Andrew Dalke
Robert Kern: > Here are the instructions that I posted to the PythonMac mailing list a > while ago: Thanks. I am able to build and install VTK as per your instructions, except that I don't see an option for > Toggle VTK_USE_GL2PS on (useful for printing). Once installed the Examples/Rendering/

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

2004-12-08 Thread Peter Hansen
Caleb Hattingh wrote: 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 writable - Do you know why this is? I really do not like guidelines like "may not work", "is unreliable" and so on. P

Re: Help beautify ugly heuristic code

2004-12-08 Thread Mitja
On Wed, 08 Dec 2004 16:09:43 -0500, Stuart D. Gathman <[EMAIL PROTECTED]> wrote: I have a function that recognizes PTR records for dynamic IPs Here is the very ugly code so far. ... # examples we don't yet recognize: ... This doesn't help much; post example of all the possible patterns you h

Re: ANNOUNCE: Ice 2.0 released

2004-12-08 Thread Michi Henning
> Does the Ice team claim any advantages to their Python bindings to > CORBA over omniORBpy (The one I am currently using). [...] > But I was wondering if there are any dynamic language > oriented improvements in ICE bindings? The Ice Python mapping is simpler than the CORBA one because Ice has a

Re: a newbie question

2004-12-08 Thread Jonel Rienton
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] jonel]$ ls /usr/lib/python2.2/ - -- I not know English well, but I know 7 computer languages. anonymous On Dec 8, 2004, at 4:38 PM, chris wrote: > In what directo

a newbie question

2004-12-08 Thread chris
In what directory are the preinstalled python libraries located on a Linux RH9 machine? -- http://mail.python.org/mailman/listinfo/python-list

How to implement autonomous timer (for FRP)?

2004-12-08 Thread Aaron Leung
Hi everyone, I want to take a shot at implementing a simple framework for functional reactive programming in Python. (It will be loosely based on a paper I read about a system called FrTime for DrScheme.) However, I'm not sure how to go about implementing certain components. One basic component

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

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: 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: 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: 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: 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: 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: [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

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: 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() > >

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: 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: 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

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 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: >

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: 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

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: 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

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: 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: 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: 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

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: 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

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: 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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

  1   2   >