Re: Mixing Decimal and float

2010-06-04 Thread B.V.
On Jun 3, 2:00 am, Chris Rebert wrote: > On Wed, Jun 2, 2010 at 4:11 PM, Steven D'Aprano > > wrote: > > On Wed, 02 Jun 2010 17:17:11 -0400, Nathan Rice wrote: > >> My apologies if someone already mentioned this and I missed it but... > > >> class.__instancecheck__(self, instance) - Return true if

Re: Mixing Decimal and float

2010-06-04 Thread B.V.
On Jun 2, 10:35 pm, I V wrote: > On Wed, 02 Jun 2010 05:17:11 -0700, B.V. wrote: > > But trying to be open to other languages, the server implements also an > > XMLRPC interface (and also a JSONRPC-like interface). That's the key > > point: Decimal is python specific. So in an application, you can

Parse and clean odt docs: with lxml ? hints to start ?

2010-06-04 Thread kaer
Basically, I have to upgrade a website with a lot of new content. I received those docs in the openoffice format. If I open and save one of those documents in the html format, I can cut and paste the result in the html page, it's not that bad as a start but I need to clean that html (remove tags,

Re: Windows and My Documents

2010-06-04 Thread Tim Golden
On 03/06/2010 17:50, Bob Greschke wrote: On 2010-06-03 09:57:11 -0600, Tim Golden said: On 03/06/2010 16:39, Bob Greschke wrote: How do I do a "listdir" (or whatever I need to use) of the Desktop on a Windows machine and have "folders" like My Documents show up in the result? I'm specificall

Re: changing format of time duration.

2010-06-04 Thread Günther Dietrich
Gabriel Genellina wrote: >Try the strptime method with a suitable format, like this (untested): >delta = now2-now1 >delta.strftime('%H:%M:%S.%f') Throws an exception: |Traceback (most recent call last): | File "", line 1, in |AttributeError: 'datetime.timedelta' object has no attribute 'strft

Re: if, continuation and indentation

2010-06-04 Thread Giacomo Boffi
HH writes: > if (width == 0 and > height == 0 and > color == 'red' and > emphasis == 'strong' or > highlight > 100): > raise ValueError("sorry, you lose") if (width == 0 and height == 0 and color == 'red' and emphasis == 'strong' or

Re: queries about exceptions(newbie)

2010-06-04 Thread Payal
On Thu, Jun 03, 2010 at 11:42:16PM -0700, Chris Rebert wrote: > >>> try: > ... x[1] > ... except IndexError as e: > ... print "Got error:", e.args[0] # grab the error message > ... > Got error: list index out of range Thanks a lot. This example solved what the tutorial could not. With war

threading and atexit: different behaviour in python2.6 from 2.5

2010-06-04 Thread Alan
Hi there, That's another try to get help about this issue I am facing. To help you to help me here goes a simple example. This is a very simplification of a very complex code. thread_ping.py begin import time import sys import atexit from threading import

one more exception newbie query

2010-06-04 Thread Payal
Hi all, In http://docs.python.org/tutorial/errors.html#handling-exceptions it says, | >>> try: | ...raise Exception('spam', 'eggs') Why would I want to use a class for exception? I could simply use raise w/o it? Also the help() says, class Exception(BaseException) But we have used 'spam' and

Re: one more exception newbie query

2010-06-04 Thread Chris Rebert
On Fri, Jun 4, 2010 at 3:10 AM, Payal wrote: > Hi all, > In http://docs.python.org/tutorial/errors.html#handling-exceptions it > says, > > | >>> try: > | ...    raise Exception('spam', 'eggs') > > Why would I want to use a class for exception? I could simply use raise > w/o it? `raise Foo, "whate

BerkeleyTIP Join June Global Free SW HW Culture Mtgs via VOIP or in Berkeley

2010-06-04 Thread giovanni_re
Video: Scientific data visualization using Mayavi2, Gael Varoquaux, Python4ScienceUCB = You're invited to join in with the friendly people at the BerkeleyTIP global meeting - newbie to Ph.D. - everyone is invited. Get a headset & join using VOIP online, or come to Berkeley. 1st step: Join

Re: getting MemoryError with dicts; suspect memory fragmentation

2010-06-04 Thread Emin.shopper Martinian.shopper
On Thu, Jun 3, 2010 at 10:00 PM, dmtr wrote: > I'm still unconvinced that it is a memory fragmentation problem. It's > very rare. You could be right. I'm not an expert on python memory management. But if it isn't memory fragmentation, then why is it that I can create lists which use up 600 more M

Re: Python Forum

2010-06-04 Thread Adam Tauno Williams
On Thu, 2010-06-03 at 15:40 -0700, Phlip wrote: > On Jun 3, 3:20 pm, geremy condra wrote: > > > You mean like how I never get answers, to my super-easy GED-level > > > questions, here??! > > I agree. This proves conclusively that a web forum is the right > > place for you. > Ah, so you feel up to

Re: one more exception newbie query

2010-06-04 Thread Payal
Hi, I will continue this problem here & take the next to the tutor list. On Fri, Jun 04, 2010 at 03:22:35AM -0700, Chris Rebert wrote: > `raise Foo, "whatever"` and `raise Foo("whatever")` do the same thing; > the former is deprecated though as it's been removed from Python 3.x Actually I thought

Re: great

2010-06-04 Thread Jean-Michel Pichavant
joblack wrote: Great - it works. Thanks a lot. Thread of the week :) JM -- http://mail.python.org/mailman/listinfo/python-list

[python] pass the name of args

2010-06-04 Thread macm
Hi Folks def myDef(x) doSomething x result = x. return coolThings - WhatYourName = ('python','is','cool') myDef(WhatYourName) so what I am looking for in myDef result = WhatYourName -- again :

Re: questions about how to parse a string and put it in a dictionary

2010-06-04 Thread Tim Chase
On 06/03/2010 09:21 PM, joblack wrote: I've got a string which (without any CR or LF) consists of 'attribute1=attribute_value;attribute2=attribute_value2; ...' and I want them to read in a dictionary so that the attribute name is the key and the attribute value is the data. Any ideas for an im

Re: one more exception newbie query

2010-06-04 Thread Alf P. Steinbach
* Payal, on 04.06.2010 12:10: Hi all, In http://docs.python.org/tutorial/errors.html#handling-exceptions it says, |>>> try: | ...raise Exception('spam', 'eggs') Why would I want to use a class for exception? I could simply use raise w/o it? Also the help() says, class Exception(BaseExcepti

Missing DLL in win98

2010-06-04 Thread Spyder42
I hope this is the right place to ask this, and appologise if it's not. I'm trying to install 2.6.5 in Win98 se final. It says "a required dll could not be run". Do I have to upgrade my whole OS just to install this, or is there a fix I can apply to 98 to make it work. The installer doesn't say wha

Re: Missing DLL in win98

2010-06-04 Thread Christian Heimes
Am 04.06.2010 14:38, schrieb Spyder42: > I hope this is the right place to ask this, and appologise if it's > not. I'm trying to install 2.6.5 in Win98 se final. It says "a > required dll could not be run". Do I have to upgrade my whole OS just > to install this, or is there a fix I can apply to 98

Re: [python] pass the name of args

2010-06-04 Thread Chris Rebert
On Fri, Jun 4, 2010 at 4:32 AM, macm wrote: > Hi Folks > > def myDef(x) >        doSomething x >        result = x. >        return coolThings > - > > WhatYourName = ('python','is','cool') > > myDef(WhatYourName) > > so what I am looking for in myDef > >        

Re: Python Forum

2010-06-04 Thread Pierre Quentel
On 4 juin, 07:11, Steven D'Aprano wrote: > On Thu, 03 Jun 2010 03:16:03 -0700, Pierre Quentel wrote: > > So the OP's initiative should be an incentive to think on the format of > > the interaction between all the range of Python users, from newbees to > > gurus. We are in the 2.0 era, with social

Re: Missing DLL in win98

2010-06-04 Thread Spyder42
On Fri, 04 Jun 2010 14:50:28 +0200, Christian Heimes wrote: > >Python 2.6 is not supported on Windows 98 and earlier. You need at least >Windows 2000 with a recent service pack. > >Christian So your response is either, you don't know if there is a fix, or 'No way in h377.' You couldn't figure o

Re: Missing DLL in win98

2010-06-04 Thread Christian Heimes
> So your response is either, you don't know if there is a fix, or 'No > way in h377.' You couldn't figure out by my post that I already knew > that? Let me paraphrase my answer: You can't run Python 2.6 on Windows 98 because we have dropped support for any Windows older than Windows 2000 SP4. I

Re: Plain simple unix timestamp with an HTTP GET

2010-06-04 Thread Ross
On Jun 3, 11:20 pm, livibetter wrote: > This? > > hwclock --utc --set --date="$(datestr="$(curlhttp://208.66.175.36:13/ > 2>/dev/null | cut -d \  -f 2-3)" ; echo ${datestr//-//})" > > Only hwclock, curl, cut, and Bash. > > PS. I didn't know I can set the time via hwclock, learned from Paul's > pos

Wing IDE 3.2.8 released: Adds Python 2.7 support

2010-06-04 Thread Wingware
Hi, Wingware has released version 3.2.8 of Wing IDE, an integrated development environment designed specifically for the Python programming language. This release includes the following minor features and improvements: * Support for Python 2.7 * Partially updated French localization of the GUI

Re: Missing DLL in win98

2010-06-04 Thread Spyder42
On Fri, 04 Jun 2010 15:32:15 +0200, Christian Heimes wrote: >> So your response is either, you don't know if there is a fix, or 'No >> way in h377.' You couldn't figure out by my post that I already knew >> that? > >Let me paraphrase my answer: > >You can't run Python 2.6 on Windows 98 because w

Re: Python Forum

2010-06-04 Thread Jim Byrnes
Steven D'Aprano wrote: On Thu, 03 Jun 2010 22:05:19 -0700, Phlip wrote: On Jun 3, 9:54 pm, Steven D'Aprano wrote: I don't know what rubbish ISPs you're dealing with You've heard of a little fly-by-night outfit called AT&T? Yes I have. Aren't they the people who were engaged in a long-run

Re: Missing DLL in win98

2010-06-04 Thread nn
On Jun 4, 9:53 am, Spyder42 wrote: > On Fri, 04 Jun 2010 15:32:15 +0200, Christian Heimes > > wrote: > >> So your response is either, you don't know if there is a fix, or 'No > >> way in h377.' You couldn't figure out by my post that I already knew > >> that? > > >Let me paraphrase my answer: > >

Re: threading and atexit: different behaviour in python2.6 from 2.5

2010-06-04 Thread MRAB
Alan wrote: Hi there, That's another try to get help about this issue I am facing. To help you to help me here goes a simple example. This is a very simplification of a very complex code. thread_ping.py begin import time import sys import atexit from

Re: Missing DLL in win98

2010-06-04 Thread Chris W
On Jun 4, 8:53 am, Spyder42 wrote: > On Fri, 04 Jun 2010 15:32:15 +0200, Christian Heimes > > wrote: > >> So your response is either, you don't know if there is a fix, or 'No > >> way in h377.' You couldn't figure out by my post that I already knew > >> that? > > >Let me paraphrase my answer: > >

Re: parse xml with invalid chars

2010-06-04 Thread Someone Something
What d'ya mean hang? On Fri, Jun 4, 2010 at 10:16 AM, Roman Makurin wrote: > Hi all > > Last time i have a big problem, i need parse xml files > which have invalid xml chars outside of CDATA and xml > parser hangs everytime on such files. Is there any way > to parse such files ??? > > thanks > >

weird pickle behavior in Python 3.1.2 + Eclipse 3.5.2

2010-06-04 Thread [email protected]
Here we are in an Eclipse pydev console, running Python 3.1.2. For the most part, everything is working great. However... >>> import sys; print('%s %s' % (sys.executable or sys.platform, sys.version)) C:\Python31\python.exe 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] >

Re: Python Forum

2010-06-04 Thread Michael Torrie
On 06/03/2010 04:15 AM, Adam Tauno Williams wrote: > The best solution I've seen is what is used by the Mono project; > which provides both a "web forum" and a mail list interface. > > > I just checked the archives

Re: How to generate execute file that include enthought.traits.api , enthought.traits.ui.api ?

2010-06-04 Thread Robert Kern
On 6/3/10 10:05 PM, ray wrote: Hi all, I code the program that using enthought.traits.api , enthought.traits.ui.api. I want to genereate execute file.I try PY2EXE,bb- freeze,cx_freeze,Pyinstaller ,but the execute files can not run successful. The attach file is my source code. My environme

Re: getting MemoryError with dicts; suspect memory fragmentation

2010-06-04 Thread Bryan
Emin.shopper wrote: > dmtr wrote: > > I'm still unconvinced that it is a memory fragmentation problem. It's > > very rare. > > You could be right. I'm not an expert on python memory management. But > if it isn't memory fragmentation, then why is it that I can create > lists which use up 600 more MB

Re: getting MemoryError with dicts; suspect memory fragmentation

2010-06-04 Thread Philip Semanchuk
On Jun 4, 2010, at 12:06 PM, Bryan wrote: Emin.shopper wrote: dmtr wrote: I'm still unconvinced that it is a memory fragmentation problem. It's very rare. You could be right. I'm not an expert on python memory management. But if it isn't memory fragmentation, then why is it that I can

Re: Python Forum

2010-06-04 Thread Emile van Sebille
On 6/3/2010 10:41 PM Steven D'Aprano said... On Thu, 03 Jun 2010 06:15:20 -0400, Adam Tauno Williams wrote: Most people use this list via e-mail, How do you know? Do you have evidence for this, or are you just making it up? Is there now a non-email method of posting to this list? Emile

Re: weird pickle behavior in Python 3.1.2 + Eclipse 3.5.2

2010-06-04 Thread Peter Otten
[email protected] wrote: > Here we are in an Eclipse pydev console, running Python 3.1.2. For > the most part, everything is working great. > > However... > import sys; print('%s %s' % (sys.executable or sys.platform, sys.version)) > C:\Python31\python.exe 3.1.2 (r312:79149, Mar 2

Re: Issue with xml iterparse

2010-06-04 Thread bfrederi
On Jun 3, 4:13 pm, bfrederi wrote: > On Jun 3, 3:59 pm, Chris Rebert wrote: > > > > > On Thu, Jun 3, 2010 at 1:44 PM, bfrederi wrote: > > > I am using lxml iterparse and running into a very obscure error. When > > > I run iterparse on a file, it will occasionally return an element that > > > has

General questions - where & how

2010-06-04 Thread Uriah Eisenstein
Hi all, I'm relatively new to Python and have a few questions. Frankly, it took me a while to find on python.org what seems like a suitable place to post my questions. However, I'd like to check the archives and see if they haven't been discussed already... But I don't find a Search function. Is th

Re: General questions - where & how

2010-06-04 Thread Alex Hall
I am not sure about a search feature for the archives, but I can tell you about a "tutor" list for those new and somewhat new to Python (like me). Of course, both that list and this one are excellent resources, but the tutor list seems to be for questions generally encountered by relatively new Pyt

strange syntax error

2010-06-04 Thread _wolf
this may not be an earth-shattering deficiency of python, but i still wonder about the rationale behind the following behavior: when i run :: source = """ print( 'helo' ) if __name__ == '__main__': print( 'yeah!' ) #""" print( compile( source, '', 'exec' ) ) i get :: File "",

Re: General questions - where & how

2010-06-04 Thread Philip Semanchuk
On Jun 4, 2010, at 1:22 PM, Uriah Eisenstein wrote: Hi all, I'm relatively new to Python and have a few questions. Frankly, it took me a while to find on python.org what seems like a suitable place to post my questions. However, I'd like to check the archives and see if they haven't been

Re: weird pickle behavior in Python 3.1.2 + Eclipse 3.5.2

2010-06-04 Thread [email protected]
On Jun 4, 9:47 am, Peter Otten <[email protected]> wrote: > I can provoke the error in "naked" Python 3 by changing the > Example.__module__ attribute: > > Python 3.1.1+ (r311:74480, Nov  2 2009, 15:45:00) > [GCC 4.4.1] on linux2 > Type "help", "copyright", "credits" or "license" for more informati

Re: [python] pass the name of args

2010-06-04 Thread Terry Reedy
On 6/4/2010 7:32 AM, macm wrote: A few types of objects have definition names (.__name__ attribute). All have 0 to many namespace names. If you want to pass an attribute name, pass it -- as a string. def myDef(x) doSomething x result = x. return coolThings def f

Re: General questions - where & how

2010-06-04 Thread Terry Reedy
On 6/4/2010 1:35 PM, Philip Semanchuk wrote: On Jun 4, 2010, at 1:22 PM, Uriah Eisenstein wrote: Hi all, I'm relatively new to Python and have a few questions. Frankly, it took me a while to find on python.org what seems like a suitable place to post my questions. However, I'd like to check th

Re: Missing DLL in win98

2010-06-04 Thread Terry Reedy
On 6/4/2010 9:08 AM, Spyder42 wrote: On Fri, 04 Jun 2010 14:50:28 +0200, Christian Heimes Python 2.6 is not supported on Windows 98 and earlier. You need at least Windows 2000 with a recent service pack. Christian So your response is either, you don't know if there is a fix, or 'No way in h

Street address parsing in Python, again.

2010-06-04 Thread John Nagle
I'm still struggling with street address parsing in Python. (Previous discussion: http://www.velocityreviews.com/forums/t720759-usable-street-address-parser-in-python.html) I need something good enough to reliably extract street name and number. That gives me something I can match against

tallying occurrences in list

2010-06-04 Thread kj
Task: given a list, produce a tally of all the distinct items in the list (for some suitable notion of "distinct"). Example: if the list is ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a'], then the desired tally would look something like this: [('a', 4), ('b', 3), ('c', 3)] I find myself

Re: Python Forum

2010-06-04 Thread John Bokma
Steven D'Aprano writes: > But the really sad thing is that you think that "bigger" automatically > equals "better". I don't think that was the point. Anyway, not everbody can pick a provider, there are plenty of places that have only one or maybe two. And if that's the choice and neither carri

Re: Python Forum

2010-06-04 Thread Andreas Waldenburger
On Fri, 04 Jun 2010 00:57:15 +1000 Ben Finney wrote: > Andreas Waldenburger writes: > > > But consolidation is the *only* way to go, really. The parallelism > > between c.l.p. and python-list is great already. Now throw some sort > > of Forum in the mix > > This already *is* a forum. Whatever

Re: Python Forum

2010-06-04 Thread Terry Reedy
On 6/4/2010 12:28 PM, Emile van Sebille wrote: Is there now a non-email method of posting to this list? Google <==> comp.lang.python <==> python-list <==> gmane.comp.python.general where <==> is a bi-directional gateway. Gmane mirrors about 250 other Python mailing lists under gman.comp.pyt

Re: tallying occurrences in list

2010-06-04 Thread Paul Rubin
kj writes: > 1. is there a standard name for it? I don't know of one, or a stdlib for it, but it's pretty trivial. > def tally(c): > t = dict() > for x in c: > t[x] = t.get(x, 0) + 1 > return sorted(t.items(), key=lambda x: (-x[1], x[0])) I like to use defaultdict and tuple

Re: tallying occurrences in list

2010-06-04 Thread Peter Otten
kj wrote: > > > > > > Task: given a list, produce a tally of all the distinct items in > the list (for some suitable notion of "distinct"). > > Example: if the list is ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', > 'c', 'a'], then the desired tally would look something like this: > > [('a', 4),

Re: Python Forum

2010-06-04 Thread Alf P. Steinbach
* Andreas Waldenburger, on 04.06.2010 20:21: On Fri, 04 Jun 2010 00:57:15 +1000 Ben Finney wrote: Andreas Waldenburger writes: But consolidation is the *only* way to go, really. The parallelism between c.l.p. and python-list is great already. Now throw some sort of Forum in the mix This

Re: tallying occurrences in list

2010-06-04 Thread Magdoll
On Jun 4, 11:28 am, Paul Rubin wrote: > kj writes: > > 1. is there a standard name for it? > > I don't know of one, or a stdlib for it, but it's pretty trivial. > > > def tally(c): > >     t = dict() > >     for x in c: > >         t[x] = t.get(x, 0) + 1 > >     return sorted(t.items(), key=lambd

Re: Python Forum

2010-06-04 Thread Andreas Waldenburger
On Fri, 04 Jun 2010 09:28:23 -0700 Emile van Sebille wrote: > On 6/3/2010 10:41 PM Steven D'Aprano said... > > On Thu, 03 Jun 2010 06:15:20 -0400, Adam Tauno Williams wrote: > >> Most people use this list via e-mail, > > > > How do you know? Do you have evidence for this, or are you just > > maki

Re: Python Forum

2010-06-04 Thread John Bokma
Pierre Quentel writes: > They certainly *can* distinguish. But it's so easy to make it more > explicit with syntax highlighting, background color, border etc. that > most sites about programing languages use it, including the Python > home site itself, or the Python cookbook on Active State [..]

Re: tallying occurrences in list

2010-06-04 Thread Magdoll
On Jun 4, 11:33 am, Peter Otten <[email protected]> wrote: > kj wrote: > > > Task: given a list, produce a tally of all the distinct items in > > the list (for some suitable notion of "distinct"). > > > Example: if the list is ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', > > 'c', 'a'], then the desired

Re: strange syntax error

2010-06-04 Thread Jerry Hill
On Fri, Jun 4, 2010 at 1:31 PM, _wolf wrote: >    File "", line 6 >      # >      ^ >  SyntaxError: invalid syntax I believe you're encountering this bug: http://bugs.python.org/issue1184112 It's been fixed for 2.7 and 3.2. Until then, you'll need to work around it. You can either append a new

Re: Python Forum

2010-06-04 Thread John Bokma
Steven D'Aprano writes: > Sure, a lot of those 1,800 posts are spam, but the spammers wouldn't > waste their time if they didn't think there were people still on > Usenet. Heh, since spamming goes automatically who cares how many people it reaches. I also see spam in which people forget to incl

Re: Python Forum

2010-06-04 Thread John Bokma
Emile van Sebille writes: > On 6/3/2010 10:41 PM Steven D'Aprano said... >> On Thu, 03 Jun 2010 06:15:20 -0400, Adam Tauno Williams wrote: >>> Most people use this list via e-mail, >> >> How do you know? Do you have evidence for this, or are you just making it >> up? >> > > Is there now a non-ema

Re: Python Forum

2010-06-04 Thread Andreas Waldenburger
On Fri, 04 Jun 2010 20:36:02 +0200 "Alf P. Steinbach" wrote: > * Andreas Waldenburger, on 04.06.2010 20:21: > > On Fri, 04 Jun 2010 00:57:15 +1000 Ben Finney > > wrote: > > > >> Andreas Waldenburger writes: > >> > >>> But consolidation is the *only* way to go, really. The parallelism > >>> bet

Re: tallying occurrences in list

2010-06-04 Thread MRAB
kj wrote: Task: given a list, produce a tally of all the distinct items in the list (for some suitable notion of "distinct"). Example: if the list is ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a'], then the desired tally would look something like this: [('a', 4), ('b', 3), ('c', 3)] I

Re: Python Forum

2010-06-04 Thread Emile van Sebille
On 6/4/2010 11:27 AM Terry Reedy said... On 6/4/2010 12:28 PM, Emile van Sebille wrote: Is there now a non-email method of posting to this list? Google <==> comp.lang.python <==> python-list <==> gmane.comp.python.general where <==> is a bi-directional gateway. Yes -- I use gmane as well.

Re: Python Forum

2010-06-04 Thread Alf P. Steinbach
* John Bokma, on 04.06.2010 20:19: Steven D'Aprano writes: But the really sad thing is that you think that "bigger" automatically equals "better". I don't think that was the point. Anyway, not everbody can pick a provider, there are plenty of places that have only one or maybe two. And if t

how to access data attributes of a class object

2010-06-04 Thread namrata
Hi, i am new to python and sqlalchemy. so my doubt mite be very silly. I am creating an instance of a class. for example let the class be Temp and the attributes of the class be first_name and last_name. in order to access the attributes i will usually use the following command: a = Temp() a.last

Re: Python Forum

2010-06-04 Thread Lie Ryan
On 06/04/10 11:56, John Bokma wrote: > Phlip writes: > >> On Jun 3, 3:20 pm, geremy condra wrote: >> You mean like how I never get answers, to my super-easy GED-level questions, here??! >>> >>> I agree. This proves conclusively that a web forum is the right >>> place for you. >> >> Ah,

Re: how to access data attributes of a class object

2010-06-04 Thread Peter Otten
namrata wrote: > I am creating an instance of a class. for example let the class be > Temp and the attributes of the class be first_name and last_name. > in order to access the attributes i will usually use the following > command: > a = Temp() > a.last_name = "***" > > now, i am using sqlalc

RE: [python] pass the name of args

2010-06-04 Thread jyoung79
Would vars() help? Check out this link: http://www.daniweb.com/forums/thread134555.html Jay -- > def myDef(x) > doSomething x > result = x. > return coolThings > - > > WhatYourName = ('python','is','cool') > > myDef(WhatYourName) > > so

Re: Street address parsing in Python, again.

2010-06-04 Thread John Nagle
John Nagle wrote: The parser at PyParsing: http://pyparsing.wikispaces.com/file/view/streetAddressParser.py ..Bad cases... 487 E. Middlefield Rd. -> streetnumber = 487, streetname = E. MIDDLEFIELD 487 East Middlefield Road -> streetnumber = 487, streetname = EAST MIDDLEFIELD 226 West

Re: Python Forum

2010-06-04 Thread Lie Ryan
On 06/05/10 04:19, John Bokma wrote: > Steven D'Aprano writes: > >> But the really sad thing is that you think that "bigger" automatically >> equals "better". > > I don't think that was the point. > > Anyway, not everbody can pick a provider, there are plenty of places > that have only one or

Re: Python Forum

2010-06-04 Thread Lie Ryan
On 06/05/10 05:04, Emile van Sebille wrote: > On 6/4/2010 11:27 AM Terry Reedy said... >> On 6/4/2010 12:28 PM, Emile van Sebille wrote: >> >>> Is there now a non-email method of posting to this list? >> >> Google <==> comp.lang.python <==> python-list <==> >> gmane.comp.python.general >> >> where

Re: signed vs unsigned int

2010-06-04 Thread Patrick Maupin
On Jun 2, 6:25 am, John Machin wrote: > On Jun 2, 4:43 pm, johnty wrote: > > > i'm reading bytes from a serial port, and storing it into an array. > > > each byte represents a signed 8-bit int. > > > currently, the code i'm looking at converts them to an unsigned int by > > doing ord(array[i]). h

bz2 module doesn't work properly with all bz2 files

2010-06-04 Thread Magdoll
I'm not sure what's causing this, but depending on the compression program used, the bz2 module sometimes exits earlier. I used pbzip2 to compress my bz2 files and read through the file using the bz2 module. The file descriptor always exits much earlier than where the actual EOF is. If I use bzip2

Re: Diff of Text

2010-06-04 Thread Patrick Maupin
On Jun 3, 9:54 pm, GZ wrote: > Hi All, > > I am looking for an algorithm that can compare to source code files > line by line and find the minimum diff. I have looked at the difflib > included in python. The problem is that it is designed to make the > diff results easier for humans to read, inste

Re: tallying occurrences in list

2010-06-04 Thread Lie Ryan
On 06/05/10 04:38, Magdoll wrote: > On Jun 4, 11:33 am, Peter Otten <[email protected]> wrote: >> kj wrote: >> >>> Task: given a list, produce a tally of all the distinct items in >>> the list (for some suitable notion of "distinct"). >> >>> Example: if the list is ['a', 'b', 'c', 'a', 'b', 'c', 'a'

Re: signed vs unsigned int

2010-06-04 Thread John Nagle
johnty wrote: i'm reading bytes from a serial port, and storing it into an array. Try reading into a type "bytearray". That's the proper data type for raw bytes. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: how to access data attributes of a class object

2010-06-04 Thread namrata
Thanks a lot Peter. It works. On Jun 4, 12:26 pm, Peter Otten <[email protected]> wrote: > namrata wrote: > > I am creating an instance of a class. for example let the class be > > Temp and the attributes of the class be first_name and last_name. > > in order to access the attributes i will usually

Plotting in batch with no display

2010-06-04 Thread Hans Georg Schaathun
Admittedly not the strongest reason, but yet an important one, for switching from Matlab to python/numpy/scipy/matplotlib, is that Matlab is very cumbersome to run in batch. Now I discover that some of the matplotlib.pyplot functions (incl. plot and contour) insist on opening an X11 window (just

Re: getting MemoryError with dicts; suspect memory fragmentation

2010-06-04 Thread Bryan
Philip Semanchuk wrote: > At PyCon 2010, Brandon Craig Rhodes presented about how dictionaries   > work under the > hood:http://python.mirocommunity.org/video/1591/pycon-2010-the-mighty-dict... > > I found that very informative. That's a fine presentation of hash tables in general and Python's ch

Re: tallying occurrences in list

2010-06-04 Thread kj
Thank you all! ~K -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Forum

2010-06-04 Thread John Bokma
"Alf P. Steinbach" writes: > * John Bokma, on 04.06.2010 20:19: >> Steven D'Aprano writes: >> >>> But the really sad thing is that you think that "bigger" automatically >>> equals "better". >> >> I don't think that was the point. >> >> Anyway, not everbody can pick a provider, there are plenty o

Re: Python Forum

2010-06-04 Thread John Bokma
Lie Ryan writes: > On 06/04/10 11:56, John Bokma wrote: >> Phlip writes: >> >>> On Jun 3, 3:20 pm, geremy condra wrote: >>> > You mean like how I never get answers, to my super-easy GED-level > questions, here??! I agree. This proves conclusively that a web forum is the right

Re: Python Forum

2010-06-04 Thread John Bokma
Lie Ryan writes: > On 06/05/10 04:19, John Bokma wrote: >> Steven D'Aprano writes: >> >>> But the really sad thing is that you think that "bigger" automatically >>> equals "better". >> >> I don't think that was the point. >> >> Anyway, not everbody can pick a provider, there are plenty of pl

Re: Plotting in batch with no display

2010-06-04 Thread Emile van Sebille
On 6/4/2010 1:01 PM Hans Georg Schaathun said... Admittedly not the strongest reason, but yet an important one, for switching from Matlab to python/numpy/scipy/matplotlib, is that Matlab is very cumbersome to run in batch. Now I discover that some of the matplotlib.pyplot functions (incl. plot a

Re: if, continuation and indentation

2010-06-04 Thread Aahz
In article , Tim Chase wrote: > >While it's not PEP material, I tend to use the coding standards I >learned working for Computer Sciences Corporation (10 yrs ago, so >things may have changed) that mandated 2 levels of indentation >for continued lines, turning the above into > > if (width ==

Re: Python Forum

2010-06-04 Thread geremy condra
On Fri, Jun 4, 2010 at 1:55 PM, John Bokma wrote: > I know of the use of Lena. And to be honest, I agree with Playboy that > they have the copyright. Some of the articles published on image > processing end up behind a paywall or in a book. And I don't think the > authors will be very happy if I c

Re: Diff of Text

2010-06-04 Thread GZ
Hi Pat, On Jun 4, 2:55 pm, Patrick Maupin wrote: > On Jun 3, 9:54 pm, GZ wrote: > > > Hi All, > > > I am looking for an algorithm that can compare to source code files > > line by line and find the minimum diff. I have looked at the difflib > > included in python. The problem is that it is desig

Re: bz2 module doesn't work properly with all bz2 files

2010-06-04 Thread Cameron Simpson
On 04Jun2010 12:53, Magdoll wrote: | I'm not sure what's causing this, but depending on the compression | program used, the bz2 module sometimes exits earlier. | | I used pbzip2 to compress my bz2 files and read through the file using | the bz2 module. The file descriptor always exits much earlie

Re: Python Forum

2010-06-04 Thread John Bokma
geremy condra writes: > On Fri, Jun 4, 2010 at 1:55 PM, John Bokma wrote: >> I know of the use of Lena. And to be honest, I agree with Playboy that >> they have the copyright. Some of the articles published on image >> processing end up behind a paywall or in a book. And I don't think the >> aut

Re: Python Forum

2010-06-04 Thread Grant Edwards
On 2010-06-04, John Bokma wrote: > Lie Ryan writes: > >> On 06/05/10 04:19, John Bokma wrote: >>> Steven D'Aprano writes: >>> But the really sad thing is that you think that "bigger" automatically equals "better". >>> >>> I don't think that was the point. >>> >>> Anyway, not everbo

Re: Plotting in batch with no display

2010-06-04 Thread exarkun
On 08:01 pm, [email protected] wrote: Admittedly not the strongest reason, but yet an important one, for switching from Matlab to python/numpy/scipy/matplotlib, is that Matlab is very cumbersome to run in batch. Now I discover that some of the matplotlib.pyplot functions (incl. plot and c

Re: bz2 module doesn't work properly with all bz2 files

2010-06-04 Thread Magdoll
On Jun 4, 3:05 pm, Cameron Simpson wrote: > On 04Jun2010 12:53, Magdoll wrote: > | I'm not sure what's causing this, but depending on the compression > | program used, the bz2 module sometimes exits earlier. > | > | I used pbzip2 to compress my bz2 files and read through the file using > | the bz

Re: Missing DLL in win98

2010-06-04 Thread Spyder42
On Fri, 04 Jun 2010 14:03:48 -0400, Terry Reedy wrote: >On 6/4/2010 9:08 AM, Spyder42 wrote: >> On Fri, 04 Jun 2010 14:50:28 +0200, Christian Heimes > >>> Python 2.6 is not supported on Windows 98 and earlier. You need at least >>> Windows 2000 with a recent service pack. >>> >>> Christian >> >>

Re: getting MemoryError with dicts; suspect memory fragmentation

2010-06-04 Thread Dan Stromberg
On Thu, Jun 3, 2010 at 3:43 PM, Emin.shopper Martinian.shopper < [email protected]> wrote: > Dear Experts, > > I am getting a MemoryError when creating a dict in a long running > process and suspect this is due to memory fragmentation. Any > suggestions would be welcome. Full details of the p

Re: An empty object with dynamic attributes (expando)

2010-06-04 Thread dmtr
> Why does it have to be a one-liner? Is the Enter key on your keyboard > broken? Nah. I was simply looking for something natural and intuitive, like: m = object(); m.a = 1; Usually python is pretty good providing these natural and intuitive solutions. > You have a perfectly good solution: defin

Re: plac, the easiest command line arguments parser in the world

2010-06-04 Thread Kenny Meyer
On Jun 2, 12:37 am, Michele Simionato wrote: > I would like to announce to the world the first public release of > plac: > >  http://pypi.python.org/pypi/plac > > Plac is a wrapper over argparse and works in all versions of > Python starting from Python 2.3 up to Python 3.1. > > With blatant immod

Re: An empty object with dynamic attributes (expando)

2010-06-04 Thread Terry Reedy
On 6/4/2010 8:01 PM, dmtr wrote: Why does it have to be a one-liner? Is the Enter key on your keyboard broken? Nah. I was simply looking for something natural and intuitive, like: m = object(); m.a = 1; Usually python is pretty good providing these natural and intuitive solutions. As far as I

  1   2   >