Re: Questions about asyncore

2008-07-30 Thread Frank Millman
On Jul 30, 7:50 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > On 30 Lug, 09:49, Frank Millman <[EMAIL PROTECTED]> wrote: > Thanks again, Giampaolo, your input is really appreciated. > > I pretty much have the same overview I had before. > As far as I can tell the only reason you want to us

Re: interpreter vs. compiled

2008-07-30 Thread Tim Roberts
castironpi <[EMAIL PROTECTED]> wrote: > >In C, we have: > >int x, y; >x= 10; >y= x+ 1; > >It translates as, roughly: >> >8000 .data >7996 #x >7992 #y >7988 .end data >7984 loadi reg0 7996 >7980 loadi reg1 7992 >7976 loadi reg2 10 >7972 loadi reg3 1 >7968 storv reg2 reg0 >7964 add

Re: Python parsing iTunes XML/COM

2008-07-30 Thread Stefan Behnel
william tanksley wrote: > william tanksley <[EMAIL PROTECTED]> wrote: >> I'm still puzzled why I'm getting some non-Unicode out of an >> ElementTree's text, though. > > Now I know. > > Okay, my answer is that cElementTree (in Python 2.5) is simply > deranged when it comes to Unicode. It assumes e

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Russ P.
On Jul 30, 10:43 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Russ P. wrote: > > On Jul 30, 9:27 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > >> You're sure going on about a distinction without a difference for a guy > >> who childishly likes to call other people names. A reasonable pers

Re: Unicode characters, XML/RSS

2008-07-30 Thread Stefan Behnel
Adam W. wrote: > File "C:\Python25\lib\xml\sax\expatreader.py", line 207, in feed > self._parser.Parse(data, isFinal) > File "C:\Users\Adam\Desktop\Rev3 DL\XMLWorkspace.py", line 51, in > characters > self.data.append(string) > UnicodeEncodeError: 'ascii' codec can't encode character u'

Re: Insert character at a fixed position of lines

2008-07-30 Thread alex23
On Jul 30, 10:43 pm, Lie <[EMAIL PROTECTED]> wrote: > Lessons learned, should test codes even if you thought it seemed > trivial. And I learned I should always make sure to cut&paste the right example :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Erik Max Francis
Russ P. wrote: On Jul 30, 9:27 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: You're sure going on about a distinction without a difference for a guy who childishly likes to call other people names. A reasonable person would have long ago moved on instead of blaming others for not immediately

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Russ P.
On Jul 30, 9:27 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Russ P. wrote: > > I don't know if you can read minds, but you seem to have a lot of > > trouble reading words. > > > Can you read "it would be nice to be able to write ..."? Can you > > understand what it means? Can you understand t

Re: how to split text into lines?

2008-07-30 Thread alex23
kj wrote: > Sorry, I should have googled this first.  I just found splitlines()... > > Still, for my own edification, is there a way to achieve the same > effect using re.split? re.split(os.linesep, ) works the same as .splitlines() Neither retain the EOL for each line, though. The only way I'm a

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread alex23
Ethan Furman wrote: > If that's really what you want, go join Dave Parker and Flaming Thunder. Best recommendation in this thread to date :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Native Code vs. Python code for modules

2008-07-30 Thread alex23
On Jul 30, 11:14 pm, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > >Well, the snarky response is most Python developers are too busy > >working on actual real world projects :) > > The follow-up snarky response is that working on actual real world > projects has lead Python developers to realise tha

Unicode characters, XML/RSS

2008-07-30 Thread Adam W.
So I wrote a little video podcast downloading script that checks a list of RSS feeds and downloads any new videos. Every once in a while it find a character that is out of the 128 range in the feed and my script blows up: Traceback (most recent call last): File "C:\Users\Adam\Desktop\Rev3 DL\Re

Executing Python From Perl

2008-07-30 Thread Chris
I have an old application that has an embedded Perl interpreter exposing an API. However, all the code I have needs to use the API is in Python. What's the easiest way access my Python code from inside Perl? The closest thing I've found is the Inline::Python module (http://search.cpan.org/~neilw/In

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Erik Max Francis
Russ P. wrote: I don't know if you can read minds, but you seem to have a lot of trouble reading words. Can you read "it would be nice to be able to write ..."? Can you understand what it means? Can you understand that it does *not* mean, "one *should* be able to write ..."? You're sure going

win32com ChartObject pythonwin vs idle

2008-07-30 Thread sterling
I'm curious as to why the difference between IDLE and pythonWin when using win32com. opening an excel file, i've attempted to grab the chart information out of the file. commands like co = ChartObjects(1) works in pythonWin but doesn't work in IDLE. however, on both co = chartobjects(1) works ju

Re: Interbase

2008-07-30 Thread Alexandr N Zamaraev
Mike Hjorleifsson wrote: Has anyone gotten python working with Interbase database platform ? I See KInterbasDB: http://kinterbasdb.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Russ P.
On Jul 30, 8:24 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jul 30, 8:03 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > > > Russ P. wrote: > > > The reason I wrote that "it would be nice to be able to write" > > > > if x is not empty: > > > > is that it reads naturally. It was not an actual pr

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Ethan Furman
Russ P. wrote: [snippers] The reason I wrote that "it would be nice to be able to write" if x is not empty: is that it reads naturally. [and more snippers] Reads naturally? For whom? "Readability counts" does not mean "make it sound like english as much as possible". There are good rea

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Steven D'Aprano
On Thu, 31 Jul 2008 02:41:08 +, Steven D'Aprano wrote: > On Wed, 30 Jul 2008 09:23:05 -0600, Matthew Fitzgibbons wrote: ... >> Although, if my function is expecting a list, my preference is to do: >> >> if not isinstance(x, list): >> raise SomeMeaningfulException() >> # do stuff with the

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Russ P.
On Jul 30, 8:03 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Russ P. wrote: > > The reason I wrote that "it would be nice to be able to write" > > > if x is not empty: > > > is that it reads naturally. It was not an actual proposal, and the > > fact that you took it as such was *your* mistake.

Re: Optimizing size of very large dictionaries

2008-07-30 Thread Miles
On Wed, Jul 30, 2008 at 8:29 PM, <[EMAIL PROTECTED]> wrote: > Background: I'm trying to identify duplicate records in very large text > based transaction logs. I'm detecting duplicate records by creating a SHA1 > checksum of each record and using this checksum as a dictionary key. This > works gre

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Ethan Furman
Carl Banks wrote: On Jul 30, 4:49 am, Ethan Furman <[EMAIL PROTECTED]> wrote: Even for those that did realize, and in fact hoped that that is what you were attempting to accomplish, I was not attempting to accomplish what you think I was. I was looking for it, but I didn't want to see it. I

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Erik Max Francis
Russ P. wrote: The reason I wrote that "it would be nice to be able to write" if x is not empty: is that it reads naturally. It was not an actual proposal, and the fact that you took it as such was *your* mistake. ... Now read carefully: I DID NOT CLAIM THAT THIS IS THE WAY TO DO IT!

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Steven D'Aprano
On Wed, 30 Jul 2008 20:55:03 +0100, Matthew Woodcraft wrote: > On the other hand, iterators provide a clear example of problems with > "if x": __nonzero__ for iterators (in general) returns True even if they > are 'empty'. How do you propose telling whether an iterator is empty? That's a generic

Re: overriding file.readline: "an integer is required"

2008-07-30 Thread Miles
On Wed, Jul 30, 2008 at 5:52 PM, kj <[EMAIL PROTECTED]> wrote: > I know that I could rewrite the method like this: > >def readline(self, size=None): >if size == None: >line = self.file.readline() >else: >line = self.file.readline(size) ># etc., et

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Steven D'Aprano
On Wed, 30 Jul 2008 09:23:05 -0600, Matthew Fitzgibbons wrote: > If you're expecting a list (and only a list) > then your point makes sense. 'if x' can get you into trouble if you > _don't_ want its polymorphism. "if x" is hardly unique in that way. If you're expecting a list, and only a list, "

Re: Optimizing size of very large dictionaries

2008-07-30 Thread Gabriel Genellina
En Wed, 30 Jul 2008 21:29:39 -0300, <[EMAIL PROTECTED]> escribi�: Are there any techniques I can use to strip a dictionary data structure down to the smallest memory overhead possible? I'm working on a project where my available RAM is limited to 2G and I would like to use very large dictionari

Re: How can I check nbr of cores of computer?

2008-07-30 Thread Steven D'Aprano
On Wed, 30 Jul 2008 11:22:12 -0700, John Nagle wrote: > defn noob wrote: >> How can I check how many cores my computer has? Is it possible to do >> this in a Python-app? > > Why do you care? Python can't use more than one of them at > a time anyway. Why do you care why he cares? And he did

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Russ P.
On Jul 30, 7:05 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Russ P. wrote: > > On Jul 30, 1:07 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: > >> Russ P. wrote: > >>> Oh, Lordy. I understand perfectly well how boolean tests, __len__, and > >>> __nonzero__ work in Python. It's very basic stu

Re: undo a dictionary

2008-07-30 Thread castironpi
On Jul 30, 8:07 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 30 Jul 2008 16:14:31 -0300, mmm <[EMAIL PROTECTED]> escribi : > > > > >> > And for that matter a way to create a > >> > dictionary from a set of variables (local or global). > > >> You have to be more specific: there are {

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread castironpi
On Jul 30, 1:50 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jul 30, 1:58 am, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > > On Jul 29, 10:33 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > On Jul 30, 1:15 am, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > Having said that, it would sure be nice

Re: Standard module for parsing emails?

2008-07-30 Thread Steven D'Aprano
On Wed, 30 Jul 2008 07:11:45 -0700, Phillip B Oldham wrote: > Most clients use ">" which is easy to check for, but I've seen some > which use "|" and some which *don't* quote at all. Its causing us > nightmares in parsing responses to system-generated emails. I was hoping > someone might've seen t

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Erik Max Francis
Russ P. wrote: On Jul 30, 1:07 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: Russ P. wrote: Oh, Lordy. I understand perfectly well how boolean tests, __len__, and __nonzero__ work in Python. It's very basic stuff. You can quit patronizing me (and Carl too, I'm sure). You suggested a syntax

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Carl Banks
On Jul 30, 4:49 am, Ethan Furman <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > On Jul 29, 6:42 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: > >> I don't have any postable code (it's in a half way state and I haven't > >> touched it for a while), but I'll see if I can't find the time to b

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Carl Banks
On Jul 30, 3:56 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > I mean in general. I wouldn't spell it like that. I would prefer if > > empty(x), with an __empty__ method. (And support __nonzero__ aka > > __bool__ dropped completely.) > > So your argument is purely about

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Carl Banks
On Jul 30, 11:07 am, Terry Reedy <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > That's not what I was asking for. I was asking for a use case for "if > > x" that can't be replaced by a simple explicit test. Your example > > didn't satisfy that. > > But I believe my example of an iterator with

Re: proxy class and __add__ method

2008-07-30 Thread Gabriel Genellina
En Wed, 30 Jul 2008 14:54:51 -0300, Rhamphoryncus <[EMAIL PROTECTED]> escribió: On Jul 29, 10:23 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Tue, 29 Jul 2008 13:13:51 -0300, Magnus Schuster   <[EMAIL PROTECTED]> escribi : > I have written the following small proxy class which I exp

Re: Is there a such Python module ?

2008-07-30 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: >Johny wrote: >> Is there a Python module that can help with reading SMS message from a >> mobile phone? >> Or is there an example how to read SMS message using a program written >> in Python,C, or any other language? >

Re: undo a dictionary

2008-07-30 Thread Gabriel Genellina
En Wed, 30 Jul 2008 16:14:31 -0300, mmm <[EMAIL PROTECTED]> escribi�: > And for that matter a way to create a > dictionary from a set of variables (local or global). You have to be more specific: there are {} displays and dict(args) call and other methods.  Read the manual. My desire is to ta

Re: Python parsing iTunes XML/COM

2008-07-30 Thread william tanksley
william tanksley <[EMAIL PROTECTED]> wrote: > I'm still puzzled why I'm getting some non-Unicode out of an > ElementTree's text, though. Now I know. Okay, my answer is that cElementTree (in Python 2.5) is simply deranged when it comes to Unicode. It assumes everything's ASCII. Reference: http://

Re: proxy class and __add__ method

2008-07-30 Thread Gabriel Genellina
En Wed, 30 Jul 2008 07:48:45 -0300, Magnus Schuster <[EMAIL PROTECTED]> escribi�: __magic__ methods on new style classes are searched in the class, *not* in the instance. prx_i+1 looks for __add__ in type(prx_i), that is, in the proxy class. With this explanation the behaviour is absolutel

Re: Python parsing iTunes XML/COM

2008-07-30 Thread william tanksley
"Jerry Hill" <[EMAIL PROTECTED]> wrote: > On Wed, Jul 30, 2008 at 2:27 PM, william tanksley <[EMAIL PROTECTED]> wrote: > > Awesome... Thank you! I had my mental model of Python turned around > > backwards. That's an odd feeling. Okay, so you decode to go from raw > > byes into a given encoding, and

Optimizing size of very large dictionaries

2008-07-30 Thread python
Are there any techniques I can use to strip a dictionary data structure down to the smallest memory overhead possible? I'm working on a project where my available RAM is limited to 2G and I would like to use very large dictionaries vs. a traditional database. Background: I'm trying to identify du

Re: How can I check nbr of cores of computer?

2008-07-30 Thread Daniel da Silva
Single line using /proc/cpuinfo: numprocs = [ int(line.strip()[-1]) for line in open('/proc/cpuinfo', 'r') if \ line.startswith('processor') ][-1] + 1 On Wed, Jul 30, 2008 at 2:16 PM, Dan Upton <[EMAIL PROTECTED]> wrote: > > On Wed, Jul 30, 2008 at 2:22 PM, John Nagle <[EMAIL PROTE

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Russ P.
On Jul 30, 1:07 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Russ P. wrote: > > Oh, Lordy. I understand perfectly well how boolean tests, __len__, and > > __nonzero__ work in Python. It's very basic stuff. You can quit > > patronizing me (and Carl too, I'm sure). > > You suggested a syntax for

Re: Tkinter- Possibly a basic question

2008-07-30 Thread Guilherme Polo
On Wed, Jul 30, 2008 at 6:33 PM, <[EMAIL PROTECTED]> wrote: > I hate to do this, but I've thoroughly exhausted google search. Yes, > it's that pesky root window and I have tried withdraw to no avail. I'm > assuming this is because of the methods I'm using. I guess my question > is two-fold. > 1) H

Re: overriding file.readline: "an integer is required"

2008-07-30 Thread Gary Herron
kj wrote: I'm trying to subclass file, overriding the readline method. The new method definition begins with def readline(self, size=None): line = self.file.readline(size) # etc., etc. ...where the self.file attribute is a regular file object. This works fine if I invoke t

Re: Tkinter- Possibly a basic question

2008-07-30 Thread Russell Blau
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I hate to do this, but I've thoroughly exhausted google search. Yes, > it's that pesky root window and I have tried withdraw to no avail. I'm > assuming this is because of the methods I'm using. I guess my question > is two-fold. > 1) Ho

Re: how to split text into lines?

2008-07-30 Thread Miles
On Wed, Jul 30, 2008 at 4:45 PM, kj wrote: >>What's the Python idiom for splitting text into lines, preserving >>the end-of-line sequence in each line? > > > Sorry, I should have googled this first. I just found splitlines()... > > Still, for my own edification, is there a way to achieve the same

overriding file.readline: "an integer is required"

2008-07-30 Thread kj
I'm trying to subclass file, overriding the readline method. The new method definition begins with def readline(self, size=None): line = self.file.readline(size) # etc., etc. ...where the self.file attribute is a regular file object. This works fine if I invoke the new met

Tkinter- Possibly a basic question

2008-07-30 Thread joshdw4
I hate to do this, but I've thoroughly exhausted google search. Yes, it's that pesky root window and I have tried withdraw to no avail. I'm assuming this is because of the methods I'm using. I guess my question is two-fold. 1) How do I get rid of that window? 2) Any comments in general? I am just l

Re: seemingly simple list indexing problem

2008-07-30 Thread John Krukoff
On Wed, 2008-07-30 at 14:08 -0700, [EMAIL PROTECTED] wrote: > On 29 Jul., 01:05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > [Ervan Ensis] > > > > > I have a list like [108, 58, 68]. I want to return > > > the sorted indices of these items in the same order > > > as the original list. So I

Re: seemingly simple list indexing problem

2008-07-30 Thread wolfram . hinderer
On 29 Jul., 01:05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Ervan Ensis] > > > I have a list like [108, 58, 68]. I want to return > > the sorted indices of these items in the same order > > as the original list. So I should return [2, 0, 1] > > One solution is to think of the list indexes

Re: Python parsing iTunes XML/COM

2008-07-30 Thread Jerry Hill
On Wed, Jul 30, 2008 at 2:27 PM, william tanksley <[EMAIL PROTECTED]> wrote: > Awesome... Thank you! I had my mental model of Python turned around > backwards. That's an odd feeling. Okay, so you decode to go from raw > byes into a given encoding, and you encode to go from a given encoding > to raw

Re: How can I check nbr of cores of computer?

2008-07-30 Thread Leonhard Vogt
defn noob schrieb: How can I check how many cores my computer has? Is it possible to do this in a Python-app? processing (http://pyprocessing.berlios.de/) has an utility function processing.cpuCount(). Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python parsing iTunes XML/COM

2008-07-30 Thread Stefan Behnel
william tanksley wrote: > Okay, so you decode to go from raw > byes into a given encoding, and you encode to go from a given encoding > to raw bytes. No, decoding goes from a byte sequence to a Unicode string and encoding goes from a Unicode string to a byte sequence. Unicode is not an encoding.

Re: seemingly simple list indexing problem

2008-07-30 Thread John Krukoff
On Wed, 2008-07-30 at 12:06 -0700, Tobiah wrote: > On Mon, 28 Jul 2008 23:41:51 -0700, iu2 wrote: > > > On Jul 29, 3:59 am, John Machin <[EMAIL PROTECTED]> wrote: > >> On Jul 29, 8:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > >> > >> > >> > >> > >> > >> > On Mon, 2008-07-28 at 16:24 -0500, Er

Re: how to split text into lines?

2008-07-30 Thread kj
In <[EMAIL PROTECTED]> kj <[EMAIL PROTECTED]> writes: >In Perl, one can break a chunk of text into an array of lines while >preserving the trailing line-termination sequence in each line, if >any, by splitting the text on the regular expression /^/: > DB<1> x split(/^/, "foo\nbar\nbaz") >0 'f

how to split text into lines?

2008-07-30 Thread kj
In Perl, one can break a chunk of text into an array of lines while preserving the trailing line-termination sequence in each line, if any, by splitting the text on the regular expression /^/: DB<1> x split(/^/, "foo\nbar\nbaz") 0 'foo ' 1 'bar ' 2 'baz' But nothing like this seems to work

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Robert Dailey
On Wed, Jul 30, 2008 at 2:48 PM, Patrick Mullen <[EMAIL PROTECTED]>wrote: > Well, the linked thread gives many reasons, but as mentioned it is a > flamewar thread. Philosophically python is not an "object oriented" > language per say, it has an object system, a not bolted on one I might add, > bu

Re: static variables in Python?

2008-07-30 Thread 5lvqbwl02
kj wrote: > Yet another noob question... > > Is there a way to mimic C's static variables in Python? Or something > like it? The idea is to equip a given function with a set of > constants that belong only to it, so as not to clutter the global > namespace with variables that are not needed el

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Matthew Woodcraft
Terry Reedy <[EMAIL PROTECTED]> wrote: >Carl Banks wrote: >> That's not what I was asking for. I was asking for a use case for "if >> x" that can't be replaced by a simple explicit test. Your example >> didn't satisfy that. > But I believe my example of an iterator with __bool__ but not with

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Robert Dailey
On Wed, Jul 30, 2008 at 2:46 PM, Matthew Fitzgibbons <[EMAIL PROTECTED]>wrote: > Robert Dailey wrote: > >> On Wed, Jul 30, 2008 at 1:03 PM, Brett g Porter <[EMAIL PROTECTED]> [EMAIL PROTECTED]>> wrote: >> >>Robert Dailey wrote: >> >>This is an example of a response I'm looking for: >>

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Patrick Mullen
On Wed, Jul 30, 2008 at 12:27 PM, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Given the code samples above, is there any technical reason why this cannot > be done? Thanks for the input guys, and thanks more over for keeping this > easy-going. > > -- > http://mail.python.org/mailman/listinfo/pyth

Re: How do I include a shell variable in my script?

2008-07-30 Thread Tobiah
On Tue, 29 Jul 2008 07:53:53 -0700, laredotornado wrote: > Hi, > > I'm running a Python script on a Solaris 9 machine, invoking the > Python script from ksh, if that matters. There is an enviornment > variable, $JAVA_HOME, that I would like to include in my script, > replacing "/path/to/java/hom

Re: undo a dictionary

2008-07-30 Thread Alan Franzoni
mmm was kind enough to say: > My desire is to take a set of data items in an alpha-numeric range and > oput them into a dictionary > > i.e., > x1=1 > x2=20 > x3=33 > > to yield the dictionary > > { 'x1':1, 'x2':20, 'x3':33 } > > without having to type in as above but instead invoke a function

Re: SVN access with pysvn under Cygwin (Installation problems)

2008-07-30 Thread Jason Tishler
Andy, On Wed, Jul 30, 2008 at 07:46:32AM -0700, Andy Dingley wrote: > Trying to install the pysvn module I'm running into problems getting > it to work under Cygwin. Works fine from a Windows command prompt, > with both the svn_cmd.py example and my own Python code. Under Cygwin > though I just ge

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Robert Dailey
On Wed, Jul 30, 2008 at 1:03 PM, Brett g Porter <[EMAIL PROTECTED]> wrote: > Robert Dailey wrote: > > This is an example of a response I'm looking for: >> "The self parameter is required because the parser is a bit old and needs >> to know the exact object you're referencing" >> >> This is _not_

Re: undo a dictionary

2008-07-30 Thread mmm
> > And for that matter a way to create a > > dictionary from a set of variables (local or global). > > You have to be more specific: there are {} displays and dict(args) call > and other methods.  Read the manual. My desire is to take a set of data items in an alpha-numeric range and oput them in

Re: seemingly simple list indexing problem

2008-07-30 Thread Tobiah
On Mon, 28 Jul 2008 23:41:51 -0700, iu2 wrote: > On Jul 29, 3:59 am, John Machin <[EMAIL PROTECTED]> wrote: >> On Jul 29, 8:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: >> > > My programming skills are pretty rusty and I'm

Re: like py2exe, but on a mac

2008-07-30 Thread William McBrine
On Wed, 30 Jul 2008 16:57:35 +, I wrote: > [bundlebuidler] does put in a version-specific #! line, but if I change > that to #!/usr/bin/env python, the app still works, and it seems to me > that it will work for any version of Python on OS 10.4, 10.5, and maybe > 10.3. Then again, I see now t

Re: Native Code vs. Python code for modules

2008-07-30 Thread bearophileHUGS
John Nagle: > Personally, I think the Shed Skin approach > is more promising. ShedSkin will probably have scaling problems: as the program size grows it may need too much time to infer all the types. The author has the strict policy of refusing any kind of type annotation, this make it unpractical

Re: Python parsing iTunes XML/COM

2008-07-30 Thread william tanksley
"Jerry Hill" <[EMAIL PROTECTED]> wrote: > william tanksley <[EMAIL PROTECTED]> wrote: > > Here's one example. The others are similar -- they have the same > > things that look like problems to me. > > "Buffett Time - Annual Shareholders\xc2\xa0L.mp3" > > I tried doing track_id.encode("utf-8"), but

Re: Standard module for parsing emails?

2008-07-30 Thread Maric Michaud
Le Wednesday 30 July 2008 19:25:31 Diez B. Roggisch, vous avez écrit : > Maric Michaud wrote: > > Le Wednesday 30 July 2008 17:55:35 Aspersieman, vous avez écrit : > >> For parsing the mails I would recommend pyparsing. > > > > Why ? email module is a great parser IMO. > > He talks about parsing th

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread bearophileHUGS
Brett g Porter: > Fredrik Lundh has written a very clear explanation of this > athttp://effbot.org/pyfaq/why-must-self-be-used-explicitly-in-method-de... Today lot of people know that Ruby exists, so such FAQ explanation must explain why Python doesn't use a shorter syntax like for example @foo

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Peter Otten
Paul Boddie wrote: > Who wants to be first to submit a patch? ;-) And where? The sourceforge page says "PyXML is no longer maintained." Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I check nbr of cores of computer?

2008-07-30 Thread Dan Upton
On Wed, Jul 30, 2008 at 2:22 PM, John Nagle <[EMAIL PROTECTED]> wrote: > defn noob wrote: >> >> How can I check how many cores my computer has? >> Is it possible to do this in a Python-app? > >Why do you care? Python can't use more than one of them at > a time anyway. Per Python process, but

Re: Native Code vs. Python code for modules

2008-07-30 Thread John Nagle
koblas wrote: Ruby has been getting pummeled for the last year or more on the performance subject. They've been working hard at improving it. From my arm chair perspective Python is sitting on it's laurels and not taking this as seriously as it probably should. PyPy was supposed to help,

Re: How can I check nbr of cores of computer?

2008-07-30 Thread John Nagle
defn noob wrote: How can I check how many cores my computer has? Is it possible to do this in a Python-app? Why do you care? Python can't use more than one of them at a time anyway. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible to have multiple loop variables?

2008-07-30 Thread Marc 'BlackJack' Rintsch
On Wed, 30 Jul 2008 10:49:58 -0700, laredotornado wrote: > I don't know why I thought this would work, but I would like to have 3 > variables in my for loop per iteration. Those familiar will know that > this > > ms1 = {'managed1':7019:8020,'managed2':7020:8021} for m, lp, ssl_lp in > ms1.items(

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread John Nagle
Matthew Fitzgibbons wrote: Robert Dailey wrote: I've always been curious (more so than annoyed) as to why one must explicitly specify a "self" parameter for member functions in a class in Python. This seems very "C" like to me, since to do object oriented programming in C you must devote one p

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Brett g Porter
Robert Dailey wrote: This is an example of a response I'm looking for: "The self parameter is required because the parser is a bit old and needs to know the exact object you're referencing" This is _not_ an example of what I'm looking for: "Specifying self is a great mysterious thing that we

Re: proxy class and __add__ method

2008-07-30 Thread Rhamphoryncus
On Jul 29, 10:23 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 29 Jul 2008 13:13:51 -0300, Magnus Schuster   > <[EMAIL PROTECTED]> escribi : > > > > > Hello, > > I have written the following small proxy class which I expect to pass all > > function calls to the 'original' object: > >

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Paul Boddie
On 30 Jul, 19:23, Peter Otten <[EMAIL PROTECTED]> wrote: > > I'm on Kubuntu 7.10 and see the same error as Simon. The problem is in the > minidom.CharacterData class which has the following method > >     def __repr__(self): >         data = self.data >         if len(data) > 10: >             dotd

Re: static variables in Python?

2008-07-30 Thread Rhamphoryncus
On Jul 29, 2:40 pm, kj <[EMAIL PROTECTED]> wrote: > Yet another noob question... > > Is there a way to mimic C's static variables in Python?  Or something > like it?  The idea is to equip a given function with a set of > constants that belong only to it, so as not to clutter the global > namespace

Re: Questions about asyncore

2008-07-30 Thread Giampaolo Rodola'
On 30 Lug, 09:49, Frank Millman <[EMAIL PROTECTED]> wrote: > On Jul 29, 3:40 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > On 29 Lug, 13:09, Frank Millman <[EMAIL PROTECTED]> wrote: > > Thanks for the reply, Giampaolo. Glad to help. > > The benefit of asynchat is that it automatically

Possible to have multiple loop variables?

2008-07-30 Thread laredotornado
I don't know why I thought this would work, but I would like to have 3 variables in my for loop per iteration. Those familiar will know that this ms1 = {'managed1':7019:8020,'managed2':7020:8021} for m, lp, ssl_lp in ms1.items(): managedServer = create(m,'Server') print 'creating mana

Re: Syntax error in my script

2008-07-30 Thread laredotornado
On Jul 30, 11:26 am, Alan Franzoni <[EMAIL PROTECTED]> wrote: > laredotornadowas kind enough to say: > > [cut] > > Indentation counts in Python. You're probably doing something wrong with > whitespace/tab/carriage return. > > -- > Alan Franzoni <[EMAIL PROTECTED]> > - > Remove .xyz from my email in

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Stefan Behnel
Simon Willison wrote: > Follow up question: what's the best way of incrementally consuming XML > in Python that's character encoding aware? iterparse(), as implemented in (c)ElementTree and lxml. Note that ElementTree and cElementTree are part of Python 2.5, in the xml.etree package. > I have a

Re: Standard module for parsing emails?

2008-07-30 Thread Diez B. Roggisch
Maric Michaud wrote: > Le Wednesday 30 July 2008 17:55:35 Aspersieman, vous avez écrit : >> For parsing the mails I would recommend pyparsing. > > Why ? email module is a great parser IMO. He talks about parsing the *content*, not the email envelope and possible mime-body. Diez -- http://mail.p

Re: Syntax error in my script

2008-07-30 Thread Alan Franzoni
laredotornado was kind enough to say: [cut] Indentation counts in Python. You're probably doing something wrong with whitespace/tab/carriage return. -- Alan Franzoni <[EMAIL PROTECTED]> - Remove .xyz from my email in order to contact me. - GPG Key Fingerprint: 5C77 9DC3 BD5B 3A28 E7BC 921A 02

Re: Standard module for parsing emails?

2008-07-30 Thread MRAB
On Jul 30, 3:11 pm, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > On Jul 30, 2:36 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > > What do you mean with "quote" here? > >   2. Prefix of quoted text like your text above in my mail > > Basically, just be able to parse an email into its actual and

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Peter Otten
Paul Boddie wrote: > On 30 Jul, 18:17, Simon Willison <[EMAIL PROTECTED]> wrote: >> >> Some very useful people in #python on Freenode pointed out that my bug >> occurs because I'm trying to display things interactively in the >> console. Saving to a variable instead fixes the problem. > > What's

Re: undo a dictionary

2008-07-30 Thread Terry Reedy
mmm wrote: I found code to undo a dictionary association. def undict(dd, name_space=globals()): for key, value in dd.items(): exec "%s = %s" % (key, repr(value)) in name_space You are not undoing anything. You are updating globals() from another dict. But why repr(value)? Wit

Re: like py2exe, but on a mac

2008-07-30 Thread William McBrine
On Tue, 29 Jul 2008 12:24:49 -0700, Russell E. Owen wrote: > That is exactly what py2app does by default if you run py2app with the > system python. Thanks. I see that it* avoids the issue with Tk starting in the background that I get with Platypus, too. In fact, it looks like the bundlebuilder

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Matthew Fitzgibbons
Robert Dailey wrote: Hi, I want to point out first of all that I'm not as familiar with Python as I should be, and for that reason I question a lot of things because I'm mainly a C++ programmer and I'm used to certain conveniences. Having said that... I've always been curious (more so than

Interbase

2008-07-30 Thread Mike Hjorleifsson
Has anyone gotten python working with Interbase database platform ? I need to query some info from an interbase database on another server need a lil help getting started. -- http://mail.python.org/mailman/listinfo/python-list

Re: Build tool for Python

2008-07-30 Thread Tim Arnold
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > Hussein B wrote: >> Hi. >> Apache Ant is the de facto building tool for Java (whether JSE, JEE >> and JME) application. >> With Ant you can do what ever you want: compile, generate docs, >> generate code, packing, depl

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Ethan Furman
Carl Banks wrote: On Jul 29, 6:42 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: I don't have any postable code (it's in a half way state and I haven't touched it for a while), but I'll see if I can't find the time to bang something up to give you the gist. I wouldn't bother at this point.

Re: Is there a such Python module ?

2008-07-30 Thread Matthew Fitzgibbons
Johny wrote: Is there a Python module that can help with reading SMS message from a mobile phone? Or is there an example how to read SMS message using a program written in Python,C, or any other language? Thank you very much for help L. -- http://mail.python.org/mailman/listinfo/python-list Th

  1   2   >