Re: "HTTP error -1" from urllib2

2007-04-14 Thread John Nagle
The crash is a known bug, and is fixed in the Subversion repository, but not in any released version. The problem is that if the server returns an blank line, instead of "HTTP 1", httplib goes off into some old HTTP 0.9 code that's broken. John Nagle John Nagl

Re: tuples, index method, Python's design

2007-04-14 Thread Paul Rubin
"Rhamphoryncus" <[EMAIL PROTECTED]> writes: > > > > i = s.index(e) => s[i] = e > > > > Then this algorithm is no longer guaranteed to work with strings. > > > It never worked correctly on unicode strings anyway (which becomes the > > > canonical string in python 3.0). > > > > What?! Are you sur

Re: compiling modules with VS 2008 for python 2.4 prepared with Visual Studio 2003

2007-04-14 Thread alf
Martin v. Löwis wrote: > You either would have to create a import library for mscvr71.dll > by hand, or you have to copy one from VS 2003 (breaking its license). I wonder if copying the probstat.pyd from internet where I it finnaly found is not breaking the license:-). it was my final solution

Re: Portably generating infinity and NaN

2007-04-14 Thread skip
Michael> If you're going to change CPython to do this, I think adopting Michael> PEP 754, and using the fpconst module would be better than Michael> changing how float() works when called on string literals. But PEP 754 will only work for architectures supporting IEEE 754. I realize

Re: Stdout

2007-04-14 Thread hlubenow
[EMAIL PROTECTED] wrote: > Dear Users, > > I am trying to recover through the python function > popen3 the stdout,in,err of a launched process. > > I would like also to recover the stdout which you can > get only through the command: command1 >& filename > > Do you know how I can access to th

The Exotic Adventures of Neil Bush Re: WOLFOWITZ AND HIS IRANIAN PROSTITUTE SALARY OF $190k/yr Re: Test Tube Zealots: The American Chemical Society Terminates the Membership of Chemists from Iran

2007-04-14 Thread lemnitzer
http://www.commondreams.org/headlines05/1219-10.htm http://www.dissidentvoice.org/Jan06/Berkowitz07.htm The Exotic Adventures of Neil Bush by Bill Berkowitz OAKLAND, California - These days, while President George W. Bush is all about convincing the U.S. public that he has a "Plan for Victory" in

KOREAN MOON revolves around BUSH

2007-04-14 Thread lemnitzer
Moon revolves around Bush family By Bill Berkowitz OAKLAND (United States): When former President George H.W. Bush takes the stage to deliver the keynote address in honour of the 25th anniversary of the ultra-conservative Washington Times newspaper in mid-May, it will not be the first time he ha

Re: Python editor/IDE on Linux?

2007-04-14 Thread mystilleef
On Apr 13, 6:20 pm, "Jack" <[EMAIL PROTECTED]> wrote: > I wonder what everybody uses for Python editor/IDE on Linux? > I use PyScripter on Windows, which is very good. Not sure if > there's something handy like that on Linux. I need to do some > development work on Linux and the distro I am using i

Really badly structured Python Books.

2007-04-14 Thread Andre P.S Duarte
I started reading the beginning Python book. It is intended for people who are starting out in the Python world. But it is really complicated, because he tries to explain, then after a bad explanation he puts out a bad example. I really recommend NOT reading the book. For it will make you want not

the best web site formarrige and frindship www.arabzwaj.comافضل موقع مجاني للتعارف و للزواج

2007-04-14 Thread عرب زواج
بسم الله الرحمن الرحيم بنات وشبابل عايزه تتشرف بمعرفتك تعارف من كل دول العالم ادخل الي عالم من المتعة والزواج والحب افضل موقع للتعارف بين الجنس ين الشباب والبنات من كل دول العالم www.arabzwaj.com تعارف من كل دول العالم بنات وشباب نفسهم يحبوا ويتجوزوا بجد تعارف حقيقي وزواج شرعي عايز تكسب 5000 دول

Re: Minimal Linux system to run Python

2007-04-14 Thread half . italian
You basically just want to create a new startup mode, with only the needed modules loaded, and then set the system to boot up into that mode. I messed around with it a bit awhile ago, and managed to modify run-level 3 to accomplish what i wanted. After it had done one part of its thing, a python

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread 7stud
On Apr 14, 4:42 am, [EMAIL PROTECTED] wrote: > This also is > similar to the C++ "using" keyword which exposes the members of a > namespace to access without specifying the namespace scope for each > reference. For example after giving "using namespace std;" I can > change all references to "std::c

Re: Python editor/IDE on Linux?

2007-04-14 Thread Dotan Cohen
On 14 Apr 2007 11:35:15 -0700, mystilleef <[EMAIL PROTECTED]> wrote: > On Apr 13, 6:20 pm, "Jack" <[EMAIL PROTECTED]> wrote: > > I wonder what everybody uses for Python editor/IDE on Linux? > > I use PyScripter on Windows, which is very good. Not sure if > > there's something handy like that on Lin

Re: Really badly structured Python Books.

2007-04-14 Thread 7stud
On Apr 14, 12:37 pm, "Andre P.S Duarte" <[EMAIL PROTECTED]> wrote: > I started reading the beginning Python book. It is intended for people > who are starting out in the Python world. But it is really > complicated, because he tries to explain, then after a bad explanation > he puts out a bad examp

Re: reading from sys.stdin

2007-04-14 Thread 7stud
On Apr 14, 7:43 am, Steve Holden <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > On Apr 13, 6:20 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: > [...] > > > But if you hit return on a blank line, there is no error. In other > > words, will stop on a blank line and not return EOFError. > > > Anyway,

Re: Making a tree out of a 2 column list

2007-04-14 Thread bearophileHUGS
The solution I have found is quite similar to the [EMAIL PROTECTED] one (it uses a defaultdict, and it yields the result lazily), but it lacks the quite useful max_depth (it can be added): from collections import defaultdict def finder(el, stor): if el in stor: for v in stor[el]:

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread faulkner
On Apr 14, 6:27 am, [EMAIL PROTECTED] wrote: > This is like the previous one. Please check for sanity and approve for > posting at python-dev. > > I would like to have something like "option base" in Visual Basic. > IIRC it used to allow me to choose whether 0 or 1 should be used as > the base of m

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread 7stud
On Apr 14, 12:57 pm, "7stud" <[EMAIL PROTECTED]> wrote: > On Apr 14, 4:42 am, [EMAIL PROTECTED] wrote: > > > This also is > > similar to the C++ "using" keyword which exposes the members of a > > namespace to access without specifying the namespace scope for each > > reference. For example after gi

Re: Python Feature Request: (?) Group all file-directory-related stdlib functions in one place

2007-04-14 Thread faulkner
On Apr 14, 6:30 am, [EMAIL PROTECTED] wrote: > Please check for sanity and approve for posting at python-dev. > > Currently file-directory-related functionality in the Python standard > library is scattered among various modules such as shutil, os, > dircache etc. So I request that the functions be

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Paddy
On Apr 14, 11:27 am, [EMAIL PROTECTED] wrote: > This is like the previous one. Please check for sanity and approve for > posting at python-dev. > > I would like to have something like "option base" in Visual Basic. > IIRC it used to allow me to choose whether 0 or 1 should be used as > the base of

Re: nonstandard XML character entities?

2007-04-14 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > If they contain such things, and do not contain a document type > definition, they are not well-formed XML files (i.e. can't be > called "XML" in a meaningful sense). The documents do have a DTD, however the DTD file doesn't say anything about these

Re: tuples, index method, Python's design

2007-04-14 Thread Antoon Pardon
On 2007-04-13, Steve Holden <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2007-04-13, Steve Holden <[EMAIL PROTECTED]> wrote: >>> Antoon Pardon wrote: On 2007-04-12, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Thu, 2007-04-12 at 14:10 +, Antoon Pardon wrote: >> People a

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Sherm Pendley
"Paddy" <[EMAIL PROTECTED]> writes: > Having more than one index start point would be a maintenance > nightmare best avoided. Quite right. > (It can be done in Perl). When was the last time you used Perl? It was allowed in Perl 4 and earlier, because many Perl users were moving from Awk, which

That might be the case for more complex objects...

2007-04-14 Thread Bart Willems
Dennis Lee Bieber wrote: > On 14 Apr 2007 06:35:34 -0700, "jamadagni" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > In Python, the "variable" NAME does NOT define storage; unlike most > other classical languages where the "variable name" is a storage > address, and the

Re: Minimal Linux system to run Python

2007-04-14 Thread Adonis Vargas
Chaz Ginger wrote: > I have a need for the minimal Linux system to run Python. Basically I > want the system to boot up and instead of starting up Init/etc. I would > love it to run python (and a python script I have written). > > Before embarking on doing it myself I was wondering if anyone knew

Re: That might be the case for more complex objects...

2007-04-14 Thread James Stroud
Bart Willems wrote: > Dennis Lee Bieber wrote: >> On 14 Apr 2007 06:35:34 -0700, "jamadagni" <[EMAIL PROTECTED]> declaimed >> the following in comp.lang.python: >> In Python, the "variable" NAME does NOT define storage; unlike most >> other classical languages where the "variable name" is a sto

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread Georg Brandl
BJörn Lindqvist schrieb: > On 4/14/07, BJörn Lindqvist <[EMAIL PROTECTED]> wrote: >> On 14 Apr 2007 07:24:32 -0700, jamadagni <[EMAIL PROTECTED]> wrote: >> > > You already can emulate the using statement like this: >> > >> > You can emulate only assignments like this. How would you emulate >> > fun

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread John Machin
On Apr 14, 8:27 pm, [EMAIL PROTECTED] wrote: > This is like the previous one. Please check for sanity and approve for > posting at python-dev. > > I would like to have something like "option base" in Visual Basic. > IIRC it used to allow me to choose whether 0 or 1 should be used as > the base of m

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Paddy
On Apr 14, 8:55 pm, Sherm Pendley <[EMAIL PROTECTED]> wrote: > "Paddy" <[EMAIL PROTECTED]> writes: > > Having more than one index start point would be a maintenance > > nightmare best avoided. > > Quite right. > > > (It can be done in Perl). > > When was the last time you used Perl? It was allowed

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread Bjoern Schliessmann
jamadagni wrote: > Bjoern Schliessmann wrote: >> In more complex modules, when you are >> looking for, e. g., self.myVar and anotherObject.myVar, >> this "using" statement decreases readability and maintainability >> (in full text searching). IMHO. > > Why? Just search for self and you turn up us

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Bjoern Schliessmann
jamadagni wrote: > OK fine. It is clear that this feature must be implemented if at > all only on a per-module basis. So can we have votes for > per-module implementation of this feature? I don't think it's worth the hassle. BTW, what's, IYHO, the distinct advantage of starting array indices at 1

Re: That might be the case for more complex objects...

2007-04-14 Thread Bjoern Schliessmann
Bart Willems wrote: > I can try this in interactive mode: > >>> a = 5 > >>> b = a > >>> a += 1 > >>> print b > 5 > > So, if /a/ and /b/ where pointing to the *same* "5" in memory, They do: >>> a = 5 >>> b = a >>> a is b True >>> a += 1 >>> a is b False ... but not after a is rebound to a n

Re: KOREAN MOON revolves around BUSH

2007-04-14 Thread Major Quaternion Dirt Quantum
you should look at the LaRouche site for old & current exposes; the LaRouciacs have been a frequent target of the Wash.Times, which is distributed for nothing on Capitol Hill (it has always been run at a loss, funded by the Moonie syndicates). > During a time when the activities of the KCIA were t

Re: "HTTP error -1" from urllib2

2007-04-14 Thread John Nagle
John J. Lee wrote: > John Nagle <[EMAIL PROTECTED]> writes: > Can you create an example (preferably small) that fails? Feel free to > email it to me if it includes something you don't want to post. It's not a Python problem, as it turns out. It's a problem in, surprisingly, Coyote Point loa

No can load a image with gnome-python and canvas

2007-04-14 Thread Victor Roig
Code --> http://pastebin.ca/439954 <-- resume: import gtk import gnomecanvas ... im = GdkImlib.Image("5b.png") w = self.acanvas.root().add('GnomeCanvasImage', image=im, width=70, height=105) ... at execurion time: NameError: global name 'GdkImlib' is not defined and if I probe: .

Re: wx and SOAPpy interaction

2007-04-14 Thread Amaury Forgeot d'Arc
alf a écrit : > Hi, > > there is problem when I import (python 2.4) wx and SOAPpy at the same > time. I narrowed the problem to following (on Linux): > > >>import wx > >>import pyexpat > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: > /apps/public/python_2.4.4/

Re: Making a tree out of a 2 column list

2007-04-14 Thread Sebastian Bassi
On 14 Apr 2007 09:32:07 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > def tree_path(key,tree,indent): > print '\t'*indent,key > if tree.has_key(key): > for m in tree[key]: > tree_path(m,tree,indent+1) > return Thank you. It worked!. I changed it a bit to re

Re: WOLFOWITZ AND HIS IRANIAN PROSTITUTE SALARY OF $190k/yr Re: Test Tube Zealots: The American Chemical Society Terminates the Membership of Chemists from Iran

2007-04-14 Thread Fred Kasner
[EMAIL PROTECTED] wrote: > "I now direct you to agree to a proposal which includes the following > terms and conditions," Wolfowitz instructed. "You should accept > immediately her offer to be detailed to an outside institution of her > choosing, while retaining bank salary and benefits." > > The

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Sherm Pendley
"Paddy" <[EMAIL PROTECTED]> writes: > I don't think we should add it to Python > because it would make porting VB code easier. Great Cthulhu no! I chimed in because your first comment regarding Perl implied that it's commonplace for Perl programmers to fiddle with the index base. It can be done,

Useful decorator

2007-04-14 Thread Paul Rubin
In the course of writing a bunch of generator-oriented code I kept wanting to temporarily truncate the output of generators for debugging, i.e. I might have a function like def generate_bazillion_items(): for line in bazillion_line_file: yield itemify(line) where I wanted to

Re: treating str as unicode in legacy code?

2007-04-14 Thread John Machin
On Apr 13, 5:57 am, "Ben" <[EMAIL PROTECTED]> wrote: > I'm left with some legacy code using plain oldstr, and I need to make > sure it works withunicodeinput/output. I have a simple plan to do > this: > > - Run the code with "python -U" so all the string literals > becomeunicodelitrals. Requiring

Re: Useful decorator

2007-04-14 Thread James Stroud
Paul Rubin wrote: > In the course of writing a bunch of generator-oriented code I kept > wanting to temporarily truncate the output of generators for debugging, > i.e. I might have a function like > > def generate_bazillion_items(): >for line in bazillion_line_file: > yield i

Re: Really badly structured Python Books.

2007-04-14 Thread James Stroud
7stud wrote: > On Apr 14, 12:37 pm, "Andre P.S Duarte" <[EMAIL PROTECTED]> > wrote: > >>I started reading the beginning Python book. It is intended for people >>who are starting out in the Python world. But it is really >>complicated, because he tries to explain, then after a bad explanation >>he

Re: descriptor object for an attribute?

2007-04-14 Thread Eric Mahurin
On Apr 11, 3:07 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Eric Mahurin a écrit : > > > Is there a standard way to get a descriptor object for an arbitrary > > object attribute - independent of whether it uses the descriptor/ > > property protocol or not. I want some kind of handle/refer

Re: Python Feature Request: Add the "using" keyword which works like"with" in Visual Basic

2007-04-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | self.setFixedSize(200, 120) | self.quit = QtGui.QPushButton("Quit", self) | self.quit.setGeometry(62, 40, 75, 30) | self.quit.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold)) | self.connect(self.quit, QtCore.SIGNAL("clicked()"), QtG

Re: Lists and Tuples and Much More

2007-04-14 Thread James Stroud
Hendrik van Rooyen wrote: > > "7stud" <[EMAIL PROTECTED]> wrote: > > >>.. But using a tuple as a >>key in a dictionary is probably something you will never do. > > > Yikes! I do this all the time... > > Think of an address in any one town. > It has a Street, and a number > (could

Re: That might be the case for more complex objects...

2007-04-14 Thread DillonCo
On Saturday 14 April 2007, James Stroud wrote: > I think that after a += 1, a memory location with a 6 is created and now > a points to that because += has assignment buried in it. Bingo. a+=1 will (basically) translate to either "a=a.__iadd__(1)" or "a=a.__add__(1)" depending on whether __ia

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I would like to have something like "option base" in Visual Basic. | IIRC it used to allow me to choose whether 0 or 1 should be used as | the base of member indices of arrays. In Python, the same can be used | with strings, lists, tup

Re: Pydoc Rewrite Discussion at doc-sig list.

2007-04-14 Thread Ron Adam
Colin J. Williams wrote: > Ron Adam wrote: >> If anyone is interested in participating in discussing the details of the >> PyDoc rewrite/refactoring I've been working on, a discussion is being >> started on the doc-sig list. >> >> [EMAIL PROTECTED] >> >> The goal of this discussion will be t

Re: Useful decorator

2007-04-14 Thread Paul McGuire
On Apr 14, 5:03 pm, Paul Rubin wrote: > In the course of writing a bunch of generator-oriented code I kept > wanting to temporarily truncate the output of generators for debugging, > i.e. I might have a function like > > def generate_bazillion_items(): >for li

optparse -- anyway to find if the user entered an option?

2007-04-14 Thread Karthik Gurusamy
Hi, I see that I can provide a default value for an option. But I couldn't find out any way if the user really entered the option or the option took that value because of default. A simple check for value with default may not always work as the user might have manually entered the same default val

Re: optparse -- anyway to find if the user entered an option?

2007-04-14 Thread James Stroud
Karthik Gurusamy wrote: > Hi, > > I see that I can provide a default value for an option. But I couldn't > find out any way if the user really entered the option or the option > took that value because of default. A simple check for value with > default may not always work as the user might have m

Getting started with python

2007-04-14 Thread Eric
Hello, after reading some of the book Programming Python it seems that python is something I would like to delve deeper into. The only thing is, I have no idea what I should try and write. So I was hoping that someone here could help point me to a group/project that would be a good starting place f

Re: Python Feature Request: Explicit variable declarations

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 15:55:03 +, Dennis Lee Bieber wrote: > Names are references to the RHS object itself. > > a = 5 > > means that somewhere in memory is an integer object with the value "5"; > the name "a" is now "pasted onto" that integer object. That's not correct, as it implies t

Re: Python and XML?

2007-04-14 Thread Leonard J. Reder
Thanks for the response. This package does look interesting. What I as really after though was other possible solutions like JAX in the Java world or Gnosis in the Python world. Something that can take a Relax NG Schema and compile it into a bunch of parser/generator objects for handling an XML f

function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Mike
While trying to write a recursive function involving lists, I came across some (to me) odd behavior which I don't quite understand. Here's a trivial function showing the problem. >>> def f(l, r = []): for itm in l: r.append(itm) print r >>> a = [1,2,3]

Re: That might be the case for more complex objects...

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 16:03:03 -0400, Bart Willems wrote: > I can try this in interactive mode: > >>> a = 5 > >>> b = a > >>> a += 1 > >>> print b > 5 > > So, if /a/ and /b/ where pointing to the *same* "5" in memory, then I > would expect b to be increased, just as a. This is what you are i

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Alex Martelli
faulkner <[EMAIL PROTECTED]> wrote: ... > __future__ is used to access upcoming features, and changing the base > offset is not [and never will be] slated for future development. zero > has been used as the base offset in all real languages since the dawn > of time, and isn't something that can

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Alex Martelli
Sherm Pendley <[EMAIL PROTECTED]> wrote: > "Paddy" <[EMAIL PROTECTED]> writes: > > > I don't think we should add it to Python > > because it would make porting VB code easier. > > Great Cthulhu no! > > I chimed in because your first comment regarding Perl implied that it's > commonplace for Per

Re: Seeking list of Python applications on OS X

2007-04-14 Thread Kevin Walzer
Kevin Walzer wrote: > Hello, > > I am seeking to update this wiki page, which lists Mac OS X applications > using Python in a significant way: > > http://wiki.python.org/moin/MacPython/MacSoftwareUsingPython > I have updated the page. Thanks to all for their suggestions. -- Kevin Walzer Co

Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Troy Melhase
On 4/14/07, Mike <[EMAIL PROTECTED]> wrote: > While trying to write a recursive function involving lists, I came > across some (to me) odd behavior which I don't quite understand. Here's > a trivial function showing the problem. from http://docs.python.org/ref/function.html : Default parameter va

Re: Getting started with python

2007-04-14 Thread [EMAIL PROTECTED]
I'd like to second this request or at least find out if there are any type of Python mentorship programs I could join. -- http://mail.python.org/mailman/listinfo/python-list

Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Mike
Thanks, Troy. I never cease to be amazed at what can be discovered by reading the manual! Mike Troy Melhase wrote: > On 4/14/07, Mike <[EMAIL PROTECTED]> wrote: >> While trying to write a recursive function involving lists, I came >> across some (to me) odd behavior which I don't quite understa

Method calls and stack consumption

2007-04-14 Thread Martin Manns
Hi, Calling methods of other object instances seems quite expensive on the stack (see example below). Is there a better way of traversing through methods of instances that are connected in a cyclic graph? (The real program's graph contains multiple successors in lists.) class A(object): def _

Traceback when trying to run script from cron?

2007-04-14 Thread erikcw
Hi all, When trying to run this python script from cron, I get the following error: Traceback (most recent call last): File "/home/lybp/public_html/wa/wa.py", line 14, in ? import MySQLdb ImportError: No module named MySQLdb The cron command is python /home/lybp/public_html/wa/wa.py Any id

Re: Useful decorator

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 15:03:00 -0700, Paul Rubin wrote: > Then to chop bazillion_items to 20 items, I just write: > > @truncate(20) > def generate_bazillion_items(): >for line in bazillion_line_file: > yield itemify(line) > > When I want to run the whole file, I comment o

Re: optparse -- anyway to find if the user entered an option?

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 16:49:22 -0700, Karthik Gurusamy wrote: > I'm wondering if there is a cleaner approach -- something like > parser.opt_seen("-i") What do dir(parser) and help(parser) say? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 17:33:11 -0800, Troy Melhase wrote: > On 4/14/07, Mike <[EMAIL PROTECTED]> wrote: >> While trying to write a recursive function involving lists, I came >> across some (to me) odd behavior which I don't quite understand. Here's >> a trivial function showing the problem. > > fro

Re: Useful decorator

2007-04-14 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > if __debug__: >generate_bazillion_items = truncate(20)(generate_bazillion_items) > > Now you don't have to comment/uncomment dozens of lines all over your > application, but only set a single global. The cool thing about organizing the program as

Re: Python Feature Request: Explicit variable declarations

2007-04-14 Thread Alex Martelli
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: ... > In Python, the "variable" NAME does NOT define storage; unlike most > other classical languages where the "variable name" is a storage > address, and the value of the RHS is COPIED to that address. Python does > not do such copying. Names

Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Alex Martelli
Mike <[EMAIL PROTECTED]> wrote: ... > Why is "r" not being reset to the empty list on subsequent calls? It > seems like it should be reinitialized when not explicitly provided. Alex -- http://mail.python

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Paddy
On Apr 15, 2:29 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Sherm Pendley <[EMAIL PROTECTED]> wrote: > > "Paddy" <[EMAIL PROTECTED]> writes: > > > > I don't think we should add it to Python > > > because it would make porting VB code easier. > > > Great Cthulhu no! > > > I chimed in because your

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread jamadagni
On Apr 15, 2:01 am, Bjoern Schliessmann wrote: > > self.myVar -- something lost, something gained, IMHO. > > So, the gain is the loss of something different? If you say so. My mistake - I should have said "no pain, no gain". > IMHO, the ability to find something quickly weighs much stronger > t

Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Paddy
On Apr 15, 3:58 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 14 Apr 2007 17:33:11 -0800, Troy Melhase wrote: > > On 4/14/07, Mike <[EMAIL PROTECTED]> wrote: > >> While trying to write a recursive function involving lists, I came > >> across some (to me) odd behavior which I don't quite

Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread BJörn Lindqvist
> This comes up so often that I wonder whether Python should issue a warning > when it sees [] or {} as a default argument. > > > What do people think? A misuse or good use of warnings? I think Python should reevaluate the default values. -- mvh Björn -- http://mail.python.org/mailman/listinfo/

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Dan Bishop
On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > The FORTRAN family had started as 1-based (F95, and Ada, now allow > for each array to have its own "base" => x : array (-10..10) of float). > Pascal, I forget... Pascal allows arbitrary array bases. It's where Ada got t

Re: Getting started with python

2007-04-14 Thread Paddy
On Apr 15, 1:46 am, "Eric" <[EMAIL PROTECTED]> wrote: > Hello, after reading some of the book Programming Python it seems that > python is something I would like to delve deeper into. The only thing > is, I have no idea what I should try and write. So I was hoping that > someone here could help poi

Re: Python Feature Request: Explicit variable declarations

2007-04-14 Thread jamadagni
On Apr 14, 3:56 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > for prior discussion. The request is sane, but is also incomplete: there > is no syntax suggested for the actual declarations of local variables, > and no discussion whether this is meant to apply to local variables > only, or also

Re: optparse -- anyway to find if the user entered an option?

2007-04-14 Thread Karthik Gurusamy
On Apr 14, 7:54 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 14 Apr 2007 16:49:22 -0700, Karthik Gurusamy wrote: > > I'm wondering if there is a cleaner approach -- something like > > parser.opt_seen("-i") > > What do dir(parser) and help(parser) say? They don't seem to convey existenc

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 03:42:52 -0700, samjnaa wrote: > Please check for sanity and approve for posting at python-dev. > > In Visual Basic there is the keyword "with" which allows an object- > name to be declared as governing the following statements. For > example: > > with quitCommandButton > .e

Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Steven D'Aprano
On Sun, 15 Apr 2007 05:29:01 +0200, BJörn Lindqvist wrote: >> This comes up so often that I wonder whether Python should issue a warning >> when it sees [] or {} as a default argument. >> >> >> What do people think? A misuse or good use of warnings? > > I think Python should reevaluate the defaul

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 20:34:46 -0700, Dan Bishop wrote: > On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > >> The FORTRAN family had started as 1-based (F95, and Ada, now allow >> for each array to have its own "base" => x : array (-10..10) of float). >> Pascal, I forget.

Re: Emergence of Grok

2007-04-14 Thread LesF
On Apr 14, 10:05 pm, Anton Vredegoor <[EMAIL PROTECTED]> wrote: ... > That doesn't mean that I haven't met a lot of enthusiastic and helpful > zope developers and programmers, it's just that they don't understand or > don't want to understand that money can be a show stopper for people > wanting to

Re: Python Feature Request: Explicit variable declarations

2007-04-14 Thread Ganesan Rajagopal
> "Martin" == Martin v Löwis <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] schrieb: >> Hello. Please tell me whether this feature request is sane (and not >> done before) for python so it can be posted to the python-dev mailing >> list. I should say first that I am not a professional program

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 14 Apr 2007 20:34:46 -0700, Dan Bishop wrote: > > > On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > >> The FORTRAN family had started as 1-based (F95, and Ada, now allow > >> for each array to have its own "base

Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 15 Apr 2007 05:29:01 +0200, BJörn Lindqvist wrote: > > >> This comes up so often that I wonder whether Python should issue a warning > >> when it sees [] or {} as a default argument. > >> > >> > >> What do people think? A misuse or good use of

Re: Lists and Tuples and Much More

2007-04-14 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: > It sure looks like t changed, and therefore t is NOT immutable--and > the whole "tuples are immutable" mantra is a lie. However, the list """ So, "the statue that points to Hotel Belfiore" h

Re: Making a tree out of a 2 column list

2007-04-14 Thread Peter Otten
Sebastian Bassi wrote: > On 14 Apr 2007 09:32:07 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > def tree_path(key,tree,indent): > > print '\t'*indent,key > > if tree.has_key(key): > > for m in tree[key]: > > tree_path(m,tree,indent+1) > > return > > Tha

proposed PEP: iterator splicing

2007-04-14 Thread Paul Rubin
The boilerplate def some_gen(): ... for x in some_other_gen(): yield x ... is so common (including the case where some_other_gen is the same as some_gen, i.e. it's a recursive call) that I find myself wanting a more direct way to express it: def some_g

Re: Method calls and stack consumption

2007-04-14 Thread Peter Otten
Martin Manns wrote: > Calling methods of other object instances seems quite expensive on the > stack (see example below). Is there a better way of traversing through > methods of instances that are connected in a cyclic graph? (The real > program's graph contains multiple successors in lists.) >

Re: Reading the first line of a file (in a zipfile)

2007-04-14 Thread Gabriel Genellina
En Fri, 13 Apr 2007 08:59:30 -0300, <[EMAIL PROTECTED]> escribió: > That works fine if I am using the interpreter, but I get 'cannot open > file' when i try to read from an archive.. > Does that make sense? Sorry, this is my 2nd python script. Try a small, failing example and post the code and th

combination function in python

2007-04-14 Thread DanielJohnson
how to use the combination function in python ? For example 9 choose 2 (written as 9C2) = 9!/7!*2!=36 Please help, I couldnt find the function through help. -- http://mail.python.org/mailman/listinfo/python-list

Re: combination function in python

2007-04-14 Thread Alex Martelli
DanielJohnson <[EMAIL PROTECTED]> wrote: > how to use the combination function in python ? > > For example 9 choose 2 (written as 9C2) = 9!/7!*2!=36 > > Please help, I couldnt find the function through help. If you download and install gmpy, it's easy: >>> import gmpy >>> gmpy.comb(9,2) mpz(36

Re: Append data to a list within a dict

2007-04-14 Thread Alex Martelli
Tina I <[EMAIL PROTECTED]> wrote: ... > He he... at the age of 40 I'm well beyond school work ;) Why would that be? My wife's over 40, yet she's a student (currently at Stanford -- they were overjoyed to admit her, with lot of life experience as well as previous studies, apparently). She's no

Re: proposed PEP: iterator splicing

2007-04-14 Thread John Nagle
Paul Rubin wrote: > Less clutter, and avoids yet another temp variable > polluting the namespace. Are we in danger of running out of temp variables? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 22:02:47 -0700, Alex Martelli wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> On Sat, 14 Apr 2007 20:34:46 -0700, Dan Bishop wrote: >> >> > On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >> > >> >> The FORTRAN family had started as 1-based

Re: Reading the first line of a file (in a zipfile)

2007-04-14 Thread 7stud
On Apr 11, 1:13 pm, [EMAIL PROTECTED] wrote: > Hi folks, > > The first line in the file I am examining will be a number followed by > more whitespace. Looks like I cannot split by whitespace? > but I get 'cannot open > file' when i try to read from an archive.. ...and that led you to conclude tha

Re: tuples, index method, Python's design

2007-04-14 Thread Rhamphoryncus
On Apr 14, 11:59 am, Paul Rubin wrote: > "Rhamphoryncus" <[EMAIL PROTECTED]> writes: > > Nope, it's pretty fundamental to working with text, unicode only being > > an extreme example: there's a wide number of ways to break down a > > chunk of text, making the odds of "e"

Re: proposed PEP: iterator splicing

2007-04-14 Thread Carsten Haese
On 14 Apr 2007 22:17:08 -0700, Paul Rubin wrote > The boilerplate > > def some_gen(): >... >for x in some_other_gen(): >yield x >... > > is so common (including the case where some_other_gen is the same as > some_gen, i.e. it's a recursive call) that I find

<    1   2