Python training in Colorado, April 27-29

2009-03-21 Thread Python Training
Python author and trainer Mark Lutz will be teaching a 3-day Python class on April 27-29, in Longmont, Colorado. This is a public training session open to individual enrollments, and covers the same topics and hands-on lab work as the onsite sessions that Mark teaches. The class provides an

Re: garbage collection / cyclic references

2009-03-21 Thread Paul Rubin
andrew cooke and...@acooke.org writes: the two dominant virtual machines - .net and the jvm both handle circular references with no problem whatever. AFAIK, they also don't guarantee that finalizers ever run, much less run in deterministic order. --

Re: file.read() doesn't read the whole file

2009-03-21 Thread Sreejith K
On Mar 21, 10:54 am, R. David Murray rdmur...@bitdance.com wrote: Sreejith K sreejith...@gmail.com wrote:                                    tf.writelines(Reading from Base File\n)                                    self.file.seek(block*4096 + off%4096)                                    

Re: How complex is complex?

2009-03-21 Thread R. David Murray
Terry Reedy tjre...@udel.edu wrote: Vito De Tullio wrote: Tim Roberts wrote: bearophileh...@lycos.com wrote: In Python 3 those lines become shorter: for k, v in a.items(): {k: v+1 for k, v in a.items()} This is nonsensical. It creates and discards a complete new dict for each

Re: Compiling modules in OSX, eg PyUSB?

2009-03-21 Thread Dr Mephesto
On Mar 20, 6:23 pm, Philip Semanchuk phi...@semanchuk.com wrote: On Mar 20, 2009, at 12:36 PM, Dr Mephesto wrote: windows? well, I thought that maybe the location of the usb.h thing was relevant, and I didnt see it mentioned on the linux instructions. Oh, OK. Windows is a pretty different

Re: A problem with subprocess

2009-03-21 Thread Tim Golden
Colin J. Williams wrote: Below is a test script: # tSubProcess.py import subprocess import sys try: v= subprocess.Popen('ftype py=C:\Python25\Python.exe') except WindowsError: print(sys.exc_info()) I'm assuming that you've previously done something like this: assoc .py=py and are now

Re: Obtaining the attributes and properties of a folder recursively.

2009-03-21 Thread Tim Golden
venutaurus...@gmail.com wrote: On Mar 20, 6:58 pm, Tim Golden m...@timgolden.me.uk wrote: venutaurus...@gmail.com wrote: Thank you for your suggestion but.. I'll have around 1000 such files in the whole directory and it becomes hard to manage such output because again I've to take this

Re: improve this newbie code/nested functions in Python?

2009-03-21 Thread Paul Hankin
On Mar 20, 3:21 am, Esmail ebo...@gmail.com wrote: Hi, I'm new to writing Python code. This is a simple client I wrote, it works, but I feel it doesn't look as clean as it could. Can anyone make suggestions how to streamline this code? Also, I am using two nested functions, it seems that

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 20, 8:12 pm, andrew cooke and...@acooke.org wrote: Aaron Brady wrote: [...] caveats and fragilities?  If free software can do it, why isn't it all over the industry?  What disqualifies it from solved-problem status? the two dominant virtual machines - .net and the jvm both handle

Re: garbage collection / cyclic references

2009-03-21 Thread Martin v. Löwis
The actual backend of CPython requires garbage-collected container types to implement tp_inquiry and tp_clear methods, but user-defined types apparently aren't required to conform. tp_inquiry doesn't exist, you probably mean tp_traverse. tp_traverse is completely irrelevant for python-defined

Re: file.read() doesn't read the whole file

2009-03-21 Thread Sreejith K
The break and continue problem was actually my own mistake. I wrote no_blks = length/4096 + 1, so the loop actually executes twice. Sorry for my idiotic mistake But the read() problem still persists. Thanks.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Obtaining the attributes and properties of a folder recursively.

2009-03-21 Thread Tim Golden
venutaurus...@gmail.com wrote: Thank you Sir for your reply. It is working for me. But is failing if I have Unicode characters in my path. I tried giving a 'u' in front of the path but still it fails at f.createdat. Does it support Unicode Characters? This the traceback which I got while

Is it possible to create a shortcut ?

2009-03-21 Thread Stef Mientki
I would like to make a shortcut for this: self.Brick.Par [ self.EP[0] ] = something like this: self.P[0] = is that possible, otherwise than by eval / exec ? thanks, Stef -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: precision question

2009-03-21 Thread MRAB
Lada Kugis wrote: [snip] Normal integers are up to 10 digits, after which they become long integers, right ? But if integers can be exactly represented, then why do they need two types of integers (long and ... uhmm, let's say, normal). I mean, their error will always be zero, no matter what

Re: Is it possible to create a shortcut ?

2009-03-21 Thread Peter Otten
Stef Mientki wrote: I would like to make a shortcut for this: self.Brick.Par [ self.EP[0] ] = something like this: self.P[0] = is that possible, otherwise than by eval / exec ? class Brick(object): def __init__(self): self.Par = [1,2,3] class P(object): def

Creating Linked Lists in Python

2009-03-21 Thread J-Burns
Hey thr, I need some help here actually. So i thought i could get it easily from here. I need to make a linked list that can do the following: 1) Point to multiple nodes at one time 2) Should have 2 values: a) The node no. b) The value of that node in reference to the next node that it

Re: file.read() doesn't read the whole file

2009-03-21 Thread Steve Holden
Sreejith K wrote: The break and continue problem was actually my own mistake. I wrote no_blks = length/4096 + 1, so the loop actually executes twice. Sorry for my idiotic mistake That's good! But the read() problem still persists. Try and write an example that shows the problem in

Re: Is it possible to create a shortcut ?

2009-03-21 Thread Steven D'Aprano
On Sat, 21 Mar 2009 11:55:04 +0100, Stef Mientki wrote: I would like to make a shortcut for this: self.Brick.Par [ self.EP[0] ] = That's a pretty ugly expression there. (Mind you, I've seen worse.) And a non-standard naming convention. I'm just sayin'. When you walk your dog, do you try

Re: improve this newbie code/nested functions in Python?

2009-03-21 Thread Esmail
Paul Hankin wrote: I would decouple the speaker and the listener from the client, and make the client interface more abstract. Simple and descriptive interfaces can make code dramatically easier to understand. class ClientListener(Thread): def __init__(self, client, ...): ... def

Re: garbage collection / cyclic references

2009-03-21 Thread andrew cooke
Paul Rubin wrote: andrew cooke and...@acooke.org writes: the two dominant virtual machines - .net and the jvm both handle circular references with no problem whatever. AFAIK, they also don't guarantee that finalizers ever run, much less run in deterministic order. i think you're right, but

Re: Creating Linked Lists in Python

2009-03-21 Thread John Machin
On Mar 21, 10:38 pm, J-Burns arslanbur...@gmail.com wrote: Hey thr, I need some help here actually. So i thought i could get it easily from here. I need to make a linked list that can do the following: 1) Point to multiple nodes at one time The term linked list is usually restricted to a

Downloading binary files - Python3

2009-03-21 Thread Anders Eriksson
Hello, I have made a short program that given an url will download all referenced files on that url. It works, but I'm thinking it could use some optimization since it's very slow. I create a list of tuples where each tuple consist of the url to the file and the path to where I want to save it.

Re: Creating Linked Lists in Python

2009-03-21 Thread andrew cooke
J-Burns wrote: I need to make a linked list that can do the following: 1) Point to multiple nodes at one time 2) Should have 2 values: a) The node no. b) The value of that node in reference to the next node that it is pointing to For example, this means that there can be a start

Re: Creating Linked Lists in Python

2009-03-21 Thread andrew cooke
andrew cooke wrote: [...] i messed up my example; corrected below (I hope) in your case you could use ints for the nodes and a dict([int]) for the graph. so: {1: [2,3], 2: [1,3], 3: [3]} is a graph in which 1 and 2 are connected in each direction, both 1 and 2 are linked to 3, and 3 has a

Re: Creating Linked Lists in Python

2009-03-21 Thread Aaron Brady
On Mar 21, 8:11 am, andrew cooke and...@acooke.org wrote: J-Burns wrote: snip For example, this means that there can be a start node supposedly. Having a value of 0. It is pointing to node 1 with the value of a and to node 2 with the value of b. Trying to make something like an NFA. Where

script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
Hello all, I am wondering if anyone is using python to write script files? Right now I have a bigg'ish bash/tcsh script that contain some grep/awk command plus various files are processed and created, renamed and moved to specific directories. I also write out some gnuplot scripts that later

R6034 -- 0.9.1 -- problems installing under XP

2009-03-21 Thread Esmail
I apologize if this is a duplicate, been having lots of problems posting to this group. --- Hello all, I am having problems trying installing iPython under XP. It works great under Linux and it would be great if I could also use it when I have to be in Windows. XP Professional SP2 + SP3

Re: Compiling modules in OSX, eg PyUSB?

2009-03-21 Thread Philip Semanchuk
On Mar 21, 2009, at 2:49 AM, Dr Mephesto wrote: On Mar 20, 6:23 pm, Philip Semanchuk phi...@semanchuk.com wrote: So change line 32 in the PyUSB setup.py from this: extra_compile_args = ['-I/sw/include'] to this: extra_compile_args = ['-I/sw/include', '-I/usr/local/include'] The

Re: Creating Linked Lists in Python

2009-03-21 Thread Tim Chase
For example, this means that there can be a start node supposedly. Having a value of 0. It is pointing to node 1 with the value of a and to node 2 with the value of b. Trying to make something like an NFA. Where id be changing regular expressions to NFAs. John has already pointed out the

Re: speech recognition help

2009-03-21 Thread Murali kumar
thanks for the reply.. now working on cmu sphinx project.. do u know which one 1. cmu sphinx 2. natural speaking 3. windows sapi is best ( in accuray and speed ) for predefined vocabulary.. and worth for learning as well.? -- http://mail.python.org/mailman/listinfo/python-list

(SORRY .. )Re: R6034 -- 0.9.1 -- problems installing under XP

2009-03-21 Thread Esmail
Argh .. sorry about this post I was trying to post to gmane.comp.python.ipython.user (but it's not working), this was an accident - I didn't mean to send it here (wrong screen). Sorry about this. Esmail -- http://mail.python.org/mailman/listinfo/python-list

[regex] How to check for non-space character?

2009-03-21 Thread Gilles Ganault
Hello Some of the adresses are missing a space between the streetname and the ZIP code, eg. 123 Main Street01159 Someville The following regex doesn't seem to work: #Check for any non-space before a five-digit number re_bad_address = re.compile('([^\s].)(\d{5}) ',re.I | re.S | re.M) I also

Re: Is python worth learning as a second language?

2009-03-21 Thread Aahz
In article pine.lnx.4.64.0903210534130.6...@tau.ceti.pl, Tomasz Rola rto...@ceti.com.pl wrote: On Sat, 20 Mar 2009, Aahz wrote: Taking C++ and turning it into a VM model does not exactly strike me as particularly good use of resources. It doesn't strike me either. But resources are not the

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Aahz
In article mailman.2374.1237641982.11746.python-l...@python.org, Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? These days, I always convert any even slightly complicated script to Python. I've looked around the web w/o much luck for some

Re: [regex] How to check for non-space character?

2009-03-21 Thread Tim Chase
Gilles Ganault wrote: Hello Some of the adresses are missing a space between the streetname and the ZIP code, eg. 123 Main Street01159 Someville The following regex doesn't seem to work: #Check for any non-space before a five-digit number re_bad_address = re.compile('([^\s].)(\d{5}) ',re.I |

Re: argument problem in optparse

2009-03-21 Thread Neal Becker
Qian Xu wrote: Hi All, I have a problem with OptParse. I want to define such an arugument. It can accept additional value or no value. myscript.py --unittest File1,File2 myscript.py --unittest Is it possible in OptParse? I have tried several combination. But ... Best regards

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
Aahz wrote: In article mailman.2374.1237641982.11746.python-l...@python.org, Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? These days, I always convert any even slightly complicated script to Python. well .. that sounds encouraging ...

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Joe Riopel
On Sat, Mar 21, 2009 at 9:26 AM, Esmail ebo...@hotmail.com wrote: In any case, the scripts are starting to look pretty hairy and I was wondering if it would make sense to re-write them in Python. I am not sure how suitable it would be for this. Are these scripts run on computers that are

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
Hi Joe, Joe Riopel wrote: Are these scripts run on computers that are guaranteed to have Python installed? If not, can you install Python on them? I use Python when I can, but sometimes shell scripts just makes sense. T Yes. Currently I am running the bash/tcsh scripts under Ubuntu. The

Re: speech recognition help

2009-03-21 Thread Tim Chase
do u know which one 1. cmu sphinx 2. natural speaking 3. windows sapi is best ( in accuray and speed ) for predefined vocabulary.. and worth for learning as well.? For a pre-defined vocabulary, they should all be pretty good. In general (for non-predefined vocabularies), I've heard that NS

Re: speech recognition help

2009-03-21 Thread Tim Chase
Murali kumar wrote: thanks for the reply.. now working on cmu sphinx project.. do u know which one 1. cmu sphinx 2. natural speaking 3. windows sapi is best ( in accuray and speed ) ^^^ Typo of the week... -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: argument problem in optparse

2009-03-21 Thread Qian Xu
John O'Hagan wrote: action=callback, callback=my_callback it works perfect. You made my day and thank you both ^^) -- http://mail.python.org/mailman/listinfo/python-list

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 7:54 am, andrew cooke and...@acooke.org wrote: Paul Rubin wrote: andrew cooke and...@acooke.org writes: the two dominant virtual machines - .net and the jvm both handle circular references with no problem whatever. AFAIK, they also don't guarantee that finalizers ever run,

Re: [regex] How to check for non-space character?

2009-03-21 Thread John Machin
Gilles Ganault nospam at nospam.com writes: Hello Some of the adresses are missing a space between the streetname and the ZIP code, eg. 123 Main Street01159 Someville This problem appears very similar to the one you had in a previous episode, where you were deleting br / in address

Re: Downloading binary files - Python3

2009-03-21 Thread Matteo
srcdata = urlopen(url).read() dstfile = open(path,mode='wb') dstfile.write(srcdata) dstfile.close() print(Done!) Have you tried reading all files first, then saving each one on the appropriate directory? It might work if you have enough memory, i.e. if

Re: Lambda forms and scoping

2009-03-21 Thread Márcio Faustino
On Mar 20, 12:28 pm, R. David Murray rdmur...@bitdance.com wrote: Hope this helps.  I find that thinking in terms of namespaces helps me understand how Python works better than any other mental model I've come across. It does, thanks. On Mar 20, 12:41 pm, Michele Simionato

Re: Creating Linked Lists in Python

2009-03-21 Thread Giuliano Vilela
I've done something similar on the past week, regarding RE's and NFA's: http://code.google.com/p/yaree/ The significant code is on re_fsa.py, on the svn repository. The implementation is also a dict, of the form: { Node - { Character - Set(Node) } }. That is, it is a mapping of Node's to a

python php/html file upload issue

2009-03-21 Thread S.Selvam Siva
Hi all, I want to upload a file from python to php/html form using urllib2,and my code is below PYTHON CODE: import urllib import urllib2,sys,traceback url='http://localhost/index2.php' values={} f=open('addons.xcu','r') values['datafile']=f.read() #is this correct ? values['Submit']='True' data

Re: Downloading binary files - Python3

2009-03-21 Thread Peter Otten
Anders Eriksson wrote: Hello, I have made a short program that given an url will download all referenced files on that url. It works, but I'm thinking it could use some optimization since it's very slow. I create a list of tuples where each tuple consist of the url to the file and

Re: garbage collection / cyclic references

2009-03-21 Thread andrew cooke
Aaron Brady wrote: On Mar 21, 7:54 am, andrew cooke and...@acooke.org wrote: they should not be used to do things like flushing and closing files, for example. What is your basis for this claim, if it's not the mere unreliability of finalization? IOW, are you not merely begging the question?

Re: garbage collection / cyclic references

2009-03-21 Thread andrew cooke
andrew cooke wrote: Aaron Brady wrote: On Mar 21, 7:54 am, andrew cooke and...@acooke.org wrote: they should not be used to do things like flushing and closing files, for example. What is your basis for this claim, if it's not the mere unreliability of finalization? IOW, are you not merely

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread D'Arcy J.M. Cain
On Sat, 21 Mar 2009 09:26:02 -0400 Esmail ebo...@hotmail.com wrote: Hello all, I am wondering if anyone is using python to write script files? All the time. Right now I have a bigg'ish bash/tcsh script that contain some grep/awk command plus various files are processed and created, renamed

How do I call the double() function?

2009-03-21 Thread grocery_stocker
Given the following def double(val): return val.bind(lambda x: val.return_(x*2)) I get AttributeError: 'int' object has no attribute 'bind' when I try to do the following double(2) Below is the output... [cdal...@localhost ~]$ python Python 2.4.3 (#1, Oct 1 2006, 18:00:19) [GCC

Re: speech recognition help

2009-03-21 Thread Stef Mientki
Tim Chase wrote: do u know which one 1. cmu sphinx 2. natural speaking 3. windows sapi is best ( in accuray and speed ) for predefined vocabulary.. and worth for learning as well.? For a pre-defined vocabulary, they should all be pretty good. In general (for non-predefined vocabularies),

Re: Tkinter book on current versions

2009-03-21 Thread W. eWatson
Paul Watson wrote: Has anyone tried the Grayson book, Python and Tkinter Programming, with a recent version of Python? The first example code (calculator) generates a single row of buttons. Perhaps I have not applied the errata correctly. Has anyone been successful? I am using: Python 2.5.2

Re: How do I call the double() function?

2009-03-21 Thread John Machin
On Mar 22, 1:55 am, grocery_stocker cdal...@gmail.com wrote: Given the following def double(val):     return val.bind(lambda x: val.return_(x*2)) I get AttributeError: 'int' object has no attribute 'bind' when I try to do the following double(2) Below is the output...

Re: Downloading binary files - Python3

2009-03-21 Thread Stefan Behnel
Anders Eriksson wrote: I have made a short program that given an url will download all referenced files on that url. It works, but I'm thinking it could use some optimization since it's very slow. What's slow about it? Is downloading each file slow, is it the overhead of connecting to the

Re: How to do this in Python?

2009-03-21 Thread Josh Holland
On Tue, Mar 17, 2009 at 08:00:51PM -0500, Jim Garrison wrote: There's always some trollish behavior in any comp.lang.* group. Too many people treat languages as religions instead of tools. They all have strengths and weaknesses :-) If you're referring to my reply (about his pseudocode looking

Re: How do I call the double() function?

2009-03-21 Thread grocery_stocker
On Mar 21, 8:11 am, John Machin sjmac...@lexicon.net wrote: On Mar 22, 1:55 am, grocery_stocker cdal...@gmail.com wrote: Given the following def double(val): return val.bind(lambda x: val.return_(x*2)) I get AttributeError: 'int' object has no attribute 'bind' when I try

Re: How do I call the double() function?

2009-03-21 Thread Kushal Kumaran
On Mar 21, 7:55 pm, grocery_stocker cdal...@gmail.com wrote: Given the following def double(val):     return val.bind(lambda x: val.return_(x*2)) I get AttributeError: 'int' object has no attribute 'bind' when I try to do the following double(2) snipped See the usage of the double

Re: How do I call the double() function?

2009-03-21 Thread grocery_stocker
On Mar 21, 8:21 am, Kushal Kumaran kushal.kuma...@gmail.com wrote: On Mar 21, 7:55 pm, grocery_stocker cdal...@gmail.com wrote: Given the following def double(val): return val.bind(lambda x: val.return_(x*2)) I get AttributeError: 'int' object has no attribute 'bind' when I

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 9:50 am, andrew cooke and...@acooke.org wrote: Aaron Brady wrote: On Mar 21, 7:54 am, andrew cooke and...@acooke.org wrote: they should not be used to do things like flushing and closing files, for example. What is your basis for this claim, if it's not the mere unreliability

Re: Is it possible to create a shortcut ?

2009-03-21 Thread Stef Mientki
Steven D'Aprano wrote: On Sat, 21 Mar 2009 11:55:04 +0100, Stef Mientki wrote: I would like to make a shortcut for this: self.Brick.Par [ self.EP[0] ] = That's a pretty ugly expression there. (Mind you, I've seen worse.) And a non-standard naming convention. I'm just sayin'.

Re: meta question - how to read comp.lang.python w/o usenet feed/google interface?

2009-03-21 Thread kshitij
On Mar 21, 2:17 am, Esmail ebo...@hottymail.com wrote: Terry Reedy wrote: Ditto, with T-bird. Just add a newsgroup account with news.gmane.org or snews.gmane.org (for ssl) as the server and set the rest as you please. gmane.comp.python.general is a mirror of python-list, from python.org,

Re: How do I call the double() function?

2009-03-21 Thread John Machin
On Mar 22, 2:21 am, grocery_stocker cdal...@gmail.com wrote: On Mar 21, 8:11 am, John Machin sjmac...@lexicon.net wrote: On Mar 22, 1:55 am, grocery_stocker cdal...@gmail.com wrote: Given the following def double(val):     return val.bind(lambda x: val.return_(x*2)) I get

Re: Downloading binary files - Python3

2009-03-21 Thread MRAB
Matteo wrote: srcdata = urlopen(url).read() dstfile = open(path,mode='wb') dstfile.write(srcdata) dstfile.close() print(Done!) Have you tried reading all files first, then saving each one on the appropriate directory? It might work if you have enough

Re: Creating Linked Lists in Python

2009-03-21 Thread grocery_stocker
On Mar 21, 6:38 am, Tim Chase python.l...@tim.thechases.com wrote: For example, this means that there can be a start node supposedly. Having a value of 0. It is pointing to node 1 with the value of a and to node 2 with the value of b. Trying to make something like an NFA. Where id be

Re: Creating Linked Lists in Python

2009-03-21 Thread grocery_stocker
On Mar 21, 8:47 am, grocery_stocker cdal...@gmail.com wrote: On Mar 21, 6:38 am, Tim Chase python.l...@tim.thechases.com wrote: For example, this means that there can be a start node supposedly. Having a value of 0. It is pointing to node 1 with the value of a and to node 2 with the

Re: How to do this in Python?

2009-03-21 Thread Grant Edwards
On 2009-03-21, Josh Holland j...@joshh.co.uk wrote: If you're referring to my reply (about his pseudocode looking like C), I hope you realise that it was tongue-in-cheek. For the record, I intend to learn C in the near future and know it is a very powerful language. How people would write a

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Aahz
In article mailman.2384.1237643720.11746.python-l...@python.org, Esmail ebo...@hotmail.com wrote: Aahz wrote: In article mailman.2374.1237641982.11746.python-l...@python.org, Esmail ebo...@hotmail.com wrote: I've looked around the web w/o much luck for some examples but come short. Any

Re: cross compile Python to Linux-ARM

2009-03-21 Thread David Boddie
On Thursday 19 March 2009 17:54, jefm wrote: We are looking to use Python on an embedded Linux ARM system. What I gather from googling the subject is that it is not that straight forward (a fair amount of patching hacking). Nobody out there that has done it claims it is easy, which makes me

Re: How to do this in Python?

2009-03-21 Thread Josh Holland
Sorry, I meant to write How *many* people ... -- Josh Holland j...@joshh.co.uk http://joshh.co.uk madmartian on irc.freenode.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Preparing teaching materials

2009-03-21 Thread grkuntzmd
Very nice. I printed out the PDF manual for sphinx. I'll take a look at it. -- http://mail.python.org/mailman/listinfo/python-list

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 10:28 am, Aaron Brady castiro...@gmail.com wrote: On Mar 21, 9:50 am, andrew cooke and...@acooke.org wrote: Aaron Brady wrote: On Mar 21, 7:54 am, andrew cooke and...@acooke.org wrote: they should not be used to do things like flushing and closing files, for example.

[ANN] lxml 2.2 released

2009-03-21 Thread Stefan Behnel
Hi all, I'm proud to announce the release of lxml 2.2 final. http://codespeak.net/lxml/ http://pypi.python.org/pypi/lxml/2.2 Changelog: http://codespeak.net/lxml/changes-2.2.html What is lxml? == lxml is the most feature-rich and easy-to-use library for working with XML and HTML

Re: How to do this in Python?

2009-03-21 Thread JanC
Josh Holland wrote: How people would write a kernel in Python? Like this: http://code.google.com/p/cleese/wiki/CleeseArchitecturehttp://code.google.com/p/cleese/ ? -- JanC -- http://mail.python.org/mailman/listinfo/python-list

Re: garbage collection / cyclic references

2009-03-21 Thread andrew cooke
Aaron Brady wrote: My point is, that garbage collection is able to detect when there are no program-reachable references to an object. Why not notify the programmer (the programmer's objects) when that happens? If the object does still have other unreachable references, s/he should be

Re: Creating Linked Lists in Python

2009-03-21 Thread Tim Chase
transitions = { # values are tuples of (newstate, transition_function) STATE_A: [ (STATE_B, lambda x: x 5), (STATE_C, lambda x: x 10), (STATE_D, lambda x: x 100), ], STATE_B: [ (STATE_A, lambda x: x 5), (STATE_C, lambda x: x 10),

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Peter Pearson
On Sat, 21 Mar 2009 09:26:02 -0400, Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? If it can be done in a few simple lines of shell script, fine: make it a shell script. But if it's more complex than that, Python is clearer. Just my two cents.

Re: pickle.load() extremely slow performance

2009-03-21 Thread Benjamin Peterson
Terry Reedy tjreedy at udel.edu writes: 3.1a1 is out and I believe it has the io improvements. Massive ones, too. It'd be interesting to see your results on the alpha. -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating Linked Lists in Python

2009-03-21 Thread Aaron Brady
On Mar 21, 10:47 am, grocery_stocker cdal...@gmail.com wrote: On Mar 21, 6:38 am, Tim Chase python.l...@tim.thechases.com wrote: For example, this means that there can be a start node supposedly. Having a value of 0. It is pointing to node 1 with the value of a and to node 2 with the

Re: garbage collection / cyclic references

2009-03-21 Thread John Nagle
Aaron Brady wrote: Hello, I was reading and Googling about garbage collection, reference counting, and the problem of cyclic references. Python's garbage collection module claims to be able to detect and break cyclic garbage. Some other languages merely prohibit it. Is this the place to ask

Re: Creating Linked Lists in Python

2009-03-21 Thread grocery_stocker
On Mar 21, 10:03 am, Tim Chase python.l...@tim.thechases.com wrote: transitions = { # values are tuples of (newstate, transition_function) STATE_A: [ (STATE_B, lambda x: x 5), (STATE_C, lambda x: x 10), (STATE_D, lambda x: x 100), ],

Re: Creating Linked Lists in Python

2009-03-21 Thread Roy Smith
In article mailman.2379.1237642733.11746.python-l...@python.org, Tim Chase python.l...@tim.thechases.com wrote: In the past, I've done NFA with a state machine: What I've done at times is have each state be a function. The function returns an (output, next_state) tuple, and the main loop

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
Aahz wrote: If you post a sample script you're trying to convert, you may get some responses that show how different people would write it in Python. That's a nice suggestion .. I may end up doing this after I do some readings, just wanted to make sure this is not too outlandish of an idea

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
Peter Pearson wrote: On Sat, 21 Mar 2009 09:26:02 -0400, Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? If it can be done in a few simple lines of shell script, fine: make it a shell script. But if it's more complex than that, Python is

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Ned Deily
In article gq2rjc$j...@ger.gmane.org, Esmail ebo...@hotmail.com wrote: Aahz wrote: In article mailman.2374.1237641982.11746.python-l...@python.org, Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? These days, I always convert any even

Re: Preparing teaching materials

2009-03-21 Thread Rhodri James
On Fri, 20 Mar 2009 11:58:18 -, grkunt...@gmail.com wrote: I am considering teaching a beginning programming course using Python. I would like to prepare my class handouts in such a way that I can import the Python code from real .py files directly into the documents. This way I can run

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread andrew cooke
Esmail wrote: Peter Pearson wrote: On Sat, 21 Mar 2009 09:26:02 -0400, Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? If it can be done in a few simple lines of shell script, fine: make it a shell script. But if it's more complex than that,

RSS feed issues, or how to read each item exactly once

2009-03-21 Thread John Nagle
I've been using the feedparser module, and it turns out that some RSS feeds don't quite do RSS right. For the Reuters RSS feed, about once every fifteen minutes, the Etag changes, even if there are no new stories. I've been logging this in a program of mine: WARNING: Feed

Re: Another of those is issues.

2009-03-21 Thread Bruno Desthuilliers
Emanuele D'Arrigo a écrit : Hi everybody, I was unit testing some code today and I eventually stumbled on one of those is issues quickly solved replacing the is with ==. Still, I don't quite see the sense of why these two cases are different: def aFunction(): ... pass ... f = aFunction

Re: Organize large DNA txt files

2009-03-21 Thread andrew cooke
a faster and simpler solution, assuming you are on unix, is to just use the sort command: spl6 tmp: cat 1- 1740060 1780040 1890002 spl6 tmp: cat 1+ 1730

Re: Is python worth learning as a second language?

2009-03-21 Thread Bruno Desthuilliers
Aahz a écrit : In article 49b5196b$0$3514$426a7...@news.free.fr, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Grant Edwards a écrit : Knowing C++ does tend to be a bit of a handicap, but I think any competent programmer could learn Python. +2 QOTW !-) Ditto!

Crunchy [Was: Preparing teaching materials]

2009-03-21 Thread andrew cooke
André wrote: If I may suggest a very different alternative than the ones already suggested: use Crunchy. (http://code.google.com/p/crunchy) You can have you handouts (html or reStructuredText documents) live on the web with all your code samples executable from within Firefox. If you don't

Re: Another of those is issues.

2009-03-21 Thread Martin v. Löwis
m is c.myMethod False --- What? Why is that? I think nobody has said this plainly yet (although Terry points it out also): You cannot rely that foo.bar is foo.bar for any object foo and any attribute bar. In some cases, that relation may hold, in other cases, it may not. It depends on

Re: Is python worth learning as a second language?

2009-03-21 Thread Tomasz Rola
On Sat, 21 Mar 2009, Aahz wrote: In article pine.lnx.4.64.0903210534130.6...@tau.ceti.pl, Tomasz Rola rto...@ceti.com.pl wrote: On Sat, 20 Mar 2009, Aahz wrote: Taking C++ and turning it into a VM model does not exactly strike me as particularly good use of resources. It doesn't

Re: [ANN] lxml 2.2 released

2009-03-21 Thread python
Stefan, Is it possible to use the same install of lxml across multiple versions of Python, eg. I have 2.4, 2.5, 2.6, and 3.0 installed on my workstation - can I use a single copy of lmxl for 4 versions of Python? My understanding is that we can replace our use of elmentree and htmlparser with

Re: Is python worth learning as a second language?

2009-03-21 Thread Tomasz Rola
On Fri, 20 Mar 2009, alex goretoy wrote: I've only read he subject and a few lines from other responses. yes, it is worth learning. I came from PHP to Python. It's very powerful and makes application development easier for me than in PHP and/or C#, but bash, well that depends on the type of

Async serial communication/threads sharing data

2009-03-21 Thread Nick Timkovich
I've been working on a program that will talk to an embedded device over the serial port, using some basic binary communications with messages 4-10 bytes long or so. Most of the nuts and bolts problems I've been able to solve, and have learned a little about the threading library to avoid

Re: Async serial communication/threads sharing data

2009-03-21 Thread Paul Rubin
Nick Timkovich prometheus...@gmail.com writes: My main issue is with how to exchange data between different threads; can I just do something like have a global list of messages, appending, modifying, and removing as needed? Does the threading.Lock object just prevent every other thread from

  1   2   >