Re: Async serial communication/threads sharing data

2009-03-21 Thread Hendrik van Rooyen
"Nick Timkovich" wrote: > 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

Re: pyconfig on 64-bit machines with distutils vs 32-bit legacy code

2009-03-21 Thread Martin v. Löwis
> /data/home/nwagner/local/lib/python2.5/pyport.h:734:2: #error > "LONG_BIT definition appears wrong for platform (bad gcc/glibc > config?)." > > > Can anyone offer any advice as to what I might be missing or > misunderstanding? You need to understand where the error comes from: 1. what is the

Debugger rewrite

2009-03-21 Thread rocky
Over at http://code.google.com/p/pydbgr/ is a rewrite of the pydb debugger. Not all of the features from pydb have been moved over, and the code there are some new features. Right now I'd call this alpha software, but possibly it usable as is. >From the development side, I think this will be a m

Re: Is python worth learning as a second language?

2009-03-21 Thread alex goretoy
oh yeah, your welcome. I'm just leaning, so I'm glad to help someone else learn as well. -Alex Goretoy http://www.goretoy.com > -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python worth learning as a second language?

2009-03-21 Thread alex goretoy
I think Python in general maybe slower than PHP(from what I read), but it is still fast enough for my project needs -Alex Goretoy http://www.goretoy.com -- http://mail.python.org/mailman/listinfo/python-list

python 3, subclassing TextIOWrapper.

2009-03-21 Thread lambertdw
''' A python 3 question. Presume this code is in file p.py. The program fails. $ python3 p.py ... ValueError: I/O operation on closed file. Removing the comment character to increase the stream reference count fixes the program, at the expense of an

Re: Is python worth learning as a second language?

2009-03-21 Thread Tomasz Rola
On Sat, 21 Mar 2009, alex goretoy wrote: > I really can't say too much about speed increase or decrease, it really > depends on the site and how its built, what libs are used and how they are > loaded, same thing in PHP, It would be difficult for me to same anything on > speed because of that. I b

Re: __init__ vs. __del__

2009-03-21 Thread Randy Turner
There are a number of use-cases for object "cleanup" that are not covered by a generic garbage collector... For instance, if an object is "caching" data that needs to be flushed to some persistent resource, then the GC has no idea about this. It seems to be that for complex objects, clients of

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

2009-03-21 Thread Esmail
andrew cooke wrote: Esmail wrote: just a quick data point here - <..> so you might be better spending the time improving your bash skills than doing what will be largely drudge work in a language you already know. I'll have to think about it .. at this point I know both languages about eq

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

2009-03-21 Thread Esmail
Ned Deily wrote: Perhaps the recipe for Pyline might give you some ideas on how to write python scripts that play well with other scripts. ah .. very nice .. thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__ vs. __del__

2009-03-21 Thread Albert Hopkins
On Sat, 2009-03-21 at 17:41 -0700, Randy Turner wrote: > Hi, > > > I was reading a book on Python-3 programming recently and the book > stated that, while there is an __init__ method for initializing > objects, there was a __del__ method but the __del__ method is not > guaranteed to be called whe

Re: __init__ vs. __del__

2009-03-21 Thread Paul McGuire
On Mar 21, 8:37 pm, Christian Heimes wrote: > Randy Turner wrote: > > I was reading a book on Python-3 programming recently and the book stated > > that, while there is an __init__ method for initializing objects, there was > > a __del__ method but the __del__ method is not guaranteed to be call

Re: __init__ vs. __del__

2009-03-21 Thread Christian Heimes
Randy Turner wrote: > I was reading a book on Python-3 programming recently and the book stated > that, while there is an __init__ method for initializing objects, there was a > __del__ method but the __del__ method is not guaranteed to be called when an > object is destroyed. > > If there is c

Re: PEP 3143: Standard daemon process library

2009-03-21 Thread Jean-Paul Calderone
On Sun, 22 Mar 2009 10:19:58 +1100, Ben Finney wrote: Jean-Paul Calderone writes: The biggest shortcoming seems to be a complete lack of unit tests. A full unit test suite is in the source distribution's ‘tests/’ directory. You can run it with ‘python ./setup.py test’. Of course this is

Re: Async serial communication/threads sharing data

2009-03-21 Thread Jean-Paul Calderone
On Sat, 21 Mar 2009 13:52:21 -0700 (PDT), Nick Timkovich wrote: 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

Re: __init__ vs. __del__

2009-03-21 Thread alex goretoy
__init__ is the object construction(initialization) faze __del__ is the object destruction faze, I think GC also happens, not sure -Alex Goretoy http://www.goretoy.com -- http://mail.python.org/mailman/listinfo/python-list

__init__ vs. __del__

2009-03-21 Thread Randy Turner
Hi, I was reading a book on Python-3 programming recently and the book stated that, while there is an __init__ method for initializing objects, there was a __del__ method but the __del__ method is not guaranteed to be called when an object is destroyed. If there is code in the __init__ method

Re: Is python worth learning as a second language?

2009-03-21 Thread alex goretoy
> > 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 bash. It has a lot of di

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 1:04 pm, John Nagle wrote: > 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 ot

pyconfig on 64-bit machines with distutils vs 32-bit legacy code

2009-03-21 Thread Rob Clewley
Hi, I have a problem compiling legacy C code using distutils on a colleague's 64 bit intel machine running linux. The legacy code is linked to user-generated code from python and distutils is a convenient platform independent way to call whatever compiler is available to create a DLL as a python m

Re: PEP 3143: Standard daemon process library

2009-03-21 Thread Ben Finney
Jean-Paul Calderone writes: > The biggest shortcoming seems to be a complete lack of unit tests. A full unit test suite is in the source distribution's ‘tests/’ directory. You can run it with ‘python ./setup.py test’. > A quick skim of the code suggests that part of it don't even work at > all

Re: PEP 3143: Standard daemon process library

2009-03-21 Thread Ben Finney
Floris Bruynooghe writes: > Had a quick look at the PEP and it looks very nice IMHO. Thank you. I hope you can try the implementation and report feedback on that too. > One of the things that might be interesting is keeping file > descriptors from the logging module open by default. Hmm. I see

Re: Preparing teaching materials

2009-03-21 Thread R. David Murray
"Rhodri James" wrote: > On Fri, 20 Mar 2009 11:58:18 -, 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.

Re: Async serial communication/threads sharing data

2009-03-21 Thread Scott David Daniels
Nick Timkovich wrote: 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... Ultimately, this program ... [send] messages and collecting responses for 10k-100k cycles ... Here's a s

simplejson: alternate encoder not called enought

2009-03-21 Thread Pierre Hanser
hello I'm trying to use simplejson to encode some python objects using simplejson dumps method. The dumps method accept a cls parameter to specify an alternate encoder. But it seems that this alternate encoder is called only as a last resort, if object type is not int, string, and all other basic

Re: [ANN] lxml 2.2 released

2009-03-21 Thread Stefan Behnel
pyt...@bdurham.com wrote: > 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? It would be interesting to have some more information about y

Re: Crunchy [Was: Preparing teaching materials]

2009-03-21 Thread Andre Roberge
On Sat, Mar 21, 2009 at 5:06 PM, andrew cooke wrote: > 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 wi

Re: Async serial communication/threads sharing data

2009-03-21 Thread Paul Rubin
Nick Timkovich 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 running, or is it b

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 blocking

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 typ

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 lxm

Re: Is python worth learning as a second language?

2009-03-21 Thread Tomasz Rola
On Sat, 21 Mar 2009, Aahz wrote: > In article , > Tomasz Rola 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 only

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

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

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 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! Although I suppose you could just go for the j

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+ 17301

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 = aFunc

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 "http://feed

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

Re: Preparing teaching materials

2009-03-21 Thread Rhodri James
On Fri, 20 Mar 2009 11:58:18 -, 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 real unit tests on th

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

2009-03-21 Thread Ned Deily
In article , Esmail wrote: > Aahz wrote: > > In article , > > Esmail 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 ...> > >> I've looked aro

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

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: Creating Linked Lists in Python

2009-03-21 Thread Roy Smith
In article , Tim Chase 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 becomes something like this: state = start for input in whatever: output, stat

Re: Creating Linked Lists in Python

2009-03-21 Thread grocery_stocker
On Mar 21, 10:03 am, Tim Chase 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: 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 a

Re: Creating Linked Lists in Python

2009-03-21 Thread Aaron Brady
On Mar 21, 10:47 am, grocery_stocker wrote: > On Mar 21, 6:38 am, Tim Chase 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 som

Re: pickle.load() extremely slow performance

2009-03-21 Thread Benjamin Peterson
Terry Reedy 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: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Peter Pearson
On Sat, 21 Mar 2009 09:26:02 -0400, Esmail 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. -- To email me,

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

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

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

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 10:28 am, Aaron Brady wrote: > On Mar 21, 9:50 am, "andrew cooke" wrote: > > > > > Aaron Brady wrote: > > > On Mar 21, 7:54 am, "andrew cooke" wrote: > > >> they should not be used to do things like flushing and closing > > >> files, for example. > > > What is your basis for this clai

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: How to do this in Python?

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

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

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

2009-03-21 Thread Aahz
In article , Esmail wrote: >Aahz wrote: >> In article , >> Esmail wrote: >>> >>> I've looked around the web w/o much luck for some examples but come >>> short. Any comments/suggestions? >> >> Not sure what you're looking for here -- many things you'd run an >> external program for in scriptin

Re: How to do this in Python?

2009-03-21 Thread Grant Edwards
On 2009-03-21, Josh Holland 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 kernel in P

Re: Creating Linked Lists in Python

2009-03-21 Thread grocery_stocker
On Mar 21, 8:47 am, grocery_stocker wrote: > On Mar 21, 6:38 am, Tim Chase 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 some

Re: Creating Linked Lists in Python

2009-03-21 Thread grocery_stocker
On Mar 21, 6:38 am, Tim Chase 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 changing regular expres

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

2009-03-21 Thread John Machin
On Mar 22, 2:21 am, grocery_stocker wrote: > On Mar 21, 8:11 am, John Machin wrote: > > > > > On Mar 22, 1:55 am, grocery_stocker wrote: > > > > Given the following > > > > def double(val): > > >     return val.bind(lambda x: val.return_(x*2)) > > > > I get "AttributeError: 'int' object has

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 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, > > with its

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

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 9:50 am, "andrew cooke" wrote: > Aaron Brady wrote: > > On Mar 21, 7:54 am, "andrew cooke" 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?

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

2009-03-21 Thread grocery_stocker
On Mar 21, 8:21 am, Kushal Kumaran wrote: > On Mar 21, 7:55 pm, grocery_stocker 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 >

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

2009-03-21 Thread Kushal Kumaran
On Mar 21, 7:55 pm, grocery_stocker 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) > > See the usage of the double function in

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

2009-03-21 Thread grocery_stocker
On Mar 21, 8:11 am, John Machin wrote: > On Mar 22, 1:55 am, grocery_stocker 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 >

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 loo

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 t

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

2009-03-21 Thread John Machin
On Mar 22, 1:55 am, grocery_stocker 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... > > [cdal...@local

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: 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), I

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 4.

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 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 and > moved t

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" 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 beg

Re: garbage collection / cyclic references

2009-03-21 Thread andrew cooke
Aaron Brady wrote: > On Mar 21, 7:54 am, "andrew cooke" 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? I'm not

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

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

Re: Lambda forms and scoping

2009-03-21 Thread Márcio Faustino
On Mar 20, 12:28 pm, "R. David Murray" 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 wrote: > This post http://www.artim

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

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

2009-03-21 Thread John Machin
Gilles Ganault 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 in address contexts whe

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 7:54 am, "andrew cooke" wrote: > Paul Rubin wrote: > > "andrew cooke" 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

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

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 scri

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 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 guaranteed to have Py

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

2009-03-21 Thread Esmail
Aahz wrote: In article , Esmail 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 ... I've looked around the web w/o much luck for some examples but come shor

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

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: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Aahz
In article , Esmail 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 examples but come >short. Any comments/suggestions? Not sure what you're

Re: Is python worth learning as a second language?

2009-03-21 Thread Aahz
In article , Tomasz Rola 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 only dimension of >judging the language, you know. Yo

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

(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

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

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 pre

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 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 same assumption is made

  1   2   >