Re: A problem with subprocess

2009-03-20 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 t

Re: Compiling modules in OSX, eg PyUSB?

2009-03-20 Thread Dr Mephesto
On Mar 20, 6:23 pm, Philip Semanchuk 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 animal from

Re: How complex is complex?

2009-03-20 Thread R. David Murray
Terry Reedy 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 f

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

2009-03-20 Thread Sreejith K
On Mar 21, 10:54 am, "R. David Murray" wrote: > Sreejith K wrote: > >                                    tf.writelines("Reading from Base File\n") > >                                    self.file.seek(block*4096 + off%4096) > >                                    bend = 4096-(off%4096) > >        

Re: garbage collection / cyclic references

2009-03-20 Thread Paul Rubin
"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 in deterministic order. -- http://mail.python.org/mailman/listinfo/python-list

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

2009-03-20 Thread R. David Murray
Sreejith K wrote: > tf.writelines("Reading from Base > File\n") > self.file.seek(block*4096 + off%4096) > bend = 4096-(off%4096) > if length-bend

Tkinter--Column Alignment in a Dialog

2009-03-20 Thread W. eWatson
The code below produces: Label title frame lat/long fields in a frame Label x,y label fields in a frame Standard OK-Cancel buttons How do I fix it so the lat/long left most field lines up with the x,y left most field? That is, I get something like: Lat: BOX Long: BOX pixel-x: BOX pixel-y:

Re: Ordered Sets

2009-03-20 Thread Raymond Hettinger
[Terry Reedy] > I think the idea was 2 weakrefs and 1 normal ref instead of 3 normal refs. Right. Here's a link to a weakref version (though I think the previous __del__ version also does the trick): http://code.activestate.com/recipes/576696/ Raymond -- http://mail.python.org/mailman/lis

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

2009-03-20 Thread Sreejith K
class MedusaFile(object): def __init__(self, path, flags, *mode): global METHOD global NORMAL global SNAP global FRESH_SNAP self.path = path

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

2009-03-20 Thread Sreejith K
On Mar 21, 12:58 am, I V wrote: > On Fri, 20 Mar 2009 07:03:35 -0700, Sreejith K wrote: > > I'm using the above codes in a pthon-fuse's file class's read function. > > The offset and length are 0 and 4096 respectively for my test inputs. > > When I open a file and read the 4096 bytes from offset,

Re: newbie: precision question

2009-03-20 Thread Mensanator
On Mar 20, 11:02�pm, Lada Kugis wrote: > On 21 Mar 2009 03:34:18 GMT, Steven D'Aprano > > wrote: > > Hello Steven, > thanks for answering on such short notice, > > > > >Floats in Python don't have infinite precision. > > >Ints (or longs) can have infinite precision. Try calculating (say) > >12345

Re: Is python worth learning as a second language?

2009-03-20 Thread Tomasz Rola
On Sat, 20 Mar 2009, Aahz wrote: > --===0836317661== > > So? By the time Java was released, Python had already been around for > several years. I've started to use Python around 1.5. If it could interest me more than Java earlier than that, I don't know. > Taking C++ and turning

Re: Ordered Sets

2009-03-20 Thread Terry Reedy
Steven D'Aprano wrote: On Fri, 20 Mar 2009 11:50:28 -0700, Scott David Daniels wrote: Raymond Hettinger wrote: [Aahz] The doubly-linked list part is what's sick and perverted. The doubly-linked list part is what gives it big-oh running times the same as regular sets. If the underlying seque

Re: pickle.load() extremely slow performance

2009-03-20 Thread Terry Reedy
Carl Banks wrote: The slow performance is most likely due to the poor performance of Python 3's IO, which is caused by (among other things) bad buffering strategy. It's a Python 3 growing pain, and is being rewritten. Python 3.1 should be must faster but it's not been released yet. 3.1a1 is o

Re: newbie: precision question

2009-03-20 Thread Lada Kugis
On 21 Mar 2009 03:34:18 GMT, Steven D'Aprano wrote: Hello Steven, thanks for answering on such short notice, > >Floats in Python don't have infinite precision. > >Ints (or longs) can have infinite precision. Try calculating (say) >1234567**315*24689 and you should get 1923 digits. By the way, yo

Re: newbie: precision question

2009-03-20 Thread AggieDan04
On Mar 20, 10:12 pm, Lada Kugis wrote: > I'm a newbie learning python, so forgive for, what may seem to some, > like a stupid question. > > I understand the basic integer and fp type, but what I'm having a > little trouble are the long type An "int" is limited to 32 or 64 bits. A "long" can be a

Re: Is python worth learning as a second language?

2009-03-20 Thread Aahz
In article , Tomasz Rola wrote: >On Thu, 19 Mar 2009, Aahz wrote: >> In article <49b58b35$0$3548$426a7...@news.free.fr>, >> Bruno Desthuilliers wrote: >>>Tomasz Rola a écrit : I may not be objective (tried Java, hated it after 6 years). >>> >>>Arf - only took me 6 months !-) >> >> Th

Re: Ordered Sets

2009-03-20 Thread Steven D'Aprano
On Fri, 20 Mar 2009 11:50:28 -0700, Scott David Daniels wrote: > Raymond Hettinger wrote: >> [Aahz] >>> The doubly-linked list part is what's sick and perverted. >> >> The doubly-linked list part is what gives it big-oh running times the >> same as regular sets. If the underlying sequence is sto

Re: newbie: precision question

2009-03-20 Thread Steve Holden
Lada Kugis wrote: > I'm a newbie learning python, so forgive for, what may seem to some, > like a stupid question. > > I understand the basic integer and fp type, but what I'm having a > little trouble are the long type and infinite precision type. > Longs are essentially unbounded integers. You

Re: Safe to call Py_Initialize() frequently?

2009-03-20 Thread roschler
On Mar 20, 7:27 pm, Mark Hammond wrote: > On 21/03/2009 4:20 AM, roschler wrote: > > Calling Py_Initialize() multiple times has no effect.  Calling > Py_Initialize and Py_Finalize multiple times does leak (Python 3 has > mechanisms so this need to always be true in the future, but it is true > now

Re: Is there any library for COREL or ILLUSTRATOR?

2009-03-20 Thread JanC
alejandro wrote: > I need to import cdr files to python and just make some calculations > (surface size of some objects, perimeters..) > Don't need to show them or manipulate with them... See http://sk1project.org/ Sk1 is a vector drawing program written in Python & they have libraries to read

Re: newbie: precision question

2009-03-20 Thread Steven D'Aprano
On Sat, 21 Mar 2009 04:12:48 +0100, Lada Kugis wrote: > I'm a newbie learning python, so forgive for, what may seem to some, > like a stupid question. > > I understand the basic integer and fp type, but what I'm having a little > trouble are the long type and infinite precision type. > > Also, w

Re: newbie: precision question

2009-03-20 Thread Paul Watson
On Sat, 2009-03-21 at 04:12 +0100, Lada Kugis wrote: > I'm a newbie learning python, so forgive for, what may seem to some, > like a stupid question. > > I understand the basic integer and fp type, but what I'm having a > little trouble are the long type and infinite precision type. > > Also, whe

Re: cross compile Python to Linux-ARM

2009-03-20 Thread Tomasz Rola
On Thu, 19 Mar 2009, jefm wrote: > Hi, > 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: Is python worth learning as a second language?

2009-03-20 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 diffent ways you can use

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

2009-03-20 Thread venutaurus...@gmail.com
On Mar 20, 6:58 pm, Tim Golden 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 snapshot before backing up the data > > and have

Re: parser module and doc

2009-03-20 Thread Steven D'Aprano
On Fri, 20 Mar 2009 01:19:38 -0700, Mark Dickinson wrote: > On Mar 20, 7:26 am, Steven D'Aprano cybersource.com.au> wrote: >> "All source files mentioned here which are not part of the Python >> installation are located in the Demo/parser/ directory of the >> distribution." >> >> http://docs.pyth

Re: newbie: precision question

2009-03-20 Thread alex goretoy
I think you are looking for this: >>> (math.pi - (math.sqrt(math.pi)))**2 1.8745410610157363 >>> simple, multiplication and division have a higher precedence over addition and subtraction -Alex Goretoy http://www.goretoy.com -- http://mail.python.org/mailman/listinfo/python-list

Re: cross compile Python to Linux-ARM

2009-03-20 Thread JanC
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 > worried. [...] > What would

Tkinter book on current versions

2009-03-20 Thread Paul Watson
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 (r252:60911, Dec 1

newbie: precision question

2009-03-20 Thread Lada Kugis
I'm a newbie learning python, so forgive for, what may seem to some, like a stupid question. I understand the basic integer and fp type, but what I'm having a little trouble are the long type and infinite precision type. Also, when I do >>> math.pi - (math.sqrt(math.pi))**2. I get >>>4.4408920

Re: Preparing teaching materials

2009-03-20 Thread André
On Mar 20, 8:58 am, 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 real unit tes

Re: what is the python version that NASA using?

2009-03-20 Thread Armin
On Friday 20 March 2009 23:34:18 kyoguan wrote: > Do you know what is the python version that NASA using? > > I want to know how frequently that they would upgrade the python version. > > -- > http://mail.python.org/mailman/listinfo/python-list I don't think they would upgrade it so often. maybe

Re: Smalltalk-like Python IDE ?

2009-03-20 Thread Steve Holden
andrew cooke wrote: > Steve Ferg wrote: >> I'd suggest looking at Komodo IDE > > I'm curious - is that at all like Smalltalk's environment? I always had > the impression it was just like a "standard" IDE (Eclipse, Visual Studio, > etc). Is it normal (or even possible), for example, to modify Kom

Re: pickle.load() extremely slow performance

2009-03-20 Thread bearophileHUGS
Carl Banks: > The slow performance is most likely due to the poor performance of > Python 3's IO, which is caused by [...] My suggestion for the Original Poster is just to try using Python 2.x, if possible :-) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python worth learning as a second language?

2009-03-20 Thread Tomasz Rola
On Thu, 19 Mar 2009, Aahz wrote: > --===0027953262== > > In article <49b58b35$0$3548$426a7...@news.free.fr>, > Bruno Desthuilliers wrote: > >Tomasz Rola a écrit : > >> > >> I may not be objective (tried Java, hated it after 6 years). > > > >Arf - only took me 6 months !-) > > That

Re: argument problem in optparse

2009-03-20 Thread John O'Hagan
On Fri, 20 Mar 2009, 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.

what is the python version that NASA using?

2009-03-20 Thread kyoguan
Do you know what is the python version that NASA using? I want to know how frequently that they would upgrade the python version. -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle.load() extremely slow performance

2009-03-20 Thread Carl Banks
On Mar 20, 5:26 pm, Jim Garrison wrote: > John Machin wrote: > > On Mar 21, 9:25 am, Jim Garrison wrote: > >> I'm converting a Perl system to Python, and have run into a severe > >> performance problem with pickle. > > >> One facet of the system involves scanning and loading into memory a > >> co

Re: File Compare with difflib.context_diff

2009-03-20 Thread JanC
JohnV wrote: > I have a txt file that gets appended with data over a time event. The > data comes from an RFID reader and is dumped to the file by the RFID > software. I want to poll that file several times over the time period > of the event to capture the current data in the RFID reader. > > W

Re: A problem with subprocess

2009-03-20 Thread Albert Hopkins
On Fri, 2009-03-20 at 22:14 -0400, 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()) > > Here is the output: > > *** P

Re: Lambda forms and scoping

2009-03-20 Thread alex goretoy
i looks at lambdas as unbound functions(or super function), in the case above we create the functions in a list places it in memory unboud, once binding a call to the memory address space it returns the value it is basically same as doing this: def f(): print "f" a=f #unbound function, same a

A problem with subprocess

2009-03-20 Thread Colin J. Williams
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()) Here is the output: *** Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32. **

Re: Smalltalk-like Python IDE ?

2009-03-20 Thread andrew cooke
Steve Ferg wrote: > I'd suggest looking at Komodo IDE I'm curious - is that at all like Smalltalk's environment? I always had the impression it was just like a "standard" IDE (Eclipse, Visual Studio, etc). Is it normal (or even possible), for example, to modify Komodo as you use it? (I'm not ev

Re: Smalltalk-like Python IDE ?

2009-03-20 Thread Steve Ferg
I'd suggest looking at Komodo IDE -- http://mail.python.org/mailman/listinfo/python-list

Re: garbage collection / cyclic references

2009-03-20 Thread andrew cooke
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 circular references with no problem whatever. this is standard

garbage collection / cyclic references

2009-03-20 Thread Aaron Brady
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 about its technique?

Re: pickle.load() extremely slow performance

2009-03-20 Thread Jim Garrison
Jim Garrison wrote: > John Machin wrote: [snip] >> Have you considered using cPickle instead of pickle? >> Have you considered using *ickle.dump(..., protocol=-1) ? > > I'm using Python 3 on Windows (Server 2003). According to the docs > >"The pickle module has an transparent optimizer (_pic

Re: pickle.load() extremely slow performance

2009-03-20 Thread Jim Garrison
John Machin wrote: > On Mar 21, 9:25 am, Jim Garrison wrote: >> I'm converting a Perl system to Python, and have run into a severe >> performance problem with pickle. >> >> One facet of the system involves scanning and loading into memory a >> couple of parallel directory trees containing OTO 10^4

Re: get rid of duplicate elements in list without set

2009-03-20 Thread grocery_stocker
On Mar 20, 5:08 pm, grocery_stocker wrote: > On Mar 20, 8:34 am, Paul McGuire wrote: > > > On Mar 20, 9:54 am, "thomasvang...@gmail.com" > > > wrote: > > > You could use: > > > B=list(set(A)).sort() > > > Hope that helps. > > > T > > > That may hurt more than help, sort() only works in-place, an

Re: get rid of duplicate elements in list without set

2009-03-20 Thread Aaron Brady
On Mar 20, 5:07 pm, Michael Spencer wrote: > Alexzive wrote: snip > And, if you really want, you can get the body of this into 1-line, noting that > seen.add returns None, so the expression (item in seen or seen.add(item)) > evaluates to True if item is in seen, or None (and item is added to seen)

Re: get rid of duplicate elements in list without set

2009-03-20 Thread grocery_stocker
On Mar 20, 8:34 am, Paul McGuire wrote: > On Mar 20, 9:54 am, "thomasvang...@gmail.com" > > wrote: > > You could use: > > B=list(set(A)).sort() > > Hope that helps. > > T > > That may hurt more than help, sort() only works in-place, and does > *not* return the sorted list.  For that you want the

Re: Ordered Sets

2009-03-20 Thread Aaron Brady
On Mar 20, 1:50 pm, Scott David Daniels wrote: > Raymond Hettinger wrote: > > [Aahz] > >> The doubly-linked list part is what's sick and perverted. > > > The doubly-linked list part is what gives it big-oh running > > times the same as regular sets.  If the underlying sequence > > is stored as a l

Re: How evil is this use of sys.getrefcount?

2009-03-20 Thread Miles
On Fri, Mar 20, 2009 at 6:27 PM, Brian Cole wrote: > I'm trying to cache the construction and destruction of an expensive > object coming out of a generator function. I can do the following to > force a new object to be used if the object is being used somewhere > else (based upon it's reference co

Re: Another of those "is" issues.

2009-03-20 Thread Christian Heimes
Terry Reedy wrote: > Compare that to MyClass.myMethod is MyClass.myMethod, which is True at > least in 3.0. It's true because Python 3.0 has no unbound methods. MyClass.myMethod returns the function object. It's possible to get the same behavior in 2.x: MyClass.myMethod.im_func is MyClass.my

How to set the date value in a access dadat base

2009-03-20 Thread tedpot...@gmail.com
Hi, I got the following code access.Edit() access.Fields("customer").value= row["customer"] t=row["time"] print t access.Fields("Time").value=0.0 # time is a float value access.Fields("phrase").value= row["phrase"]

Re: Safe to call Py_Initialize() frequently?

2009-03-20 Thread Mark Hammond
On 21/03/2009 4:20 AM, roschler wrote: I've created a Python server that embeds Python 2.5 and runs Python jobs. I want to be able to completely "flush" the interpreter between each job. That means resetting all variables, stopping all user created threads, and resetting the interpreter sys mod

Re: argument problem in optparse

2009-03-20 Thread John Machin
On Mar 21, 3:44 am, 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.

Re: pickle.load() extremely slow performance

2009-03-20 Thread John Machin
On Mar 21, 9:25 am, Jim Garrison wrote: > I'm converting a Perl system to Python, and have run into a severe > performance problem with pickle. > > One facet of the system involves scanning and loading into memory a > couple of parallel directory trees containing OTO 10^4 files.  The > trees don't

Re: pickle.load() extremely slow performance

2009-03-20 Thread John Machin
On Mar 21, 9:25 am, Jim Garrison wrote: > I'm converting a Perl system to Python, and have run into a severe > performance problem with pickle. > > One facet of the system involves scanning and loading into memory a > couple of parallel directory trees containing OTO 10^4 files.  The > trees don't

How evil is this use of sys.getrefcount?

2009-03-20 Thread Brian Cole
I'm trying to cache the construction and destruction of an expensive object coming out of a generator function. I can do the following to force a new object to be used if the object is being used somewhere else (based upon it's reference count). Here is the pseudo-code of what I am trying to accomp

pickle.load() extremely slow performance

2009-03-20 Thread Jim Garrison
I'm converting a Perl system to Python, and have run into a severe performance problem with pickle. One facet of the system involves scanning and loading into memory a couple of parallel directory trees containing OTO 10^4 files. The trees don't change during development/testing and the scan tak

Re: Another of those "is" issues.

2009-03-20 Thread Terry Reedy
Emanuele D'Arrigo wrote: 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 = aFunctio

Re: get rid of duplicate elements in list without set

2009-03-20 Thread Michael Spencer
Alexzive wrote: Hello there, I'd like to get the same result of set() but getting an indexable object. How to get this in an efficient way? Example using set A = [1, 2, 2 ,2 , 3 ,4] B= set(A) B = ([1, 2, 3, 4]) B[2] TypeError: unindexable object Many thanks, alex -- http://mail.python.org/m

Re: get rid of duplicate elements in list without set

2009-03-20 Thread Steven D'Aprano
On Fri, 20 Mar 2009 07:16:40 -0700, Alexzive wrote: > Hello there, > > I'd like to get the same result of set() but getting an indexable > object. > How to get this in an efficient way? Your question is too open-ended. Do you want to keep the items in the original order? Are the items hashable?

Re: py2exe linux equivalent

2009-03-20 Thread Brendan Miller
So it sounds like the options are PyInstaller, cx_freeze, and bbfreeze. Has anyone used any of these, and knows which one works best on linux? -- http://mail.python.org/mailman/listinfo/python-list

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

2009-03-20 Thread Esmail
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 spam filtering that exclude most of the crap from

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

2009-03-20 Thread Esmail
> To make a closure, the inner function *must* be nested in the outer. > To be an instance method, a function *must* be a class attribute, and > the easier way to indicate that is by nesting. > > In this case, the client does *not* use the other two classes, so the > nesting is misleading.  I thin

Re: nested classes

2009-03-20 Thread Esmail
> Yes. It's the same convention used to indicate that a method is > "private" in Python, since the language itself has no privacy > mechanisms. Great - got it! Thanks again, Esmail -- http://mail.python.org/mailman/listinfo/python-list

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

2009-03-20 Thread Terry Reedy
Mark Tolonen wrote: "Esmail" wrote in message news:03081704-17b5-4c7d-82db-8efb7ebce...@q11g2000yqh.googlegroups.com... Hi all, I've been reading/posting to usenet since the 80s with a variety of tools (vn, and most recently Thunderbird) but since my ISP (TimeWarner) no longer provides usene

Re: py2exe linux equivalent

2009-03-20 Thread Brendan Miller
> platform. AFAICT there are RHEL4 rpms for these, and RHEL4 already comes > with its own version of Python so it seems you are attempting to make > things much more difficult than need be. There are no rpm's in our repository for the third party modules I need... If it was that easy I wouldn't be

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

2009-03-20 Thread Terry Reedy
Esmail wrote: In my opinion, neither should be nested. Nothing is gained and something is lost. Neither are used by client; indeed both use client. I nested them because I see them as components of the client which keeps track of the connection parameters and makes the initial connection and

Re: Preparing teaching materials

2009-03-20 Thread Terry Reedy
Michele Simionato wrote: The interesting thing is that Sphinx uses pygments and can highlight any code fragment, not only Python code. For instance, last week I did some experiment with Sphinx to convert my "Adventures of a Pythonista in Schemeland" (which contains Scheme code) to PDF and it wor

Re: nested classes

2009-03-20 Thread Chris Rebert
On Fri, Mar 20, 2009 at 1:24 PM, Esmail wrote: > On Mar 20, 2:41 pm, Chris Rebert wrote: >> 2009/3/20 Benjamin Kaplan : >> > On Fri, Mar 20, 2009 at 10:06 AM, Esmail wrote: >> >> >> Hello all, >> >> >> I am curious why nested classes don't seem to be used much in Python. >> >> I see them as a gr

Re: py2exe linux equivalent

2009-03-20 Thread Albert Hopkins
On Fri, 2009-03-20 at 12:59 -0700, Brendan Miller wrote: > I have a python application that I want to package up and deploy to > various people using RHEL 4. > > I'm using python 2.6 to develop the app. The RHEL 4 machines have an > older version of python I'd rather not code against (although tha

Re: nested classes

2009-03-20 Thread Esmail
On Mar 20, 2:35 pm, Steve Holden wrote: > Benjamin Kaplan wrote: > > > On Fri, Mar 20, 2009 at 10:06 AM, Esmail > > wrote: > > >     Hello all, > > >     I am curious why nested classes don't seem to be used much in Python. > >     I see them as a great way to encapsulate

Re: nested classes

2009-03-20 Thread Esmail
On Mar 20, 2:41 pm, Chris Rebert wrote: > 2009/3/20 Benjamin Kaplan : > > > > > > > On Fri, Mar 20, 2009 at 10:06 AM, Esmail wrote: > > >> Hello all, > > >> I am curious why nested classes don't seem to be used much in Python. > >> I see them as a great way to encapsulate related information, whi

Re: py2exe linux equivalent

2009-03-20 Thread Mike Driscoll
On Mar 20, 2:59 pm, Brendan Miller wrote: > I have a python application that I want to package up and deploy to > various people using RHEL 4. > > I'm using python 2.6 to develop the app. The RHEL 4 machines have an > older version of python I'd rather not code against (although that's > an option

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

2009-03-20 Thread Esmail
On Mar 20, 2:02 pm, prueba...@latinmail.com wrote: > On Mar 19, 10:21 pm, Esmail 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? >

Re: Use of HTMLparser to change language

2009-03-20 Thread Terry Reedy
pranav wrote: Greetings All, I have huge number of HTML files, all in english. I also have their counterpart files in Spanish. The non english files have their look and feel a little different than their english counterpart. My task is to make sure that the English HTML files contain the Spanis

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

2009-03-20 Thread I V
On Fri, 20 Mar 2009 07:03:35 -0700, Sreejith K wrote: > I'm using the above codes in a pthon-fuse's file class's read function. > The offset and length are 0 and 4096 respectively for my test inputs. > When I open a file and read the 4096 bytes from offset, only a few lines > are printed, not the w

Re: Holy hand grenade!

2009-03-20 Thread Armin
On Friday 20 March 2009 11:54:35 Aahz wrote: > http://www.telegraph.co.uk/news/newstopics/howaboutthat/5018294/Pub-evacuat >ed-after-Monty-Python-prop-mistaken-for-grenade.html LOL!!! -- Armin Moradi -- http://mail.python.org/mailman/listinfo/python-list

py2exe linux equivalent

2009-03-20 Thread Brendan Miller
I have a python application that I want to package up and deploy to various people using RHEL 4. I'm using python 2.6 to develop the app. The RHEL 4 machines have an older version of python I'd rather not code against (although that's an option). My main stumbling block is I need to use a couple o

Re: How complex is complex?

2009-03-20 Thread Terry Reedy
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 item in the original dict. The reuse of names '

Re: Ordered Sets

2009-03-20 Thread Raymond Hettinger
[Scott David Daniels] > The double-linked list part could be done with weakrefs and > perhaps Aahz would relax a bit. Am thinking that the __del__() takes care of business. The clear() operation removes the links and all references to them (including circular). Raymond -- http://mail.python.org

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

2009-03-20 Thread Terry Reedy
Sreejith K wrote: I'm using the above codes in a pthon-fuse's file class's read function. The offset and length are 0 and 4096 respectively for my test inputs. When I open a file and read the 4096 bytes from offset, only a few lines are printed, not the whole file. Actually the file is only a fe

Re: Unable to compile pyprocessing module on SUN solaris

2009-03-20 Thread Christian Heimes
Deepak Rokade wrote: > I am trying to build package "pyprocessing" for python 2.5 > > I am using sun machine with Solaris 5.8 > > drok...@himalaya:~/modules_python/processing-0.52 > (Deepak:)uname -a > SunOS himalaya 5.8 Generic_117350-35 sun4u sparc SUNW,Sun-Fire > > While building the package

Re: Ordered Sets

2009-03-20 Thread Scott David Daniels
Raymond Hettinger wrote: [Aahz] The doubly-linked list part is what's sick and perverted. The doubly-linked list part is what gives it big-oh running times the same as regular sets. If the underlying sequence is stored as a list, then deletion goes from O(1) to O(n). If the insertion times ar

Re: Another of those "is" issues.

2009-03-20 Thread Steve Holden
Emanuele D'Arrigo wrote: > 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 >

Re: Another of those "is" issues.

2009-03-20 Thread Scott David Daniels
Emanuele D'Arrigo wrote: Hi everybody, ... f = aFunction f is aFunction True <--- Ok, this seems reasonable. Nevertheless, I suspect I shouldn't quite rely on it. Actually, that's fine, you are simply comparing a pair of references class MyClass(object): ... def myMethod(s

Re: Newbie: Limesurvey and... MySQLdb?

2009-03-20 Thread Steve Holden
Albert-jan Roskam wrote: > Hi! > > I made a website using Limesurvey (www.wordsalad.eu) and I would like to > query the MySQL database, mostly for *FUN* and to learn more about Python. > Should the MySQLdb module be my starting point? Or is there some other/more > up-to-date module? > > Thanks

Re: nested classes

2009-03-20 Thread Chris Rebert
2009/3/20 Benjamin Kaplan : > > > On Fri, Mar 20, 2009 at 10:06 AM, Esmail wrote: >> >> Hello all, >> >> I am curious why nested classes don't seem to be used much in Python. >> I see them as a great way to encapsulate related information, which is >> a >> good thing. >> >> In my other post "impro

Re: Another of those "is" issues.

2009-03-20 Thread Tim Wintle
On Fri, 2009-03-20 at 11:20 -0700, Emanuele D'Arrigo wrote: > >>> def aFunction(): > ... pass > ... > >>> f = aFunction > >>> f is aFunction > True <--- Ok, this seems reasonable. Nevertheless, I suspect I > shouldn't quite rely on it. You can rely on this in the above - you've just assigned

Re: nested classes

2009-03-20 Thread Steve Holden
Benjamin Kaplan wrote: > > > On Fri, Mar 20, 2009 at 10:06 AM, Esmail > wrote: > > Hello all, > > I am curious why nested classes don't seem to be used much in Python. > I see them as a great way to encapsulate related information, which is > a > go

Re: Another of those "is" issues.

2009-03-20 Thread Benjamin Peterson
Emanuele D'Arrigo gmail.com> writes: > > >>> class MyClass(object): > ... def myMethod(self): > ... pass > ... > >>> c = MyClass() > >>> m = c.myMethod > >>> m is c.myMethod > False <--- What? Why is that? > > Can anybody shed some light? Or point to a resource to look at? Or > what

Re: Is there any way for a program to choose between 32 bit or 64-bit python dynamically?

2009-03-20 Thread Chris Rebert
On Fri, Mar 20, 2009 at 6:28 AM, srinivasan srinivas wrote: > > Hi, > Is thera any way for a program to choose between 32-bit or 64-bit dynamically? Doubt it, since it's set in stone from when your CPython interpreter got compiled. There may be some workaround to use 32bit libs from a 64-bit prog

Re: multiprocessing and Tk GUI program (won't work under Linux)

2009-03-20 Thread akineko
Hello FB, Thank you for responding to my posting. I have tried your suggestion, making a function rather than a method in a class. The result is still the same. According to the documentation, objects to be sent through 'Connection' must be pickable. But I couldn't find anything that explain the s

Re: How to load file .py

2009-03-20 Thread Mike Driscoll
On Mar 20, 11:37 am, "Im Just GembeL" wrote: > Hello all > My name is agiz.im student from indonesia.im stay in borneo island. > Hmm. > im instal python version 3 and Im try file schemafuzz.py this file created by > darkc0de. > And my question.how to load file schemafuzz.py in vista? > after try

Another of those "is" issues.

2009-03-20 Thread Emanuele D'Arrigo
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 >>> f is aFunction T

Re: url lib

2009-03-20 Thread Chris Rebert
On Fri, Mar 20, 2009 at 10:07 AM, CSUIDL PROGRAMMEr wrote: > Hello > I am a novice python progammer > > I am just writing a script that will automatically write my /etc/ > yum.repos.d/* files in linux. > > the problem is i am trying to connect to a secure repo and pass > username and password to t

  1   2   3   >