Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Hendrik van Rooyen
When the days get colder and the nights longer, then evil things are hatched. A can is like a pickle, in that it is a string, but anything can be canned. Unlike a pickle, a can cannot leave the process, though, unless the object it points to lives in shared memory. Here is the output of a test se

Re: OT: Can;'t find a Mozilla user group

2009-06-04 Thread Anthra Norell
Terry Reedy wrote: News123 wrote: Anthra Norell wrote: I can't run Firefox and Thunderbird without getting these upgrade ordering windows. I don't touch them, because I have reason to suspect that they are some (Russian) virus that hijacks my traffic. Occasionally one of these window pops up

Re: easiest way to plot x,y graphically during run-time?

2009-06-04 Thread Nick Craig-Wood
Esmail wrote: > Scott David Daniels wrote: > > Esmail wrote: > >> ... Tk seems a bit more complex .. but I really don't know much about > >> it and its interface with Python to make any sort of judgments as > >> to which option would be better. > > > > This should look pretty easy: > > Thanks

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Thomas Heller
Joseph Garvin schrieb: > So I was curious whether it's possible to use the ctypes module with > C++ and if so how difficult it is. There have been some attempts to use ctypes to access C++ objects. We (Roman Yakovenko and myself) made some progress. We were able to handle C++ name mangling, the s

Re: Access from a class attribute

2009-06-04 Thread Ben Finney
Kless writes: > Why can not to access from a class attribute to a function of that > class? > > - > class Foo(object): >attr = __class__.__name__ >attr = self.__class__.__name__ > - The ‘self’ name is not magical. If you want it bound to something, you ha

Re: what is the biggest number that i can send to Wave_write.writeframes(data)

2009-06-04 Thread '2+
thanx for the example! somehow on juanty gui comes up but no sound .. anyway i shortened the script this way and could aplay it import wave AMPLITUDE = 2 ** 15 w = wave.open( "out.wav", "w" ) w.setnchannels( 2 ) w.setsampwidth( 2 ) #BYTES w.setframerate( 22000 ) from array import array import m

Re: Get the hard disk hardware serial number

2009-06-04 Thread Nick Craig-Wood
MRAB wrote: > Jorge wrote: > > I need to know how to get the hardware serial number of a hard disk in > > python. > > > For Windows, see http://www.daniweb.com/forums/thread187326.html For linux I'd run this and parse the results. # smartctl -i /dev/sda smartctl version 5.38 [i686-pc-linux-g

Re: Project source code layout?

2009-06-04 Thread Lawrence D'Oliveiro
In message , Allen Fowler wrote: > I was hoping to keep the dev layout as close to deployment possible. Completely different purposes. For example, the actual production database and config files form no part of your development project, do they? And conversely, utility scripts that might be u

Access from a class attribute

2009-06-04 Thread Kless
Why can not to access from a class attribute to a function of that class? - class Foo(object): attr = __class__.__name__ attr = self.__class__.__name__ - -- http://mail.python.org/mailman/listinfo/python-list

Re: Access from a class attribute

2009-06-04 Thread Bruno Desthuilliers
Kless a écrit : Why can not to access from a class attribute to a function of that class? - class Foo(object): attr = __class__.__name__ attr = self.__class__.__name__ - "class" is an executable statement that instanciate a new class object and bind it t

Re: nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

2009-06-04 Thread Jon Bendtsen
Jon Bendtsen wrote: > Dennis Lee Bieber wrote: >> On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen >> declaimed the following in gmane.comp.python.general: >> >>> 'From: r...@laerdal.dk\nsubject: testing\nNewsgroups: test\nBody: >>> \n\n\nfoobar\n\n\n.\n\n\n' >>> >> I believe NNTP, like SMTP,

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Nigel Rantor
Hendrik van Rooyen wrote: > > If you have any interest, contact me and I will > send you the source. Maybe you could tell people what the point is... n -- http://mail.python.org/mailman/listinfo/python-list

Re: import sqlite3

2009-06-04 Thread willgun
Andrew McNamara 写道: On 04/06/2009, at 4:14 PM, willgun wrote: What did you call the .py file? sqlite3.py? If so, you've just imported your own module again. 8-) After the import, try "print sqlite3.__file__", which will tell you where the module came from. Thank you all the same. I'm a stu

Re: import sqlite3

2009-06-04 Thread willgun
By the way ,what does 'best regards' means at the end of a mail? -- http://mail.python.org/mailman/listinfo/python-list

Re: nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

2009-06-04 Thread Jon Bendtsen
Jon Bendtsen wrote: > Jon Bendtsen wrote: >> Dennis Lee Bieber wrote: >>> On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen >>> declaimed the following in gmane.comp.python.general: >>> 'From: r...@laerdal.dk\nsubject: testing\nNewsgroups: test\nBody: \n\n\nfoobar\n\n\n.\n\n\n' >>>

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Hendrik van Rooyen
"Nigel Rantor" wrote: > Hendrik van Rooyen wrote: > > > > If you have any interest, contact me and I will > > send you the source. > > Maybe you could tell people what the point is... Well its a long story, but you did ask... I am working on an i/o system, running in an ebox - it is basically

Re: import sqlite3

2009-06-04 Thread Andrew McNamara
On 04/06/2009, at 9:45 PM, willgun wrote: By the way ,what does 'best regards' means at the end of a mail? The correspondent is wishing you well. You'll also see things like "kind regards", "best wishes" and so on. "Regard" essentially means respect. -- http://mail.python.org/mailman/lis

Re: import sqlite3

2009-06-04 Thread pdpi
On Jun 4, 12:45 pm, willgun wrote: > By the way ,what does 'best regards' means at the end of a mail? "regard" means roughly "care". Its use as "best regards" closing a letter (or, in this case, email), means that you care for the person you're saying goodbye to. It's just a polite way to end a

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Nigel Rantor
Hendrik van Rooyen wrote: > "Nigel Rantor" wrote: > >> Hendrik van Rooyen wrote: >>> If you have any interest, contact me and I will >>> send you the source. >> Maybe you could tell people what the point is... > > Well its a long story, but you did ask... [snip] Maybe I should have said "why

Re: Get the hard disk hardware serial number

2009-06-04 Thread Dietmar Schwertberger
MRAB schrieb: Jorge wrote: I need to know how to get the hardware serial number of a hard disk in python. For Windows, see http://www.daniweb.com/forums/thread187326.html This recipe uses the function GetVolumeInformation(), which does not return the hardware serial number. From the micros

Re: hash and __eq__

2009-06-04 Thread Albert van der Horst
In article <0233137f$0$8244$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: >On Sun, 31 May 2009 12:08:33 +0100, Arnaud Delobelle wrote: > >> Anyway, it's good to know that quicksort is O(n^2) in the worst case - >> and that this worst case can crop up very easily in some situations, >> especi

Re: What text editor is everyone using for Python

2009-06-04 Thread Albert van der Horst
In article , Emile van Sebille wrote: >On 6/1/2009 4:57 PM Steven D'Aprano said... >> Having noted that the word "Quit" does appear, how do you then *actually* >> Quit? Apart from taunting the user, what is it that Ctrl-G is actually >> doing when it displays the word "Quit" in what seems to be s

Making the case for repeat

2009-06-04 Thread pataphor
This probably has a snowballs change in hell of ending up in builtins or even some in some module, but such things should not prevent one to try and present the arguments for what one thinks is right. Else one would end up with consequentialism and that way lies madness and hyperreality. So here i

Re: easiest way to plot x,y graphically during run-time?

2009-06-04 Thread Scott David Daniels
Esmail wrote: Scott David Daniels wrote: Esmail wrote: ... Tk seems a bit more complex .. but I really don't know much about it and its interface with Python to make any sort of judgments as to which option would be better. This should look pretty easy: Thanks Scott for taking the time to s

Re: Replacing module with a stub for unit testing

2009-06-04 Thread Fuzzyman
On May 23, 2:00 pm, pigmart...@gmail.com wrote: > Hi, > > I'm working on a unit test framework for a module.  The module I'm > testing indirectly calls another module which is expensive to access > --- CDLLs whose functions access a database. > >     test_MyModule --->MyModule--->IntermediateModule

Re: Making the case for repeat

2009-06-04 Thread Steven D'Aprano
On Thu, 04 Jun 2009 13:37:45 +, pataphor wrote: > This probably has a snowballs change in hell of ending up in builtins or > even some in some module, but such things should not prevent one to try > and present the arguments for what one thinks is right. Else one would > end up with consequent

import _sqlite3 no module named error

2009-06-04 Thread Vincent Davis
I volunteered to help Marijo Mihelčić who was looking for someone with a mac the help him build a mac binary using py2app for his simpletasktimer http://code.google.com/p/simpletasktimer/wiki/Installation when I try to run his app I get the no module named _sqlite3 , I am not sure what this is cau

Re: import sqlite3

2009-06-04 Thread MRAB
Andrew McNamara wrote: On 04/06/2009, at 9:45 PM, willgun wrote: By the way ,what does 'best regards' means at the end of a mail? The correspondent is wishing you well. You'll also see things like "kind regards", "best wishes" and so on. "Regard" essentially means respect. There's also "h

Re: Compiling and transporting modules/libraries in python

2009-06-04 Thread Abe
alex23 - Thanks for the tips. I'm using portable python and it's working great so far. I'll come back and try virtualenv if I get stuck again. - Abe -- http://mail.python.org/mailman/listinfo/python-list

Re: Making the case for repeat

2009-06-04 Thread pataphor
Steven D'Aprano wrote: > I've run your test code, and I don't know what I'm supposed to be > impressed by. Thank you for trying out the code. That you're unimpressed actually is a huge encouragement because code should just run the way people expect, without unnecessary surprises. P. -- http:/

Re: "Exploding" (**myvariable) a dict with unicode keys

2009-06-04 Thread Aahz
In article , Samuel Wan wrote: > >I started using python last week and ran into exceptions thrown when >unicode dictionary keys are exploded into function arguments. In my >case, decoded json dictionaries did not work as function arguments. >There was a thread from Oct 2008 >(http://www.gossamer-

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Hendrik van Rooyen
"Nigel Rantor" wrote: > Hendrik van Rooyen wrote: > > "Nigel Rantor" wrote: > > > >> Hendrik van Rooyen wrote: > >>> If you have any interest, contact me and I will > >>> send you the source. > >> Maybe you could tell people what the point is... > > > > Well its a long story, but you did ask.

Re: Project source code layout?

2009-06-04 Thread Allen Fowler
> > I was hoping to keep the dev layout as close to deployment possible. > > Completely different purposes. For example, the actual production database > and config files form no part of your development project, do they? And > conversely, utility scripts that might be used, for example, to

PEP 315: Enhanced While Loop

2009-06-04 Thread Daniel Cotton
During some random surfing I became interested in the below piece of code: > while : > > and while : > > and while : > > else: It strikes me that the 'and while' syntax has some power that you may not have considered. Consider that if an 'an

Re: Project source code layout?

2009-06-04 Thread Jean-Paul Calderone
On Thu, 04 Jun 2009 21:33:13 +1200, Lawrence D'Oliveiro wrote: In message , Allen Fowler wrote: I was hoping to keep the dev layout as close to deployment possible. Completely different purposes. For example, the actual production database and config files form no part of your development p

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Jean-Paul Calderone
On Thu, 4 Jun 2009 16:49:42 +0200, Hendrik van Rooyen wrote: [snip] It is not something that would find common use - in fact, I have never, until I started struggling with my current problem, ever even considered the possibility of converting a pointer to a string and back to a pointer again,

Feedparser problem

2009-06-04 Thread Jonathan Nelson
I'm trying to add a feedreader element to my django project. I'm using Mark Pilgrim's great feedparser library. I've used it before without any problems. I'm getting a TypeError I can't figure out. I've tried searching google, bing, google groups to no avail. Here's the dpaste of what I'm tryin

multi-core software

2009-06-04 Thread Xah Lee
Of interest: • Why Must Software Be Rewritten For Multi-Core Processors? http://xahlee.org/UnixResource_dir/writ/multi-core_software.html plain text version follows. -- Why Must Software Be Rewritten For Multi-Core Processors? Xah Lee, 2009-06-0

Re: Generating all combinations

2009-06-04 Thread Mensanator
On Jun 4, 1:27 am, Raymond Hettinger wrote: > > Nice one! > > It only does partitions of a sequence.  I haven't yet looked at a way > to > do partitions of a set.  Any ideas? > > > Raymond, as perhaps *the* principle contributor to itertools, do you feel > > that the combinatorics-related tools sh

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread skip
Hendrik> A can is like a pickle, in that it is a string, but anything Hendrik> can be canned. Unlike a pickle, a can cannot leave the Hendrik> process, though, unless the object it points to lives in shared Hendrik> memory. Got some use cases? Thx, -- Skip Montanaro - s...@pob

Re: accessing the XML attribute value noNamespaceSchemaLocation thru Python 2.5

2009-06-04 Thread Stefan Behnel
tooshiny wrote: > I am currently successfully using lxml and ElementTree to validate and > to access the XML contained data. I can however not find any > functional call to access the schema location ie the attribute value > noNamespaceSchemaLocation. > > A simple function call would be so much ni

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Terry Reedy
Hendrik van Rooyen wrote: I can see that my explanation passes you by completely. I said, in my original post, that a can could not leave a process. A can is exactly the same as a C pointer, only its value has been converted to a string, so that you can pass it "in band" as part of a string. Th

"where" in python

2009-06-04 Thread Chris
I am a newby in Python and I'm first looking for equivalent to things I already manage: IDL. For example, I want to plot a sub-set of points, selected from a bigger set by applying some filter. In my example, I want to select only the values > 0. I succeed to write 5 different ways to do this, whic

python way to automate IE8's File Download dialog

2009-06-04 Thread monogeo
Hello, I am able to use PAMIE 2.0 to automate IE7's File Download dialog, but the same approach/code fails on IE8. You can see the details and code at http://tech.groups.yahoo.com/group/Pamie_UsersGroup/message/675 Please help if you are able to automate IE8's File Download dialog (with three but

Re: Get the hard disk hardware serial number

2009-06-04 Thread Terry Reedy
Dietmar Schwertberger wrote: The WMI method is e.g. described here: http://www.velocityreviews.com/forums/t359670-wmi-help.html import wmi Not in the stdlib, but available here: http://pypi.python.org/pypi/WMI/1.3 and requires in turn pywin32: http://pypi.python.org/pypi/pywin32/210 c = wm

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Nigel Rantor
Hendrik van Rooyen wrote: It is not something that would find common use - in fact, I have never, until I started struggling with my current problem, ever even considered the possibility of converting a pointer to a string and back to a pointer again, and I would be surprised if anybody else on

Re: Get the hard disk hardware serial number

2009-06-04 Thread Paul Boddie
On 4 Jun, 11:29, Nick Craig-Wood wrote: > > For linux I'd run this and parse the results. > > # smartctl -i /dev/sda Also useful is hdparm, particularly with the drive identification and detailed information options shown respectively below: # hdparm -i /dev/sda # hdparm -I /dev/sda Paul -- ht

Re: import _sqlite3 no module named error

2009-06-04 Thread Ned Deily
In article <77e831100906040708l1a8bf638n19bbff05607b3...@mail.gmail.com>, Vincent Davis wrote: > I volunteered to help Marijo Mihelčić who was looking for someone with > a mac the help him build a mac binary using py2app for his > simpletasktimer > http://code.google.com/p/simpletasktimer/wiki/

Re: import _sqlite3 no module named error

2009-06-04 Thread Vincent Davis
>> when I try to run his app I get the no module named _sqlite3 , I am >> not sure what this is caused by as it looks to me like sqlite3 is >> trying to import it. Any idea how to fix this? Other than the obvious >> of getting _sqlite3 somehow, or maby it is that simple >>   >> "/opt/local/Librar

Re: multi-core software

2009-06-04 Thread Kaz Kylheku
["Followup-To:" header set to comp.lang.lisp.] On 2009-06-04, Roedy Green wrote: > On Thu, 4 Jun 2009 09:46:44 -0700 (PDT), Xah Lee > wrote, quoted or indirectly quoted someone who said : > >>• Why Must Software Be Rewritten For Multi-Core Processors? > > Threads have been part of Java since Day

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Thomas Heller
[Please keep the discussion on the list] Joseph Garvin schrieb: > On Thu, Jun 4, 2009 at 3:43 AM, Thomas Heller wrote: >> There have been some attempts to use ctypes to access C++ objects. >> We (Roman Yakovenko and myself) made some progress. We were able to >> handle C++ name mangling, the spe

Re: import _sqlite3 no module named error

2009-06-04 Thread Ned Deily
In article <77e831100906041151g70868dbre1546cdb01082...@mail.gmail.com>, Vincent Davis wrote: > Yes I am using macports I think sqlite is installed? here is what I > get when I run > sudo port install py25-sqlite3 > > vincent-daviss-macbook-pro-2:~ vmd$ sudo port install py25-sqlite3 > Skipping

Is socket.shutdown(1) useless

2009-06-04 Thread Mohamed Garrana
Hello This is is in answer for Is socket.shutdown(1) useless Shutdown(1) , forces the socket no to send any more data This is usefull in Buffer flushing Strange error detection Safe guarding Let me explain more , when you send a data , it's not guaranteed to be sent to your peer , it's only

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Philip Semanchuk
On Jun 4, 2009, at 3:35 PM, Thomas Heller wrote: [Please keep the discussion on the list] Joseph Garvin schrieb: On Thu, Jun 4, 2009 at 3:43 AM, Thomas Heller wrote: There have been some attempts to use ctypes to access C++ objects. We (Roman Yakovenko and myself) made some progress. We w

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Thomas Heller
Philip Semanchuk schrieb: > Hi Thomas, > We're weighing options for accessing C++ objects via Python. I know of > SIWG and Boost; are there others that you think deserve consideration? I haven't used any of them myself. A common suggestion is SIP, less known are pybindgen and Robin. But there

Re: import sqlite3

2009-06-04 Thread Gabriel Genellina
En Thu, 04 Jun 2009 03:14:18 -0300, willgun escribió: I'm a student from China.It's painful for us to read python documentation entirely due to poor english.So I often make these mistakes. Try "chinese python group" at Google - I see some promising results at least... -- Gabriel Genell

Re: Illegal seek with os.popen

2009-06-04 Thread pruebauno
On Jun 3, 3:36 pm, a...@pythoncraft.com (Aahz) wrote: > In article > <7c93031a-235e-4e13-bd37-7c9dbc6e8...@r16g2000vbn.googlegroups.com>, > > > >   wrote: > >Should I open a bug report for this? > > >Python 2.5.1 (r251:54863, Sep 19 2007, 14:58:06) [C] on aix5 > >Type "help", "copyright", "credits

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Brian
What is the goal of this conversation that goes above and beyond what Boost.Python + pygccxml achieve? Boost has published a variety of libraries that will be included into the next c++ standard. It's hard to imagine a better designed python/c++ interface library than Boost.Python. Further, pygccxm

Re: What text editor is everyone using for Python

2009-06-04 Thread Nick Craig-Wood
Steven D'Aprano wrote: > On Tue, 02 Jun 2009 10:54:48 +1200, Lawrence D'Oliveiro wrote: > > > In message , Albert van der Horst wrote: > > > >> An indication of how one can see one is in emacs is also appreciated. > > > > How about, hit CTRL/G and see if the word "Quit" appears somewhere. > >

Re: Illegal seek with os.popen

2009-06-04 Thread Terry Reedy
prueba...@latinmail.com wrote: Python 3.0.1 (r301:69556, Jun 4 2009, 16:07:22) [C] on aix5 Type "help", "copyright", "credits" or "license" for more information. import os os.popen('cat','w') So it seems to be something in 3.1 that causes it to fail. BTW it is not like I use os.popen a lot.

Re: multi-core software

2009-06-04 Thread MRAB
Kaz Kylheku wrote: ["Followup-To:" header set to comp.lang.lisp.] On 2009-06-04, Roedy Green wrote: On Thu, 4 Jun 2009 09:46:44 -0700 (PDT), Xah Lee wrote, quoted or indirectly quoted someone who said : • Why Must Software Be Rewritten For Multi-Core Processors? Threads have been part of Ja

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Philip Semanchuk
On Jun 4, 2009, at 4:23 PM, Brian wrote: What is the goal of this conversation that goes above and beyond what Boost.Python + pygccxml achieve? Boost has published a variety of libraries that will be included into the next c++ standard. It's hard to imagine a better designed python/c++ inte

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Brian
Well you'll just have to try Boost.Python. There is a pygccxml gui gets you started in about 15 minutes. You'll be able to see how well it groks your code and what that generated code is. Boost is the best. People complain about it because they don't understand C++ templates and they don't realize

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Brian
Just to expound a bit on pygccxml, which really makes boost worth it. pygccxml enables you to do all of your binding work from within Python. It calls gccxml, which is an xml backend to gcc that outputs the parse tree in an xml format. Pygccxml provides a very high level interface between the gcc x

Re: Illegal seek with os.popen

2009-06-04 Thread Aahz
[posted & e-mailed] In article <5edde6ee-4446-4f53-91ee-ad3aea4b5...@q37g2000vbi.googlegroups.com>, wrote: > >Python 3.0.1 (r301:69556, Jun 4 2009, 16:07:22) [C] on aix5 >Type "help", "copyright", "credits" or "license" for more information. import os os.popen('cat','w') > > >So it se

MultiReplace (performance and unordered dicts)

2009-06-04 Thread Joseph Reagle
I have programs that do lots of string-to-string replacements, so I'm trying to create a speedy implementation (tons of .replace statements has become unwieldy). My MultiReplace object does as well as the function regexp, which both do better than the for loop function, any other suggestions? def

Odd closure issue for generators

2009-06-04 Thread Brian Quinlan
This is from Python built from the py3k branch: >>> c = (lambda : i for i in range(11, 16)) >>> for q in c: ... print(q()) ... 11 12 13 14 15 >>> # This is expected >>> c = (lambda : i for i in range(11, 16)) >>> d = list(c) >>> for q in d: ... print(q()) ... 15 15 15 15 15 >>> # I was ver

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Joseph Garvin
On Thu, Jun 4, 2009 at 3:23 PM, Brian wrote: > What is the goal of this conversation that goes above and beyond what > Boost.Python + pygccxml achieve? I can't speak for others but the reason I was asking is because it's nice to be able to define bindings from within python. At a minimum, compili

Re: What text editor is everyone using for Python

2009-06-04 Thread Lawrence D'Oliveiro
In message , Nick Craig- Wood wrote: > You quit emacs with Ctrl-X Ctrl-C. That's "save-buffers-kill-emacs". If you don't want to save buffers, the exit sequence is alt-tilde, f, e. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Joseph Garvin
On Thu, Jun 4, 2009 at 2:35 PM, Thomas Heller wrote: > [Please keep the discussion on the list] > > All in all, as I said, IMO it is too complicated to figure out the binary > layout of the C++ objects (without using a C++ compiler), also there are > quite some Python packages for accessing them.

Re: What text editor is everyone using for Python

2009-06-04 Thread Lawrence D'Oliveiro
In message , Albert van der Horst wrote: > Memories of Atari 260/520/1040 that had a keyboard with a key actually > marked ... HELP. And the OLPC machines have a key marked "reveal source". -- http://mail.python.org/mailman/listinfo/python-list

Re: Project source code layout?

2009-06-04 Thread Lawrence D'Oliveiro
In message , Allen Fowler wrote: > 1) Do you use virtualpython? No idea what that is. > 2) How do you load the modules in your lib directory? At the beginning of my scripts, I have a sequence like test_mode = False # True for testing, False for production if test_mode : home_

Re: "where" in python

2009-06-04 Thread Robert Kern
On 2009-06-04 12:53, Chris wrote: I am a newby in Python and I'm first looking for equivalent to things I already manage: IDL. For example, I want to plot a sub-set of points, selected from a bigger set by applying some filter. In my example, I want to select only the values> 0. I succeed to wri

Re: Odd closure issue for generators

2009-06-04 Thread Gabriel Genellina
En Thu, 04 Jun 2009 18:40:07 -0300, Brian Quinlan escribió: This is from Python built from the py3k branch: It's not new; same thing happens with 2.x A closure captures (part of) the enclosing namespace, so names are resolved in that environment even after the enclosing block has finishe

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Scott David Daniels
Joseph Garvin wrote: On Thu, Jun 4, 2009 at 2:35 PM, Thomas Heller wrote: [Please keep the discussion on the list] All in all, as I said, IMO it is too complicated to figure out the binary layout of the C++ objects (without using a C++ compiler), also there are quite some Python packages for a

Re: Odd closure issue for generators

2009-06-04 Thread Carl Banks
On Jun 4, 2:40 pm, Brian Quinlan wrote: > This is from Python built from the py3k branch: >  >>> c = (lambda : i for i in range(11, 16)) >  >>> for q in c: > ...     print(q()) > ... > 11 > 12 > 13 > 14 > 15 >  >>> # This is expected >  >>> c = (lambda : i for i in range(11, 16)) >  >>> d = list(c

Re: easiest way to plot x,y graphically during run-time?

2009-06-04 Thread Peter Pearson
On Thu, 04 Jun 2009 03:29:42 -0500, Nick Craig-Wood wrote: [snip] > Here is a demo with pygame... [snip] And just for completeness, here is a demo with PyGUI, written in similar style. (I'm a PyGUI newbie, so constructive criticism would be appreciated.) from GUI import Window, View, application

Re: Odd closure issue for generators

2009-06-04 Thread Scott David Daniels
Brian Quinlan wrote: This is from Python built from the py3k branch: >>> c = (lambda : i for i in range(11, 16)) >>> for q in c: ... print(q()) ... 11 12 13 14 15 >>> # This is expected >>> c = (lambda : i for i in range(11, 16)) >>> d = list(c) >>> for q in d: ... print(q()) ... 15

Re: easiest way to plot x,y graphically during run-time?

2009-06-04 Thread Esmail
Nick Craig-Wood wrote: Here is a demo with pygame... Thanks Nick, I'll be studying this too :-) Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: easiest way to plot x,y graphically during run-time?

2009-06-04 Thread Esmail
Scott David Daniels wrote: Esmail wrote: Scott David Daniels wrote: Esmail wrote: ... Tk seems a bit more complex .. but I really don't know much about it and its interface with Python to make any sort of judgments as to which option would be better. This should look pretty easy: Thanks Sc

Re: easiest way to plot x,y graphically during run-time?

2009-06-04 Thread Esmail
Peter Pearson wrote: On Thu, 04 Jun 2009 03:29:42 -0500, Nick Craig-Wood wrote: [snip] Here is a demo with pygame... [snip] And just for completeness, here is a demo with PyGUI, written in similar style. Thanks for this too! Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: import _sqlite3 no module named error

2009-06-04 Thread Vincent Davis
On Thu, Jun 4, 2009 at 1:41 PM, Ned Deily wrote: > In article > <77e831100906041151g70868dbre1546cdb01082...@mail.gmail.com>, >  Vincent Davis wrote: >> Yes I am using macports I think sqlite is installed? here is what I >> get when I run >> sudo port install py25-sqlite3 >> >> vincent-daviss-mac

Printing list/tuple elements on separate lines

2009-06-04 Thread Johnny Chang
I have a large list of strings that I am unpacking and splitting, and I want each one to be on a new line. Someone showed me how to do it and I got it working, except it is not printing each on its own separate line as his did, making it incredibly hard to read. He did it without adding a new lin

Re: Printing list/tuple elements on separate lines

2009-06-04 Thread Stephen Hansen
On Thu, Jun 4, 2009 at 5:37 PM, Johnny Chang wrote: > I have a large list of strings that I am unpacking and splitting, and > I want each one to be on a new line. Someone showed me how to do it > and I got it working, except it is not printing each on its own > separate line as his did, making i

unladen swallow: python and llvm

2009-06-04 Thread Luis M . González
I am very excited by this project (as well as by pypy) and I read all their plan, which looks quite practical and impressive. But I must confess that I can't understand why LLVM is so great for python and why it will make a difference. AFAIK, LLVM is alot of things at the same time (a compiler inf

Re: What text editor is everyone using for Python

2009-06-04 Thread Emile van Sebille
On 6/4/2009 3:19 PM Lawrence D'Oliveiro said... In message , Nick Craig- Wood wrote: You quit emacs with Ctrl-X Ctrl-C. That's "save-buffers-kill-emacs". If you don't want to save buffers, the exit sequence is alt-tilde, f, e. Ha ha ha ha ha! No -- really? Emile -- http://mail.python.o

Yet another unicode WTF

2009-06-04 Thread Ron Garret
Python 2.6.2 on OS X 10.5.7: [...@mickey:~]$ echo $LANG en_US.UTF-8 [...@mickey:~]$ cat frob.py #!/usr/bin/env python print u'\u03BB' [...@mickey:~]$ ./frob.py ª [...@mickey:~]$ ./frob.py > foo Traceback (most recent call last): File "./frob.py", line 2, in print u'\u03BB' UnicodeEncodeE

__file__ access extremely slow

2009-06-04 Thread Zac Burns
The section of code below, which simply gets the __file__ attribute of the imported modules, takes more than 1/3 of the total startup time. Given that many modules are complicated and even have dynamic population this figure seems very high to me. it would seem very high if one just considered the

Re: What text editor is everyone using for Python

2009-06-04 Thread Ben Finney
Emile van Sebille writes: > On 6/4/2009 3:19 PM Lawrence D'Oliveiro said... > > In message , Nick Craig- > > Wood wrote: > > > >> You quit emacs with Ctrl-X Ctrl-C. > > > > That's "save-buffers-kill-emacs". If you don't want to save buffers, > > the exit sequence is alt-tilde, f, e. This is an i

ctype question

2009-06-04 Thread Amit Gupta
Hi, I have been using ctype.cdll to load a library, but I am unable to figure out how to load multiple libraries that depends on each other. E.g. I have two libraries A.so and B.so. A.so has some undefined references, and those symbols are defined in B.so. When I try to load ctypes.cdll.LoadLibra

Re: __file__ access extremely slow

2009-06-04 Thread Zac Burns
Sorry, there is a typo. The code should read as below to repro the problem: for module in sys.modules.itervalues(): try: path = module.__file__ except (AttributeError, ImportError): return

How do I continue after the error?

2009-06-04 Thread chad
Let's say I have a list of 5 files. Now lets say that one of the files reads nude333.txt instead of nude3.txt. When this happens, the program generates an error and quits. What I want it to do is just skip over the bad file and continue on with the next one. Below is the actual code. It only works

Re: Odd closure issue for generators

2009-06-04 Thread Brian Quinlan
Gabriel Genellina wrote: En Thu, 04 Jun 2009 18:40:07 -0300, Brian Quinlan escribió: This is from Python built from the py3k branch: It's not new; same thing happens with 2.x A closure captures (part of) the enclosing namespace, so names are resolved in that environment even after the enc

Re: What text editor is everyone using for Python

2009-06-04 Thread greg
Albert van der Horst wrote: Memories of Atari 260/520/1040 that had a keyboard with a key actually marked ... HELP. Modern day Mac keyboards have one of those, too. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: unladen swallow: python and llvm

2009-06-04 Thread Jesse Noller
You can email these questions to the unladen-swallow mailing list. They're very open to answering questions. 2009/6/4 Luis M. González : > I am very excited by this project (as well as by pypy) and I read all > their plan, which looks quite practical and impressive. > But I must confess that I can

Re: Making the case for repeat

2009-06-04 Thread Gabriel Genellina
En Thu, 04 Jun 2009 10:37:45 -0300, pataphor escribió: So here is my proposed suggestion for a once and for all reconciliation of various functions in itertools that can not stand on their own and keep a straight face. Because of backwards compatibility issues we cannot remove them but we can b

Re: Yet another unicode WTF

2009-06-04 Thread Lawrence D'Oliveiro
In message , Ron Garret wrote: > Python 2.6.2 on OS X 10.5.7: Same result, Python 2.6.1-3 on Debian Unstable. My $LANG is en_NZ.UTF-8. > ... I always thought one of the fundamental > invariants of unix processes was that there's no way for a process to > know what's on the other end of its stdo

Re: 2d barcode library?

2009-06-04 Thread Trevor
> > Christian > > [1]https://cybernetics.hudora.biz/projects/wiki/huBarcode Thanks guys! huBarcode will work.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Yet another unicode WTF

2009-06-04 Thread Ben Finney
Ron Garret writes: > According to what I thought I knew about unix (and I had fancied myself > a bit of an expert until just now) this is impossible. Python is > obviously picking up a different default encoding when its output is > being piped to a file, but I always thought one of the funda

Re: How do I continue after the error?

2009-06-04 Thread Ben Finney
chad writes: > Let's say I have a list of 5 files. Now lets say that one of the files > reads nude333.txt instead of nude3.txt. When this happens, the program > generates an error and quits. What I want it to do is just skip over > the bad file and continue on with the next one. Have you worked

  1   2   >