web2py 1.40 is out

2008-09-04 Thread Massimo Di Pierro
web2py 1.40 is out A web2py book is out too: http://he-cda.wiley.com/WileyCDA/Section/id-321954.html Here is a sample: http://mdp.cti.depaul.edu/examples/static/web2py_manual_cut.pdf Here are some videos: http://www.vimeo.com/videos/search:web2py version 1.40 includes: - Database Abstraction

Re: max(), sum(), next()

2008-09-04 Thread Mensanator
On Sep 4, 12:20�am, Mensanator [EMAIL PROTECTED] wrote: On Sep 3, 8:30 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Wed, 03 Sep 2008 16:20:39 -0700, Mensanator wrote: sum([]) 0 is a bug, just as it's a bug in Excel to evaluate blank cells as 0. It should

Re: max(), sum(), next()

2008-09-04 Thread Fredrik Lundh
Mensanator wrote: No it isn't. Nothing is not 0, check with MS-Access, for instance: Null + 1 returns Null. Any arithmetic expression involving a Null evaluates to Null. Adding something to an unknown returns an unknown, as it should. It is a logical fallacy to equate unknown with 0.

Re: max(), sum(), next()

2008-09-04 Thread Steven D'Aprano
On Wed, 03 Sep 2008 22:20:43 -0700, Mensanator wrote: On Sep 3, 8:30�pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Wed, 03 Sep 2008 16:20:39 -0700, Mensanator wrote: sum([]) 0 is a bug, just as it's a bug in Excel to evaluate blank cells as 0. It should return

Re: Coming from .NET and VB and C

2008-09-04 Thread Simon Brunning
2008/9/3 Dennis Lee Bieber [EMAIL PROTECTED]: non-relational DBMS (if any such are still in use), There certainly are... SO, I'm interested in using my Google App space (free 500MB) to develop a quick database application. Using Python. I found Dive Into Python which I will be reading

Re: python/xpath question..

2008-09-04 Thread Stefan Behnel
Hi, you should really read about XPath. There are also newsgroups specifically for this topic, please use them. bruce wrote: in my python, i'm using the xpath function to iterate/parse some html. i can do something like s=d.xpath(//tr/td/text()) count=len(s) and get the number of nodes

Re: xml + mmap cross

2008-09-04 Thread Stefan Behnel
castironpi wrote: Any interest in pursuing/developing/working together on a mmaped-xml class? Faster, not readable in text editor. Any hints on what you are talking about? Stefan -- http://mail.python.org/mailman/listinfo/python-list

use str as variable name

2008-09-04 Thread Mathieu Prevot
Hi, I have a program that take a word as argument, and I would like to link this word to a class variable. eg. class foo(): width = 10 height = 20 a=foo() arg='height' a.__argname__= new_value rather than : if arg == 'height': a.height = new_value elif arg == 'width'; a.width =

Re: use str as variable name

2008-09-04 Thread Chris Rebert
On Thu, Sep 4, 2008 at 12:25 AM, Mathieu Prevot [EMAIL PROTECTED] wrote: Hi, I have a program that take a word as argument, and I would like to link this word to a class variable. eg. class foo(): You should subclass 'object', so that should be: class Foo(object): width = 10

Re: use str as variable name

2008-09-04 Thread Fredrik Lundh
Mathieu Prevot wrote: I have a program that take a word as argument, and I would like to link this word to a class variable. eg. class foo(): width = 10 height = 20 a=foo() arg='height' a.__argname__= new_value rather than : if arg == 'height': a.height = new_value elif arg ==

Re: use str as variable name

2008-09-04 Thread Gabriel Genellina
En Thu, 04 Sep 2008 04:25:37 -0300, Mathieu Prevot [EMAIL PROTECTED] escribi�: I have a program that take a word as argument, and I would like to link this word to a class variable. eg. class foo(): width = 10 height = 20 a=foo() arg='height' a.__argname__= new_value rather than : if

Re: use str as variable name

2008-09-04 Thread Mathieu Prevot
2008/9/4 Chris Rebert [EMAIL PROTECTED]: On Thu, Sep 4, 2008 at 12:25 AM, Mathieu Prevot [EMAIL PROTECTED] wrote: Hi, I have a program that take a word as argument, and I would like to link this word to a class variable. eg. class foo(): You should subclass 'object', so that should be:

Re: use str as variable name

2008-09-04 Thread Fredrik Lundh
Mathieu Prevot wrote: I'll use: a.__setattr__(height, new_value) that's an implementation detail. please use setattr() instead, like everyone else. /F -- http://mail.python.org/mailman/listinfo/python-list

Re: Late initialization using __getattribute__

2008-09-04 Thread Bruno Desthuilliers
bukzor a écrit : On Sep 3, 1:02 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: bukzor a écrit : (snip) Thanks for the reply. Just to see it not work, I tried to remove __getattribute__ from LateInitMixIn, but couldn't get it to work. ??? Sorry, I don't get what you mean... Since you said

Re: max(), sum(), next()

2008-09-04 Thread Mensanator
On Sep 4, 1:26 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Wed, 03 Sep 2008 22:20:43 -0700, Mensanator wrote: On Sep 3, 8:30 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Wed, 03 Sep 2008 16:20:39 -0700, Mensanator wrote: sum([]) 0 is a

Re: PyGUI as a standard GUI API for Python?

2008-09-04 Thread M.-A. Lemburg
On 2008-09-04 07:49, Kay Schluehr wrote: 3) Following the public rumor mill and the latest hype RIA i.e. the merge of web- and desktop applications with systems like Adobe AIR, JavaFX, Google Gears and MS Silverlight is the future of frontend development. With the exception of IronPython and

Re: use str as variable name

2008-09-04 Thread Bruno Desthuilliers
Mathieu Prevot a écrit : 2008/9/4 Chris Rebert [EMAIL PROTECTED]: (snip) You're looking for the setattr() built-in function. In this exact case: setattr(a, arg, new_value) This is probably covered in the Python tutorial, please read it. Regards, Chris Indeed. I'll use:

CREDIT CARD DEPT

2008-09-04 Thread roseeea
CREDIT CARD DEPT http://creditcarddept.googlepages.com -- http://mail.python.org/mailman/listinfo/python-list

Re: use str as variable name

2008-09-04 Thread Nick Craig-Wood
Mathieu Prevot [EMAIL PROTECTED] wrote: Hi, I have a program that take a word as argument, and I would like to link this word to a class variable. eg. class foo(): width = 10 height = 20 a=foo() arg='height' a.__argname__= new_value Not quite sure what the above is

Re: use str as variable name

2008-09-04 Thread Fredrik Lundh
Bruno Desthuilliers wrote: You wouldn't write something like 2.__add__(3), would you ? Don't give the it's only OO if I write obj.method(args) crowd more bad ideas, please ;-) (...as Bruno implies, setattr(), len() et al can be and should be viewed as generic functions. A specific Python

Re: PyGUI as a standard GUI API for Python?

2008-09-04 Thread Kay Schluehr
On 4 Sep., 10:31, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-09-04 07:49, Kay Schluehr wrote: 3) Following the public rumor mill and the latest hype RIA i.e. the merge of web- and desktop applications with systems like Adobe AIR, JavaFX, Google Gears and MS Silverlight is the future of

Re: How to write verbose scripts

2008-09-04 Thread Steven D'Aprano
On Tue, 02 Sep 2008 13:07:33 -0400, Joe Riopel wrote: On Tue, Sep 2, 2008 at 12:55 PM, Steven D'Aprano [EMAIL PROTECTED] wrote: Is there a better way of doing this than the way I am going about it? Would the logging module help, and just print the output to the stdout (or a file) instead?

Re: Numeric literal syntax

2008-09-04 Thread Alexander Schmolck
Steven D'Aprano [EMAIL PROTECTED] writes: On Thu, 04 Sep 2008 01:22:22 +0100, Alexander Schmolck wrote: It seems to me that the right choice for thousands seperator is the apostrophe. You mean the character already used as a string delimiter? Yup. No ambiguity or problem here; indeed

guenstige kredite

2008-09-04 Thread coolkid246
+ + + + +++ GUENSTIGE KREDITE ONLINE +++ KREDITE IM INTERNET OHNE SCHUFA +++ + + + + + + -- http://mail.python.org/mailman/listinfo/python-list

guenstige kredite

2008-09-04 Thread coolkid246
+ + + + +++ GUENSTIGE KREDITE ONLINE +++ KREDITE IM INTERNET OHNE SCHUFA +++ + + http://kredite-online-244.info + + + + -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric literal syntax

2008-09-04 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: A problem is that '1234' in Python is a string, so using ' in numbers looks a bit dangerous to me (and my editor will color those numbers as alternated strings, I think). Yeah, editors, especially those with crummy syntax highlighting (like emacs) might get it wrong.

overwrite set behavior

2008-09-04 Thread Michele Petrazzo
Hi all, I want to modify the method that set use for see if there is already an object inside its obj-list. Something like this: class foo: pass bar1 = foo() bar1.attr = 1 bar2 = foo() bar2.attr = 1 set( (bar1, bar2), key=lambda o: o.attr) and, of course, set has only one value. It's

Re: overwrite set behavior

2008-09-04 Thread Wojtek Walczak
On Thu, 04 Sep 2008 11:48:18 +0200, Michele Petrazzo wrote: Hi all, I want to modify the method that set use for see if there is already an object inside its obj-list. Something like this: ... It's possible? As far as I understand you, you need descriptors:

Re: overwrite set behavior

2008-09-04 Thread Marco Bizzarri
Ciao, Michele: On Thu, Sep 4, 2008 at 11:48 AM, Michele Petrazzo [EMAIL PROTECTED] wrote: Hi all, I want to modify the method that set use for see if there is already an object inside its obj-list. Something like this: class foo: pass bar1 = foo() bar1.attr = 1 bar2 = foo() bar2.attr =

Re: overwrite set behavior

2008-09-04 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 11:58 AM, Wojtek Walczak [EMAIL PROTECTED] wrote: On Thu, 04 Sep 2008 11:48:18 +0200, Michele Petrazzo wrote: Hi all, I want to modify the method that set use for see if there is already an object inside its obj-list. Something like this: ... It's possible? As far as

Issue warning if no return in function?

2008-09-04 Thread Poster28
What would you suggest to check python programs for non-syntax error. One example I could think of that one might forget to return a value from a function. How could I check for these and maybe other mistakes? -- http://mail.python.org/mailman/listinfo/python-list

online credit ohne in Landau sofortkredit kredit onl ine vergleich beamtendarlehen ohne schufa handy ohne schufa kredite ohne schufaauskunft kredit vergleich geld kredit ohn e schufa kredit aus der s

2008-09-04 Thread coolkid246
online credit ohne in Landau sofortkredit kredit online vergleich beamtendarlehen ohne schufa handy ohne schufa kredite ohne schufaauskunft kredit vergleich geld kredit ohne schufa kredit aus der schweiz autofinanzierung ohne schufa kreditkarten ohne schufa guenstiger kredit kredit online zusage

Re: Issue warning if no return in function?

2008-09-04 Thread Paul McGuire
On Sep 4, 5:05 am, Poster28 [EMAIL PROTECTED] wrote: What would you suggest to check python programs for non-syntax error. One example I could think of that one might forget to return a value from a function. How could I check for these and maybe other mistakes? Check out PyLint

sofort kredit online in Cochem geld kredite bank kre dite Guenstige Kredide online ohne SCHUFA kredit ohne schufa oesterreich beamtendarlehen ohne schufa schweizer kredit ba rkredit online umschuldun

2008-09-04 Thread coolkid246
sofort kredit online in Cochem geld kredite bank kredite Guenstige Kredide online ohne SCHUFA kredit ohne schufa oesterreich beamtendarlehen ohne schufa schweizer kredit barkredit online umschuldung online blitzkredite schweizer kredit online kredite fuer selbstaendige online kredit trotz bar

Re: PyGUI as a standard GUI API for Python?

2008-09-04 Thread M.-A. Lemburg
On 2008-09-04 11:14, Kay Schluehr wrote: On 4 Sep., 10:31, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-09-04 07:49, Kay Schluehr wrote: 3) Following the public rumor mill and the latest hype RIA i.e. the merge of web- and desktop applications with systems like Adobe AIR, JavaFX, Google

Re: Issue warning if no return in function?

2008-09-04 Thread Wojtek Walczak
On Thu, 04 Sep 2008 12:05:45 +0200, Poster28 wrote: What would you suggest to check python programs for non-syntax error. One example I could think of that one might forget to return a value from a function. How could I check for these and maybe other mistakes? Check pychecker or figleaf:

Re: Serial I/O problem with pywin32 ?

2008-09-04 Thread Impotent Verse
On 3 Sep, 16:33, Diez B. Roggisch [EMAIL PROTECTED] wrote: Xavier schrieb: Hi, I try to access to a Bluetooth GPS data-logger with Python. I use pySerial. Sending and receiving little messages (~100 char) works fine. However, when I ask the GPS to dump the trails, it returns some

Re: Coming from .NET and VB and C

2008-09-04 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 12:16 AM, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Wed, 3 Sep 2008 09:52:06 -0700 (PDT), ToPostMustJoinGroup22 [EMAIL PROTECTED] declaimed the following in comp.lang.python: have no preference with MySQL or SQL, stored procedures or ad-hoc queries. Please

Re: max(), sum(), next()

2008-09-04 Thread Thomas Bellman
Mensanator [EMAIL PROTECTED] wrote: No, but blank cells are 0 as far as Excel is concerned. That behaviour causes nothing but trouble and I am saddened to see Python emulate such nonsense. Then you should feel glad that the Python sum() function *does* signal an error for the closest

cPickle

2008-09-04 Thread gopal mishra
I have 3 objects and want to save in one pickle file. I used cPickle to dump 3 objects in a pkl file i.e cPickle.dump(object1, fileobject, -1) cPickle.dump(object2, fileobject, -1) cPickle.dump(object3, fileobject, -1) I have changed the 3rd object

Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Marco Bizzarri
Let's say I've a class a, where I can write: -- Marco Bizzarri http://notenotturne.blogspot.com/ http://iliveinpisa.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGUI as a standard GUI API for Python?

2008-09-04 Thread Banibrata Dutta
On Thu, Sep 4, 2008 at 3:45 PM, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-09-04 11:14, Kay Schluehr wrote: On 4 Sep., 10:31, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-09-04 07:49, Kay Schluehr wrote: 3) Following the public rumor mill and the latest hype RIA i.e. the merge of

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Diez B. Roggisch
Marco Bizzarri wrote: Let's say I've a class a, where I can write: Anticipating this obviously premature posting: http://dirtsimple.org/2004/12/python-is-not-java.html Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: cPickle

2008-09-04 Thread Gerhard Häring
gopal mishra wrote: I have 3 objects and want to save in one pickle file. I used cPickle to dump 3 objects in a pkl file i.e cPickle.dump(object1, fileobject, -1) cPickle.dump(object2, fileobject, -1) cPickle.dump(object3, fileobject, -1) I have

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 1:00 PM, Diez B. Roggisch [EMAIL PROTECTED] wrote: Marco Bizzarri wrote: Let's say I've a class a, where I can write: Anticipating this obviously premature posting: http://dirtsimple.org/2004/12/python-is-not-java.html Diez --

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Marco Bizzarri
Sorry... pressed enter but really didn't want to. As I said, let's say I have a class class A: def __init__(self): self.x = None Python makes the decision to allow the developers to directly access the attribute x, so that they can directly write: a.x = 1, or whatever; this has

Re: overwrite set behavior

2008-09-04 Thread Diez B. Roggisch
Michele Petrazzo wrote: Hi all, I want to modify the method that set use for see if there is already an object inside its obj-list. Something like this: class foo: pass bar1 = foo() bar1.attr = 1 bar2 = foo() bar2.attr = 1 set( (bar1, bar2), key=lambda o: o.attr) and, of

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Diez B. Roggisch
Of course, I know that while I'm fresh, I've a good knowledge of the code, and anything else, I will be able to avoid such stupid errors; however, I'm afraid of the times when I'm tired, when I have to put my hands on the code of someone else, and so on. Please, understand that I'm not

Re: Coming from .NET and VB and C

2008-09-04 Thread Bruno Desthuilliers
Marco Bizzarri a écrit : On Thu, Sep 4, 2008 at 12:16 AM, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Wed, 3 Sep 2008 09:52:06 -0700 (PDT), ToPostMustJoinGroup22 [EMAIL PROTECTED] declaimed the following in comp.lang.python: have no preference with MySQL or SQL, stored procedures or ad-hoc

Safely move an element into a heap

2008-09-04 Thread Giampaolo Rodola'
Hi, I wanted to know if does exist a safe way to, given a heap, move an arbitrary element to the first position of the heap. Something like: heap = [0,3,6,8,10] heapq.move_to_first_position(heap, 4) heap = [10, 0,3,6,8] --- Giampaolo http://code.google.com/p/pyftpdlib/ --

Re: Coming from .NET and VB and C

2008-09-04 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 1:23 PM, Bruno Desthuilliers [EMAIL PROTECTED] wrote: The appearance is not an RDBMS, at least, maybe it is, but under the surface. Not AFAIK, cf: http://en.wikipedia.org/wiki/BigTable -- http://mail.python.org/mailman/listinfo/python-list Thanks for the pointer,

Re: Safely move an element into a heap

2008-09-04 Thread Alexandru Palade
I'm not sure what you expect as an answer, but if you mean the heap as in the data structure, you can not just arbitrarily move one key where you want as it will destroy the heap property. Giampaolo Rodola' wrote: Hi, I wanted to know if does exist a safe way to, given a heap, move an

Re: cPickle

2008-09-04 Thread Maric Michaud
Le Thursday 04 September 2008 13:08:59 Gerhard Häring, vous avez écrit : gopal mishra wrote: I have 3 objects and want to save in one pickle file. I used cPickle to dump 3 objects in a pkl file i.e cPickle.dump(object1, fileobject, -1) cPickle.dump(object2,

Re: Safely move an element into a heap

2008-09-04 Thread Giampaolo Rodola'
On 4 Set, 13:49, Alexandru Palade [EMAIL PROTECTED] wrote: I'm not sure what you expect as an answer, but if you mean the heap as in the data structure, you can not just arbitrarily move one key where you want as it will destroy the heap property. Giampaolo Rodola' wrote: Hi, I wanted

help in execfile function

2008-09-04 Thread moijes12
Hi i have 3 python files and i want to execute the files sequentially using the execfile command.Hence ,i have written the following program fileList = [a.py,b.py,c.py] for fileName in fileList : execfile(fileName) however,when i try running it,the program keeps calling execfile on a.py

Re: use str as variable name

2008-09-04 Thread Cameron Laird
In article [EMAIL PROTECTED], Bruno Desthuilliers [EMAIL PROTECTED] wrote: Mathieu Prevot a écrit : 2008/9/4 Chris Rebert [EMAIL PROTECTED]: (snip) You're looking for the setattr() built-in function. In this exact case: setattr(a, arg, new_value) This is probably covered in the Python

Re: help in execfile function

2008-09-04 Thread Steven D'Aprano
On Thu, 04 Sep 2008 05:03:57 -0700, moijes12 wrote: Hi i have 3 python files and i want to execute the files sequentially using the execfile command.Hence ,i have written the following program fileList = [a.py,b.py,c.py] for fileName in fileList : execfile(fileName)

Re: overwrite set behavior

2008-09-04 Thread Michele Petrazzo
Marco Bizzarri wrote: looking at the source, maybe you could create a subclass of Set redefining the __contains__ method? Made some tries, but __contains__ are never called class foo(set): ... def __contains__(self, value): ... print value ... a = foo((1,2)) Thanks, Michele --

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Bruno Desthuilliers
Marco Bizzarri a écrit : Sorry... pressed enter but really didn't want to. As I said, let's say I have a class class A: def __init__(self): self.x = None Python makes the decision to allow the developers to directly access the attribute x, So do Java, if you make your

[ANN] The Python Papers, Volume 3 Issue 2

2008-09-04 Thread [EMAIL PROTECTED]
Hi everyone After a long wait of nearly 5 month, we are back in business to bring the latest edition of The Python Papers - Volume 3 Issue 2 (http:// ojs.pythonpapers.org/index.php/tpp/issue/current). From this issue onwards, we will be having only 3 issues per year instead of 4. This is in

Re: use str as variable name

2008-09-04 Thread Mathieu Prevot
2008/9/4 Fredrik Lundh [EMAIL PROTECTED]: Bruno Desthuilliers wrote: You wouldn't write something like 2.__add__(3), would you ? Don't give the it's only OO if I write obj.method(args) crowd more bad ideas, please ;-) (...as Bruno implies, setattr(), len() et al can be and should be viewed

Re: overwrite set behavior

2008-09-04 Thread Maric Michaud
Le Thursday 04 September 2008 14:31:23 Michele Petrazzo, vous avez écrit : Marco Bizzarri wrote: looking at the source, maybe you could create a subclass of Set redefining the __contains__ method? Made some tries, but __contains__ are never called No, __contains__ is only called with in

Re: The Python Papers, Volume 3 Issue 2

2008-09-04 Thread Samir
On Sep 4, 8:58 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi everyone After a long wait of nearly 5 month, we are back in business to bring the latest edition of The Python Papers - Volume 3 Issue 2 (http:// ojs.pythonpapers.org/index.php/tpp/issue/current). From this issue onwards, we

Re: How to write verbose scripts

2008-09-04 Thread Ben Finney
Steven D'Aprano [EMAIL PROTECTED] writes: On Tue, 02 Sep 2008 13:07:33 -0400, Joe Riopel wrote: On Tue, Sep 2, 2008 at 12:55 PM, Steven D'Aprano [EMAIL PROTECTED] wrote: Is there a better way of doing this than the way I am going about it? Would the logging module help, and just

Assalamu'alaikum wr. wb.

2008-09-04 Thread Abdurrahman Wahid
Assalamu'alaikum wr. wb., Faith Freedom Indonesia (http://www.indonesia.faithfreedom.org/forum/) The Amazing Racist: Moslem Mosque (http://13gb.com/videos/923/) Forum Murtadin Indonesia (http://mantanmuslim.blogspot.com/) Wassalam -- http://mail.python.org/mailman/listinfo/python-list

Xpath for HTML processing

2008-09-04 Thread Astley Le Jasper
Can anyone suggest something inthat can process an XPath like the following: /html/body/table[2]/tbody/tr/td[5]/table/tbody/tr[3]/td/table[3]/ tbody/tr[5]/td Cheers -- http://mail.python.org/mailman/listinfo/python-list

path slashes cleaning

2008-09-04 Thread Mathieu Prevot
Hi, for scripts that take arguments, I would like to remove the trailing slash if it's present. Is there something else than: a='/usr/local/lib/' if a[-1] == '/': a = list(a) a.pop() ''.join(a) Thanks, Mathieu -- http://mail.python.org/mailman/listinfo/python-list

Re: path slashes cleaning

2008-09-04 Thread Mike Driscoll
On Sep 4, 8:25 am, Mathieu Prevot [EMAIL PROTECTED] wrote: Hi, for scripts that take arguments, I would like to remove the trailing slash if it's present. Is there something else than: a='/usr/local/lib/' if a[-1] == '/':   a = list(a)   a.pop()   ''.join(a) Thanks, Mathieu How

Re: path slashes cleaning

2008-09-04 Thread Mathieu Prevot
2008/9/4 Mathieu Prevot [EMAIL PROTECTED]: Hi, for scripts that take arguments, I would like to remove the trailing slash if it's present. Is there something else than: a='/usr/local/lib/' if a[-1] == '/': a = list(a) a.pop() ''.join(a) A dummy a.rstrip('/') Sorry for the noise

Re: path slashes cleaning

2008-09-04 Thread Francesco Guerrieri
On Thu, Sep 4, 2008 at 3:25 PM, Mathieu Prevot [EMAIL PROTECTED] wrote: Hi, for scripts that take arguments, I would like to remove the trailing slash if it's present. Is there something else than: a='/usr/local/lib/' if a[-1] == '/': a = list(a) a.pop() ''.join(a) Thanks,

Re: Access to Windows Add/Remove Programs?

2008-09-04 Thread Mike Driscoll
On Sep 3, 9:41 pm, Sean DiZazzo [EMAIL PROTECTED] wrote: On Sep 3, 7:13 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Wed, 03 Sep 2008 21:51:59 -0300, Sean DiZazzo [EMAIL PROTECTED]   escribi : I'm trying to find a way to get a list of all the installed programs on a Windows box

Re: PyGUI as a standard GUI API for Python?

2008-09-04 Thread M.-A. Lemburg
On 2008-09-04 12:57, Banibrata Dutta wrote: On Thu, Sep 4, 2008 at 3:45 PM, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-09-04 11:14, Kay Schluehr wrote: On 4 Sep., 10:31, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-09-04 07:49, Kay Schluehr wrote: 3) Following the public rumor mill

Investments Are Faltering in Chrysler and GMAC

2008-09-04 Thread 9847733785 . man
Mr. Feinberg’s giant investment fund, Cerberus Capital Management, is racing to salvage multibillion-dollar investments in Chrysler, the smallest of the Detroit automakers, and GMAC, the financing arm of General Motors. But for Cerberus, named after the mythological three-headed dog who guards

Re: overwrite set behavior

2008-09-04 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 3:07 PM, Maric Michaud [EMAIL PROTECTED] wrote: Le Thursday 04 September 2008 14:31:23 Michele Petrazzo, vous avez écrit : Marco Bizzarri wrote: looking at the source, maybe you could create a subclass of Set redefining the __contains__ method? Made some tries, but

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 1:19 PM, Diez B. Roggisch [EMAIL PROTECTED] wrote: What you are essentially asking is: why is python dynamic instead of static? Most probably you're right. Maybe I will make a trip back to my university books and take a look at them again :-) Thanks Marco -- Marco

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 4:39 PM, Marco Bizzarri [EMAIL PROTECTED] wrote: Most probably you're right. Maybe I will make a trip back to my university books and take a look at them again :-) Meant: you *are* right. Sorry. Saluti Marco -- Marco Bizzarri http://notenotturne.blogspot.com/

Re: Numeric literal syntax

2008-09-04 Thread Fredrik Lundh
Alexander Schmolck wrote: A problem is that '1234' in Python is a string, so using ' in numbers looks a bit dangerous to me (and my editor will color those numbers as alternated strings, I think). Yeah, editors, especially those with crummy syntax highlighting (like emacs) might get it wrong.

Read Binary data

2008-09-04 Thread Mars creature
Hi guys, I am trying to read a binary file created by the following matlab command: fid=fopen('a.bin','w','b'); fwrite(fid,a,'real*8'); fclose(fid);, and wondering how to do it in Python. I googled it but still get confused. 'b' in fopen is for 'big-endian', 'real*8' in fwrite is for 64bit

Function decorators

2008-09-04 Thread Aigars Aigars
Good day all, I am learning Python and came up to decorators. The question is: Why does function FoodList return value None? The code in attachment. Thank you, Aigars testingVarLogger.py Description: application/unknown-application-x-python --

Re: Function decorators

2008-09-04 Thread Laszlo Nagy
Aigars Aigars wrote: Good day all, I am learning Python and came up to decorators. The question is: Why does function FoodList return value None? The code in attachment. Thank you, Aigars --

Re: overwrite set behavior

2008-09-04 Thread Wojtek Walczak
On Thu, 4 Sep 2008 12:06:14 +0200, Marco Bizzarri wrote: As far as I understand you, you need descriptors: http://users.rcn.com/python/download/Descriptor.htm I know descriptors a litte, Wojtek, but didn't use them often; can you elaborate a little more on your idea? Marco, I think that I

Re: Function decorators

2008-09-04 Thread David C. Ullrich
In article [EMAIL PROTECTED], Aigars Aigars [EMAIL PROTECTED] wrote: Good day all, I am learning Python and came up to decorators. The question is: Why does function FoodList return value None? Because the function doesn't return anything, and in Python a function that doesn't explicitly

Re: Function decorators

2008-09-04 Thread Diez B. Roggisch
Aigars Aigars schrieb: Good day all, I am learning Python and came up to decorators. The question is: Why does function FoodList return value None? The code in attachment. Because the __call__ in Logger doesn't return the value of self.func. Diez --

Re: path slashes cleaning

2008-09-04 Thread Jason Scheirer
On Sep 4, 6:32 am, Francesco Guerrieri [EMAIL PROTECTED] wrote: On Thu, Sep 4, 2008 at 3:25 PM, Mathieu Prevot [EMAIL PROTECTED] wrote: Hi, for scripts that take arguments, I would like to remove the trailing slash if it's present. Is there something else than: a='/usr/local/lib/'

Re: Read Binary data

2008-09-04 Thread Fredrik Lundh
Mars creature wrote: I am trying to read a binary file created by the following matlab command: fid=fopen('a.bin','w','b'); fwrite(fid,a,'real*8'); fclose(fid);, and wondering how to do it in Python. I googled it but still get confused. 'b' in fopen is for 'big-endian', 'real*8' in fwrite

Re: max(), sum(), next()

2008-09-04 Thread David C. Ullrich
In article [EMAIL PROTECTED], Mensanator [EMAIL PROTECTED] wrote: On Sep 3, 2:18 pm, Laszlo Nagy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 Because that []

Re: max(), sum(), next()

2008-09-04 Thread David C. Ullrich
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 Because that [] may be an empty sequence of someobject: sum(s for s in [a, b] if len(s) 2) 0 In a statically typed

Re: Read Binary data

2008-09-04 Thread Mars creature
On Sep 4, 12:03 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: Mars creature wrote: I am trying to read a binary file created by the following matlab command: fid=fopen('a.bin','w','b'); fwrite(fid,a,'real*8'); fclose(fid);, and wondering how to do it in Python. I googled it but still get

Re: Late initialization using __getattribute__

2008-09-04 Thread bukzor
so unfortunately I think I need to use __getattribute__ to do this. I'm doing all this just to make the connection not actually connect until used. I may be dumb, but I don't get how this is supposed to solve your problem. But anyway : there's a known design pattern for what you're

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread George Sakkis
On Sep 4, 7:09 am, Marco Bizzarri [EMAIL PROTECTED] wrote: Sorry... pressed enter but really didn't want to. As I said, let's say I have a class class A:     def __init__(self):          self.x = None Python makes the decision to allow the developers to directly access the attribute x,  

Right to left language support

2008-09-04 Thread Gandalf
Most of you probably speaks Latin language, so you wont understand the problem. when I try to write Hebrew in my statictext the last punctuation marks get mixed up. does someone have a solution for this? this is the code : text=wx.StaticText(panel3, -1, Hebrew_string, style=wx.ALIGN_RIGHT)

Re: Read Binary data

2008-09-04 Thread mblume
Am Thu, 04 Sep 2008 18:03:54 +0200 schrieb Fredrik Lundh: I am trying to read a binary file [...] f = open(a.bin, rb) # read binary data s = f.read() # read all bytes into a string import array, sys a = array.array(f, s) # f for float if sys.byteorder != big: a.byteswap()

Re: Help needed to freeze a script.

2008-09-04 Thread LB
Did you try py2exe instead offreeze? On the page http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules there is only one brief mention of numpy packaging troubles, suggesting that it might work better. I have used py2exe in the past without much trouble. Unfortunately, I'm

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Timothy Grant
On Thu, Sep 4, 2008 at 4:09 AM, Marco Bizzarri [EMAIL PROTECTED] wrote: Sorry... pressed enter but really didn't want to. As I said, let's say I have a class class A: def __init__(self): self.x = None Python makes the decision to allow the developers to directly access the

Re: max(), sum(), next()

2008-09-04 Thread Mensanator
On Sep 4, 11:13 am, David C. Ullrich [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED],  Mensanator [EMAIL PROTECTED] wrote: On Sep 3, 2:18 pm, Laszlo Nagy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will

Re: Python and Cyrillic characters in regular expression

2008-09-04 Thread MRAB
On Sep 4, 3:42 pm, phasma [EMAIL PROTECTED] wrote: Hi, I'm trying extract all alphabetic characters from string. reg = re.compile('(?u)([\w\s]+)', re.UNICODE) You don't need both (?u) and re.UNICODE: they mean the same thing. This will actually match letters and whitespace. buf =

Re: Python and Cyrillic characters in regular expression

2008-09-04 Thread Fredrik Lundh
phasma wrote: Hi, I'm trying extract all alphabetic characters from string. reg = re.compile('(?u)([\w\s]+)', re.UNICODE) buf = re.match(string) But it's doesn't work. If string starts from Cyrillic character, all works fine. But if string starts from Latin character, match returns only Latin

Re: max(), sum(), next()

2008-09-04 Thread Mensanator
On Sep 4, 2:05 am, Thomas Bellman [EMAIL PROTECTED] wrote: Mensanator [EMAIL PROTECTED] wrote: No, but blank cells are 0 as far as Excel is concerned. That behaviour causes nothing but trouble and I am saddened to see Python emulate such nonsense. Then you should feel glad that the Python

Re: Xpath for HTML processing

2008-09-04 Thread Stefan Behnel
Astley Le Jasper wrote: Can anyone suggest something inthat can process an XPath like the following: /html/body/table[2]/tbody/tr/td[5]/table/tbody/tr[3]/td/table[3]/ tbody/tr[5]/td [skipping the obvious joke answer to your question] In case you're asking for a tool that can process HTML

Re: max(), sum(), next()

2008-09-04 Thread Wojtek Walczak
On Thu, 4 Sep 2008 10:57:35 -0700 (PDT), Mensanator wrote: Why then, doesn't sum([A for A in [None, None, None, None, None, None] if A != None]) 0 give me an error? Because [A for A in [None, None, None, None, None, None] if A != None] returns an empty list, and sum([]) doesn't return an

  1   2   3   >