Re: scope of function parameters (take two)

2011-05-30 Thread Chris Rebert
On Mon, May 30, 2011 at 11:37 PM, Henry Olders wrote: > On 2011-05-31, at 1:13 , Wolfgang Rohdewald wrote: >> >> what you really seem to want is that a function by default >> cannot have any side effects (you have a side effect if a >> function changes things outside of its local scope). But >> th

Something is rotten in Denmark...

2011-05-30 Thread harrismh777
fs=[] fs = [(lambda n: i + n) for i in range(10)] [fs[i](1) for i in range(10)] [10, 10, 10, 10, 10, 10, 10, 10, 10, 10] <=== not good ( that was a big surprise! . . . ) ( let's try it another way . . . ) fs =[] def g(i): return (lambda n: i + n) fs = [g(i) for i in range(10)]

Re: scope of function parameters (take two)

2011-05-30 Thread Henry Olders
On 2011-05-31, at 1:13 , Wolfgang Rohdewald wrote: > > what you really seem to want is that a function by default > cannot have any side effects (you have a side effect if a > function changes things outside of its local scope). But > that would be a very different language than python You're pa

Re: How to Use Setuptools, Alternatives?

2011-05-30 Thread Nitin Pawar
there is a very good article on python packaging http://www.aosabook.org/en/packaging.html On Tue, May 31, 2011 at 12:18 AM, dough wrote: > On May 29, 10:41 pm, ray wrote: > > I have Python 2.7 on Win7 Pro on a tightly locked down desktop. I > > would like to install Networkx from an egg. Fr

Re: Beginner needs advice

2011-05-30 Thread Ben Finney
Dennis Lee Bieber writes: > Well... He did say "find the bathroom", not ask for directions to > whatever euphemism is in current usage (water closet, W/C, loo ?) The room which contains the bath is the bathroom. Assuming that the toilet is in the same room as the bath is parochial. If he

Re: scope of function parameters (take two)

2011-05-30 Thread Daniel Kluev
On Tue, May 31, 2011 at 4:13 PM, Wolfgang Rohdewald wrote: > what you really seem to want is that a function by default > cannot have any side effects (you have a side effect if a > function changes things outside of its local scope). But > that would be a very different language than python This

Re: Beginner needs advice

2011-05-30 Thread Benjamin Kaplan
On Mon, May 30, 2011 at 10:20 PM, Dennis Lee Bieber wrote: > On Mon, 30 May 2011 21:34:09 -0400, Terry Reedy > declaimed the following in gmane.comp.python.general: > >> On 5/30/2011 8:32 PM, harrismh777 wrote: >> >> > Ever tried to read Beowulf in the original? Ever tried to write Ænglisc ? >> >

Re: scope of function parameters (take two)

2011-05-30 Thread Ben Finney
Daniel Kluev writes: > On a sidenote, I wonder what is the reason to keep word 'variable' in > python documentation at all. I believe word 'name' represents concept > better, and those, who come from other languages, would be less likely > to associate wrong definitions with it. I agree, but the

Re: scope of function parameters (take two)

2011-05-30 Thread Thomas Rachel
Am 31.05.2011 02:28 schrieb Henry Olders: This suggests that the decision to make unassigned (ie "free" variables) have a global scope, was made somewhat arbitrarily to prevent clutter. But I don't believe that the feared clutter would materialize. My understanding is that when a variable is ref

Re: scope of function parameters (take two)

2011-05-30 Thread Wolfgang Rohdewald
On Dienstag 31 Mai 2011, Henry Olders wrote: > What I would like is that the variables which are included in > the function definition's parameter list, would be always > treated as local to that function (and of course, accessible > to nested functions) but NOT global unless explicitly defined > a

Re: scope of function parameters (take two)

2011-05-30 Thread Steven D'Aprano
On Mon, 30 May 2011 20:28:34 -0400, Henry Olders wrote: > I am trying to write python programs in a more-or-less functional > programming mode, ie functions without side effects (except for print > statements, which are very helpful for debugging). This is easiest when > all variables declared in

Re: scope of function parameters (take two)

2011-05-30 Thread Dan Stromberg
On Mon, May 30, 2011 at 5:28 PM, Henry Olders wrote: > What I would like is that the variables which are included in the function > definition's parameter list, would be always treated as local to that > function (and of course, accessible to nested functions) but NOT global > unless explicitly de

pydev ant build

2011-05-30 Thread prakash jp
Hi all, Could any one provide relevant url/s on the usage of *pyant* scripts and its setup as well Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters (take two)

2011-05-30 Thread Chris Angelico
On Tue, May 31, 2011 at 1:18 PM, Daniel Kluev wrote: > On Tue, May 31, 2011 at 2:05 PM, Chris Angelico wrote: >> Infinitely-nested scoping is simply one of the casualties of a >> non-declarative language. > > Well, this is not accurate, as you can have 'infinitely-nested > scoping' in python, in

Re: scope of function parameters (take two)

2011-05-30 Thread Daniel Kluev
On Tue, May 31, 2011 at 2:05 PM, Chris Angelico wrote: > Infinitely-nested scoping is simply one of the casualties of a > non-declarative language. Well, this is not accurate, as you can have 'infinitely-nested scoping' in python, in form of nested functions. For example, you can use map(lambda x

Re: scope of function parameters (take two)

2011-05-30 Thread Chris Angelico
On Tue, May 31, 2011 at 10:28 AM, Henry Olders wrote: > I don't believe I'm the only person who thinks this way. Here is a quote from > wikipedia: "It is considered good programming practice to make the scope of > variables as narrow as feasible so that different parts of a program do not > acc

Re: Beginner needs advice

2011-05-30 Thread harrismh777
Chris Angelico wrote: Hmm. If you did write those two scripting languages, we would finally be able to type "man woman" to get docs on how to talk to women... Which just wouldn't be fair, because her use of man man would lead her no closer to understanding how men speak... (er, think, um.

Re: python in school notebooks/laptops

2011-05-30 Thread Chris Angelico
On Tue, May 31, 2011 at 10:57 AM, harrismh777 wrote: > Chris Angelico wrote: >> Possibly the best way to encourage Python deployment would be to >> require it to run some internal script. > >   Chris has a great idea here... but I think more along the lines of an app > that benefits school admins

Re: Beginner needs advice

2011-05-30 Thread Chris Angelico
On Tue, May 31, 2011 at 11:16 AM, Ian Kelly wrote: > On Mon, May 30, 2011 at 6:43 PM, harrismh777 wrote: >>>  If you disagree, then I invite you to list one example of two >>> different things that are compatible. >> >>   one man, and one woman > > Now you're equivocating.  The discussion has

Re: scope of function parameters (take two)

2011-05-30 Thread Daniel Kluev
On Tue, May 31, 2011 at 12:30 PM, Terry Reedy wrote: > Again, go back and reread what I and other wrote. I believe that you are, in > part, hypnotized by the work 'variable'. Can you define the word? There are > 10 to 20 possible variations, and yours is probably wrong for Python. On a sidenote,

Re: Beginner needs advice

2011-05-30 Thread Terry Reedy
On 5/30/2011 8:32 PM, harrismh777 wrote: However, I guarantee that if I'm dumped unaided in Piccadilly I'll be able to hail a cab, pay my £12.00 and get myself to Liverpool Street Station, find the bathroom, and be on the correct train just in time for dinner, all without looking into the Engli

Re: Beginner needs advice

2011-05-30 Thread Terry Reedy
On 5/30/2011 8:32 PM, harrismh777 wrote: Ever tried to read Beowulf in the original? Ever tried to write Ænglisc ? I have, and it is a lot further from modern American than Python 2 and 3 are from each other. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters (take two)

2011-05-30 Thread Terry Reedy
On 5/30/2011 8:28 PM, Henry Olders wrote: Sadly, I feel that the main issue that I was trying to address, has not been dealt with. False. Please go back and read what I and others wrote before. ... What I would like is that the variables which are included in the function definition's param

Re: Beginner needs advice

2011-05-30 Thread Ian Kelly
On Mon, May 30, 2011 at 6:43 PM, harrismh777 wrote: >> I realize you are now asserting that compatibility is a boolean >> condition, and that "totally incompatible" is a redundant phrase that >> you tossed out as a joke.  I don't know whether you're sincere or >> backpedaling, but in any case this

Re: python in school notebooks/laptops

2011-05-30 Thread Terry Reedy
On 5/30/2011 6:15 PM, Irmen de Jong wrote: Do you mean one of these os's, where Python (2) is not working properly because the *defaultencoding* is set to utf-8? Huh? On all of my machines, including windows and Ubuntu 11.04, sys.getdefaultencoding() returns 'ascii'. For me, WINXP, 2.7 >>>

Re: scope of function parameters (take two)

2011-05-30 Thread Daniel Kluev
On Tue, May 31, 2011 at 11:28 AM, Henry Olders wrote: > What I would like is that the variables which are included in the function > definition's parameter list, would be always treated as local to that function You still mis-reading docs and explanations you received from the list. Let me try a

Re: Beginner needs advice

2011-05-30 Thread Rhodri James
On Tue, 31 May 2011 01:32:01 +0100, harrismh777 wrote: Steven D'Aprano wrote: Compatibility is inherently continuous, a matter of degree. Compatible by degrees is incompatible. Just 'how' incompatible determines whether the factor(s) are utterly useless, or just difficult to negoti

Re: python in school notebooks/laptops

2011-05-30 Thread harrismh777
Chris Angelico wrote: Is it a waste of time to try to get school admins to put python in > their school laptops? No, absolutely no... Python advocacy is necessary in this venue ! Possibly the best way to encourage Python deployment would be to require it to run some internal scr

Re: scope of function parameters (take two)

2011-05-30 Thread Benjamin Kaplan
On Mon, May 30, 2011 at 5:28 PM, Henry Olders wrote: > > On 2011-05-29, at 4:30 , Henry Olders wrote: > >> I just spent a considerable amount of time and effort debugging a program. >> The made-up code snippet below illustrates the problem I encountered: >> >> def main(): >>       a = ['a list','

Re: Beginner needs advice

2011-05-30 Thread harrismh777
Jason Tackaberry wrote: At least, his arguments make more sense if I read him as arguing from the "not completely compatible" position. It's possible he is intentionally equivocating for dramatic effect. yes -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner needs advice

2011-05-30 Thread harrismh777
Ian Kelly wrote: You have just misrepresented Steven's argument, which is rather ironic considering that you're the one who brought up straw-men. Steven did not use one code snippet to demonstrate that Python 2 and Python 3 are fully compatible. The code snippet merely demonstrated that Python

Re: Beginner needs advice

2011-05-30 Thread harrismh777
Steven D'Aprano wrote: LOL I invite you to consider the difference between a legally dead person moments before being resuscitated by a paramedic, ( ... alive ) versus a chicken that has just been beheaded and is still running around the yard, ( ... alive ) versus a million-

Re: scope of function parameters (take two)

2011-05-30 Thread Henry Olders
On 2011-05-29, at 4:30 , Henry Olders wrote: > I just spent a considerable amount of time and effort debugging a program. > The made-up code snippet below illustrates the problem I encountered: > > def main(): > a = ['a list','with','three elements'] > print a > print fnc1(a)

Re: float("nan") in set or as key

2011-05-30 Thread Steven D'Aprano
On Mon, 30 May 2011 19:58:35 +, Chris Torek wrote: > In article <4de3358b$0$29990$c3e8da3$54964...@news.astraweb.com> Steven > D'Aprano wrote: >>Better than a float method is a function which takes any number as >>argument: >> > import math, fractions, decimal > math.isnan(fractions.

Re: English Idiom in Unix: Directory Recursively

2011-05-30 Thread Steven D'Aprano
On Mon, 30 May 2011 23:04:41 +0200, Rikishi42 wrote: > On 2011-05-28, Chris Angelico wrote: >> I think it's geographic. This list covers a lot of geography; I'm in >> Australia, there are quite a few Brits, and probably the bulk of posts >> come from either the US or Europe. (And yes, I did delib

Pydev 2.1.0 Released

2011-05-30 Thread Fabio Zadrozny
Hi All, Pydev 2.1.0 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- Code Analysis By default, only the currently opened editor will be analyzed (resulting in much shorter build t

Re: python in school notebooks/laptops

2011-05-30 Thread Irmen de Jong
On 30-5-2011 16:30, jmfauth wrote: > On 30 mai, 13:09, hackingKK wrote: > > [...] > >> >> Even better, try convincing them to use Ubuntu instead of a virus >> called Where I Never Do Operations With Safety, or WINDOWS for short. >> That way Python will come by default and VB will be out of que

sqlalchemy and Unicode strings: errormessage

2011-05-30 Thread Wolfgang Meiners
Hi, I am trying to build an application using sqlalchemy. in principle i have the structure #== from sqlalchemy import * from sqlalchemy.orm import * metadata = MetaData('sqlite://') a_table = Table('tf_lehrer', metadata, Column('id', Integer, pr

Re: How to catch a line with Popen

2011-05-30 Thread Chris Torek
>Chris Torek wrote: >> In at least some versions of Python 2 [the "file"-type object iterators behave badly with pipes] (This may still be true in Python 3, I just have no experience with Py3k. "At least some version of Python 2" means "the ones I have access to, and have tried." :-) ) In articl

Re: English Idiom in Unix: Directory Recursively

2011-05-30 Thread Rikishi42
On 2011-05-28, Chris Angelico wrote: > Chris Angelico > yes, bit of a Bible geek as well as a programming geek So you don't believe in genetic algorithms, then ? (ducking for cover) -- When in doubt, use brute force. -- Ken Thompson -- http://mail.python.org/mailman/listinf

Re: English Idiom in Unix: Directory Recursively

2011-05-30 Thread Rikishi42
On 2011-05-28, Chris Angelico wrote: > I think it's geographic. This list covers a lot of geography; I'm in > Australia, there are quite a few Brits, and probably the bulk of posts > come from either the US or Europe. (And yes, I did deliberately fold > all of Europe down to one entity, and I did

Re: float("nan") in set or as key

2011-05-30 Thread Chris Torek
In article <4de3358b$0$29990$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano wrote: >Better than a float method is a function which takes any number as >argument: > import math, fractions, decimal math.isnan(fractions.Fraction(2, 3)) >False math.isnan(decimal.Decimal('nan')) >

Re: Best way to compute length of arbitrary dimension vector?

2011-05-30 Thread Gabriel Genellina
En Mon, 30 May 2011 06:46:01 -0300, Peter Otten <__pete...@web.de> escribió: Gabriel wrote: Well, the subject says it almost all: I'd like to write a small Vector class for arbitrary-dimensional vectors. class Vector(object): ... def __init__(self, *coords): ... self._coor

Re: How to Use Setuptools, Alternatives?

2011-05-30 Thread dough
On May 29, 10:41 pm, ray wrote: > I have Python 2.7 on Win7 Pro on a tightly locked down desktop.  I > would like to install Networkx from an egg.  From what I have read, > Setuptools can be used for this. > > I don't know how to install Setuptools.  The exe will not work.  On > execution, it repo

Re: GIL in alternative implementations

2011-05-30 Thread Pascal Chambon
Thanks for the details on IronPython's implementation B-) Hopefully Pypy will eventually get rid of its own Gil, since it doesn't do refcounting either. Regards, Pascal Le 28/05/2011 00:52, Dino Viehland a écrit : In IronPython we have fine grained locking on our mutable data structures.

3rd party tree/outline data structure module?

2011-05-30 Thread python
Before I reinvent the wheel, I'm wondering if anyone can recommend a 3rd party tree data structure module? (I do not need a GUI component) I've looked at ElementTree but I think(?) need something more flexible. I have a parser that reads a proprietary file format which defines an outline-like str

Re: scope of function parameters

2011-05-30 Thread Terry Reedy
On 5/30/2011 5:08 AM, Laurent Claessens wrote: Le 30/05/2011 11:02, Terry Reedy a écrit : On 5/30/2011 3:38 AM, Laurent wrote: Cool. I was thinking that "5" was the name, but >>> 5.__add__(6) File "", line 1 5.__add__(6) Try 5 .__add__(6) What is the rationale behind the fact to add a spa

Re: searching in list

2011-05-30 Thread Ian Kelly
On Mon, May 30, 2011 at 7:41 AM, Chris Angelico wrote: > If you're always going to look them up by the argument, the best way > would be to use a dictionary: > cache={arg1: res1, arg2: res2, ...} > > Then you can search with a simple: cache[arg135] > > You can add things with: cache[arg135]=res135

Re: How to catch a line with Popen

2011-05-30 Thread TheSaint
Chris Torek wrote: > In at least some versions of Python 2 I'm with P3k :P. However thank you for your guidelines. Last my attempt was to use a *for* p.wait() , as mentioned earlier That looks good enough. I noted some little delay for the first lines, mostly sure Popen assign some buffer even

Re: searching in list

2011-05-30 Thread Chris Angelico
On Mon, May 30, 2011 at 11:50 PM, vino19 wrote: > Thanks. > > It seems that dictionary is a sorted list of tuples, so the procedure of > searching an element is quite quick. Not sorted - it's hashed, so it's even faster. Yep, sounds like a dictionary is everything you want! Chris Angelico -- h

Re: python in school notebooks/laptops

2011-05-30 Thread jmfauth
On 30 mai, 13:09, hackingKK wrote: [...] > > Even better, try convincing them to use Ubuntu instead of  a virus > called Where I Never Do Operations With Safety, or WINDOWS for short. > That way Python will come by default  and VB will be out of question > Happy hacking. > Krishnakant. Do you m

Re: searching in list

2011-05-30 Thread vino19
Thanks. It seems that dictionary is a sorted list of tuples, so the procedure of searching an element is quite quick. -- http://mail.python.org/mailman/listinfo/python-list

Re: searching in list

2011-05-30 Thread Chris Angelico
On Mon, May 30, 2011 at 10:58 PM, vino19 wrote: > I want to make a function that is called only once per one argument. I mean I > want to store data of function calling to prevent calling it again if there > is no need. > How to make it? For example I can make a global list that just consist of

Re: Best way to compute length of arbitrary dimension vector?

2011-05-30 Thread Gabriel
Thanks a lot to both of you, Chris & Peter! (I knew the solution would be simple ... ;-) ) -- http://mail.python.org/mailman/listinfo/python-list

Re: python in school notebooks/laptops

2011-05-30 Thread Chris Angelico
On Mon, May 30, 2011 at 8:15 PM, John Thornton wrote: > Hello >     Is it a waste of time to try to get school admins to put python in > their school laptops? Two halves to this question. 1) Would it be of value if the school admins were to put Python on the school laptops? 2) If you ask the

Re: searching in list

2011-05-30 Thread Dave Angel
On 01/-10/-28163 02:59 PM, vino19 wrote: I want to make a function that is called only once per one argument. I mean I want to store data of function calling to prevent calling it again if there is no need. How to make it? For example I can make a global list that just consist of tuples [(arg1,

Re: English Idiom in Unix: Directory Recursively

2011-05-30 Thread Peter Moylan
rantingrick wrote: > On May 18, 12:59 pm, s...@sig.for.address (Victor Eijkhout) wrote: >> Harrison Hill wrote: >>> No need - I have the Dictionary definition of recursion here: >>> Recursion: (N). See recursion. >> If you tell a joke, you have to tell it right. > > Jeez, speaking of bad colloqui

searching in list

2011-05-30 Thread vino19
I want to make a function that is called only once per one argument. I mean I want to store data of function calling to prevent calling it again if there is no need. How to make it? For example I can make a global list that just consist of tuples [(arg1, res1), (arg2, res2), ...]. Ok, how to se

Re: English Idiom in Unix: Directory Recursively

2011-05-30 Thread Peter Moylan
rantingrick wrote: > On May 18, 7:19 am, Peter Moylan > wrote: > >> It's interesting to note that the definitions of 'recursive' to be found >> in Wikipedia and Wiktionary have very little in common with the >> definitions to be found in the dictionaries covered by Onelook. No >> wonder experts

SQLObject 1.0.1

2011-05-30 Thread Oleg Broytman
Hello! I'm pleased to announce version 1.0.1, a bugfix release of branch 1.0 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to us

Re: python in school notebooks/laptops

2011-05-30 Thread John Thornton
I agree fully. Linux is better and safer. But they seem hellbent on getting their students to use Windows. For laughs the kids in year 7 start off with this on their school netbook: Individual software packages MS Office Professional 2010 $80.30 (Word, Excel, PowerPoint, Access, Outlook, Publi

Re: python in school notebooks/laptops

2011-05-30 Thread hackingKK
On 30/05/11 15:45, John Thornton wrote: Hello Is it a waste of time to try to get school admins to put python in their school laptops? OK. Here's the crib for the rest[!] of the world. Here in Australia most secondary schools [that is kids from age approx 12-18] have some sor

Re: Abandoning Python

2011-05-30 Thread Piotr Kamiński
I'm sorry, I wanted to send the message below to the list and instead I sent it to just one user. Piotr Dnia 23-05-2011 o 10:29:24 Piotr Kamiński napisał(a): Dnia 23-05-2011 o 00:58:55 Brendan Simon (eTRIX) napisał(a): ... Take a look at Cobra. http://cobra-language.com/docs/pytho

Re: scope of function parameters

2011-05-30 Thread Jussi Piitulainen
Laurent Claessens writes: > Le 30/05/2011 11:02, Terry Reedy a écrit : > > On 5/30/2011 3:38 AM, Laurent wrote: > > > >> Cool. I was thinking that "5" was the name, but > >> >>> 5.__add__(6) > >> File "", line 1 > >> 5.__add__(6) > > > > > > Try 5 .__add__(6) > > What is the rationale behind

python in school notebooks/laptops

2011-05-30 Thread John Thornton
Hello Is it a waste of time to try to get school admins to put python in their school laptops? OK. Here's the crib for the rest[!] of the world. Here in Australia most secondary schools [that is kids from age approx 12-18] have some sort of netbook/laptop program. I have looked at a

Re: scope of function parameters

2011-05-30 Thread Laurent Claessens
What is the rationale behind the fact to add a space between "5" and ".__add__" ? Why does it work ? It's a hint for the tokenizer. I didn't know the tokenizer. Now I understand. Thanks Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters

2011-05-30 Thread Laurent Claessens
What is the rationale behind the fact to add a space between "5" and ".__add__" ? Why does it work ? It's a hint for the tokenizer. I didn't know the tokenizer. Now I understand. Thanks Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to compute length of arbitrary dimension vector?

2011-05-30 Thread Peter Otten
Gabriel wrote: > Well, the subject says it almost all: I'd like to write a small Vector > class for arbitrary-dimensional vectors. > > I am wondering what would be the most efficient and/or most elegant > way to compute the length of such a Vector? > > Right now, I've got > > def length(self)

Re: scope of function parameters

2011-05-30 Thread Peter Otten
Laurent Claessens wrote: > Le 30/05/2011 11:02, Terry Reedy a écrit : >> On 5/30/2011 3:38 AM, Laurent wrote: >> >>> Cool. I was thinking that "5" was the name, but >>> >>> 5.__add__(6) >>> File "", line 1 >>> 5.__add__(6) >> >> >> Try 5 .__add__(6) > > What is the rationale behind the fact

Re: Best way to compute length of arbitrary dimension vector?

2011-05-30 Thread Chris Rebert
On Mon, May 30, 2011 at 2:11 AM, Gabriel wrote: > Well, the subject says it almost all: I'd like to write a small Vector > class for arbitrary-dimensional vectors. > > I am wondering what would be the most efficient and/or most elegant > way to compute the length of such a Vector? > > Right now, I

Re: portable way of sending notifying a process

2011-05-30 Thread News123
Thanks for all your feedback. Well, I'll play a little and go either for a wrapper around ways to detecth a file change or for a tiny socket solution. Thanks again. On 05/30/2011 04:03 AM, Chris Angelico wrote: > On Mon, May 30, 2011 at 11:44 AM, Chris Torek wrote: >>> What would be a light w

Re: Python's super() considered super!

2011-05-30 Thread Duncan Booth
Ethan Furman wrote: > foo(x=1, y=2, z=3) >> Traceback (most recent call last): >> File "", line 1, in >> foo(x=1, y=2, z=3) >> File "", line 2, in foo >> bar(y=2, **kwargs) >> TypeError: bar() got multiple values for keyword argument 'y' > > And the above error is exactly why yo

Re: scope of function parameters

2011-05-30 Thread Ben Finney
Laurent Claessens writes: > Le 30/05/2011 11:02, Terry Reedy a écrit : > > Try 5 .__add__(6) > > What is the rationale behind the fact to add a space between "5" and > ".__add__" ? > Why does it work ? Try asking it the other way around. Why doesn't ‘5.__add__(6)’, without the space, work? --

Re: scope of function parameters

2011-05-30 Thread Steven D'Aprano
On Mon, 30 May 2011 09:12:50 +0200, Laurent Claessens wrote: > Could you give an example of an object that has no name ? I've missed > something ... >>> mylist = [None, 42, "something"] The list object has a name, mylist. The three objects inside the list have no names. -- Steven -- http:

Re: scope of function parameters

2011-05-30 Thread Steven D'Aprano
On Mon, 30 May 2011 11:08:23 +0200, Laurent Claessens wrote: > Le 30/05/2011 11:02, Terry Reedy a écrit : >> On 5/30/2011 3:38 AM, Laurent wrote: >> >>> Cool. I was thinking that "5" was the name, but >>> >>> 5.__add__(6) >>> File "", line 1 >>> 5.__add__(6) >> >> >> Try 5 .__add__(6) > > W

Best way to compute length of arbitrary dimension vector?

2011-05-30 Thread Gabriel
Well, the subject says it almost all: I'd like to write a small Vector class for arbitrary-dimensional vectors. I am wondering what would be the most efficient and/or most elegant way to compute the length of such a Vector? Right now, I've got def length(self):

Re: scope of function parameters

2011-05-30 Thread Laurent Claessens
Le 30/05/2011 11:02, Terry Reedy a écrit : On 5/30/2011 3:38 AM, Laurent wrote: Cool. I was thinking that "5" was the name, but >>> 5.__add__(6) File "", line 1 5.__add__(6) Try 5 .__add__(6) What is the rationale behind the fact to add a space between "5" and ".__add__" ? Why does

Re: 3.1.4 release candidate 1

2011-05-30 Thread Alain Ketterlin
Raymond Hettinger writes: > On May 29, 3:44 pm, Benjamin Peterson wrote: >> On behalf of the Python development team, I'm happy as a swallow to announce >> a >> release candidate for the fourth bugfix release for the Python 3.1 >> series, Python >> 3.1.4. > > The Pi release of Python :-) And t

Re: scope of function parameters

2011-05-30 Thread Terry Reedy
On 5/30/2011 3:38 AM, Laurent wrote: Cool. I was thinking that "5" was the name, but >>> 5.__add__(6) File "", line 1 5.__add__(6) Try 5 .__add__(6) Modules, classes, and functions have a .__name__ attribute (I call it their 'definition name') used to print a representation. As best I can

Re: scope of function parameters

2011-05-30 Thread Daniel Kluev
On Mon, May 30, 2011 at 6:12 PM, Laurent Claessens wrote: > Could you give an example of an object that has no name ? I've missed > something ... >>> object() -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters

2011-05-30 Thread Laurent
Could you give an example of an object that has no name ? I've missed something ... def foo(): return 5 print(foo()) The int object 5 has no name here. Cool. I was thinking that "5" was the name, but >>> 5.__add__(6) File "", line 1 5.__add__(6) ^ SyntaxError: inva

Re: scope of function parameters

2011-05-30 Thread Chris Rebert
On Mon, May 30, 2011 at 12:12 AM, Laurent Claessens wrote: > Le 29/05/2011 23:42, Ben Finney a écrit : >> Peter Pearson  writes: >> >>>  Python works in terms of objects having names, and one >>>  object can have many names. >> >> Or no names. So it's less accurate (though better than talking of >

Re: scope of function parameters

2011-05-30 Thread Laurent Claessens
Le 29/05/2011 23:42, Ben Finney a écrit : Peter Pearson writes: Python works in terms of objects having names, and one object can have many names. Or no names. So it's less accurate (though better than talking of “variables”) to speak of Python objects “having names”. Could you give an e