Re: Puzzled

2015-11-08 Thread Michael Torrie
On 11/06/2015 02:36 PM, Robinson, Wendy wrote: > Ah, ok I get it now. > Thanks both! Glad you got it! Thanks for letting us know, too. -- https://mail.python.org/mailman/listinfo/python-list

RE: Puzzled

2015-11-08 Thread Robinson, Wendy
Ah, ok I get it now. Thanks both! Wendy Robinson Audit Analyst -Original Message- From: Chris Gonnerman [mailto:ch...@gonnerman.org] Sent: Friday, November 06, 2015 5:40 AM To: python-list@python.org Cc: Robinson, Wendy Subject: Re: Puzzled Wendy said: > I installed Python 3.

Re: Puzzled

2015-11-06 Thread Chris Gonnerman
Wendy said: I installed Python 3.5.0 64-bit for Windows yesterday and tried some basic programs successfully. This morning I rebooted my computer and can't get a single one to work. The interpreter seems to be fine and the environment variables look correct. But every py file I try to run at

Re: Puzzled

2015-11-06 Thread Gene Heskett
ot reply even if they could help. > -Original Message- > From: Laura Creighton [mailto:l...@openend.se] > Sent: Thursday, November 05, 2015 3:11 PM > To: Robinson, Wendy > Cc: 'Laura Creighton'; 'python-list@python.org'; l...@openend.se > Subject: Re

RE: Puzzled

2015-11-06 Thread Robinson, Wendy
: Robinson, Wendy Cc: 'Laura Creighton'; 'python-list@python.org'; l...@openend.se Subject: Re: Puzzled In a message of Thu, 05 Nov 2015 12:48:11 -0800, "Robinson, Wendy" writes: >Well... I still can't get this to work. I guess I'll just uninstall it. >

RE: Puzzled

2015-11-06 Thread Robinson, Wendy
To: Robinson, Wendy Cc: 'python-list@python.org'; l...@openend.se Subject: Re: Puzzled In a message of Fri, 30 Oct 2015 09:20:23 -0700, "Robinson, Wendy" writes: >Hi there, >I installed Python 3.5.0 64-bit for Windows yesterday and tried some basic >programs succe

Re: Puzzled

2015-11-05 Thread Michael Torrie
On 11/05/2015 04:10 PM, Laura Creighton wrote: > In a message of Thu, 05 Nov 2015 12:48:11 -0800, "Robinson, Wendy" writes: >> Well... I still can't get this to work. I guess I'll just uninstall it. >> It's a bummer that there's no help on basic startup like this. >> >> Wendy Robinson >> Audit Anal

Re: Puzzled

2015-11-05 Thread Laura Creighton
In a message of Thu, 05 Nov 2015 12:48:11 -0800, "Robinson, Wendy" writes: >Well... I still can't get this to work. I guess I'll just uninstall it. >It's a bummer that there's no help on basic startup like this. > >Wendy Robinson >Audit Analyst >(916) 566-4994 phone There is enormous amount of hel

Re: Puzzled

2015-11-03 Thread Michiel Overtoom
> On 03 Nov 2015, at 05:46, Michael Torrie wrote: > Sometimes on Windows you can double-click a python file and it will run. The first thing I do on Windows after installing Python: edit the registry so that the 'open' key is changed to 'run', and 'edit with IDLE' becomes 'open'. I like to see

Re: Puzzled

2015-11-02 Thread Michael Torrie
On 11/02/2015 08:52 AM, Robinson, Wendy wrote: > [cid:image001.png@01D11543.5ED11D50] Just FYI this mailing list group is tied with with a system called USENET which is plain text only, so most of us can't see your attachment. This may help you copy the text to your messages in plain text form:

RE: Puzzled

2015-11-02 Thread Robinson, Wendy
intended recipient please immediately delete it and contact the sender. -Original Message- From: Laura Creighton [mailto:l...@openend.se] Sent: Sunday, November 01, 2015 2:21 AM To: Robinson, Wendy Cc: 'python-list@python.org'; l...@openend.se Subject: Re: Puzzled In a mess

Re: Puzzled

2015-11-01 Thread Sibylle Koczian
Am 30.10.2015 um 17:20 schrieb Robinson, Wendy: Hi there, I installed Python 3.5.0 64-bit for Windows yesterday and tried some basic programs successfully. This morning I rebooted my computer and can’t get a single one to work. The interpreter seems to be fine and the environment variables look

Re: Puzzled

2015-11-01 Thread Laura Creighton
In a message of Fri, 30 Oct 2015 09:20:23 -0700, "Robinson, Wendy" writes: >Hi there, >I installed Python 3.5.0 64-bit for Windows yesterday and tried some basic >programs successfully. >This morning I rebooted my computer and can't get a single one to work. The >interpreter seems to be fine and

Re: Puzzled

2015-11-01 Thread Peter Otten
Robinson, Wendy wrote: > Hi there, > I installed Python 3.5.0 64-bit for Windows yesterday and tried some basic > programs successfully. > This morning I rebooted my computer and can't get a single one to work. > The interpreter seems to be fine and the environment variables look > correct. But

Re: puzzled by name binding in local function

2013-02-07 Thread Ulrich Eckhardt
Heureka! Am 06.02.2013 15:37, schrieb Dave Angel: > def myfunc2(i): def myfunc2b(): print ("myfunc2 is using", i) return myfunc2b Earlier you wrote: There is only one instance of i, so it's not clear what you expect. Since it's not an argument to test(), it has to be found

Re: puzzled by name binding in local function

2013-02-06 Thread Dave Angel
On 02/06/2013 05:19 AM, Ulrich Eckhardt wrote: Dave and Terry, Thanks you both for your explanations! I really appreciate the time you took. Am 05.02.2013 19:07, schrieb Dave Angel: The main place where I see this type of problem is in a gui, where you're defining a callback to be used by

Re: puzzled by name binding in local function

2013-02-06 Thread Ulrich Eckhardt
Dave and Terry, Thanks you both for your explanations! I really appreciate the time you took. Am 05.02.2013 19:07, schrieb Dave Angel: If you need to have separate function objects that already know a value for i, you need to somehow bind the value into the function object. One way to do it,

Re: puzzled by name binding in local function

2013-02-05 Thread Terry Reedy
Code examples are Python 3 On 2/5/2013 10:18 AM, Ulrich Eckhardt wrote: Below you will find example code distilled from a set of unit tests, usable with Python 2 or 3. I'm using a loop over a list of parameters to generate tests with different permutations of parameters. Instead of calling util

Re: puzzled by name binding in local function

2013-02-05 Thread Dave Angel
On 02/05/2013 10:18 AM, Ulrich Eckhardt wrote: Hello Pythonistas! Below you will find example code distilled from a set of unit tests, usable with Python 2 or 3. I'm using a loop over a list of parameters to generate tests with different permutations of parameters. Instead of calling util() with

Re: Puzzled by FiPy's use of "=="

2012-03-26 Thread André Roberge
On Monday, 26 March 2012 09:16:07 UTC-3, Robert Kern wrote: > On 3/26/12 12:47 PM, André Roberge wrote: > > In FiPy (a finite volume PDE solver), equations are "magically" set up as > > > > eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D) > > > > and solved via > > > > eqX.solve(...) > > >

Re: Puzzled by FiPy's use of "=="

2012-03-26 Thread Robert Kern
On 3/26/12 12:47 PM, André Roberge wrote: In FiPy (a finite volume PDE solver), equations are "magically" set up as eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D) and solved via eqX.solve(...) How can eqX be anything than True or False?... This must be via a redefinition of "==" bu

Re: Puzzled about the output of my demo of a proof of The Euler Series

2011-08-10 Thread casevh
On Aug 10, 4:57 pm, "Richard D. Moores" wrote: > I saw an interesting proof of the limit of The Euler Series on > math.stackexchange.com at > . > Scroll down to Hans Lundmark's post. > > I thought I'd try to see this "pinchi

Re: Puzzled by list-appending behavior

2011-05-27 Thread Ethan Furman
Prasad, Ramit wrote: I have to say, I do like Python's lack of keywords for these things I thought True/False were among the list of keywords in Python 3.x ? Or are those the only keywords? http://docs.python.org/py3k/reference/lexical_analysis.html#keywords False class finally

RE: Puzzled by list-appending behavior

2011-05-27 Thread Prasad, Ramit
>I have to say, I do like Python's lack of keywords for these things I thought True/False were among the list of keywords in Python 3.x ? Or are those the only keywords? Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone

Re: Puzzled by list-appending behavior

2011-05-27 Thread MRAB
On 27/05/2011 07:34, Tim Roberts wrote: MRAB wrote: I'd just like to point out that it's a convention, not a rigid rule. Reminds me of the catch-phrase from the first Pirates of the Caribbean movie: "It's more of a guideline than a rule." Much like the Zen of Python. -- http://mail.python.

Re: Puzzled by list-appending behavior

2011-05-26 Thread Tim Roberts
MRAB wrote: > >I'd just like to point out that it's a convention, not a rigid rule. Reminds me of the catch-phrase from the first Pirates of the Caribbean movie: "It's more of a guideline than a rule." -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailm

Re: Puzzled by list-appending behavior

2011-05-26 Thread Chris Angelico
On Fri, May 27, 2011 at 1:52 PM, Steven D'Aprano wrote: > Because "lst" is not a real word. To native readers of languages derived > from Latin or Germany, such as English, it is quite a strange "word" > because it has no vowel. In addition, it looks like 1st (first). Contrived examples are alway

Re: Puzzled by list-appending behavior

2011-05-26 Thread Steven D'Aprano
On Fri, 27 May 2011 13:24:24 +1000, Chris Angelico wrote: > On Fri, May 27, 2011 at 11:59 AM, Steven D'Aprano > wrote: >> def get(list, object): >>    """Append object to a copy of list and return it.""" return list + >>    [object] >> >> For one or two line functions, I think that's perfectly re

Re: Puzzled by list-appending behavior

2011-05-26 Thread Chris Angelico
On Fri, May 27, 2011 at 11:59 AM, Steven D'Aprano wrote: > def get(list, object): >    """Append object to a copy of list and return it.""" >    return list + [object] > > For one or two line functions, I think that's perfectly reasonable. > Anything more than that, I'd be getting nervous. But ev

Re: Puzzled by list-appending behavior

2011-05-26 Thread Steven D'Aprano
On Thu, 26 May 2011 11:27:35 -0700, John Ladasky wrote: > On May 25, 9:46 pm, Uncle Ben wrote: > >> list = [1,2,3] > > Somewhat unrelated, but... is it a good idea to name your list "list"? > Isn't that the name of Python's built-in list constructor method? > > Shadowing a built-in has contri

Re: Puzzled by list-appending behavior

2011-05-26 Thread Terry Reedy
On 5/26/2011 11:58 AM, MRAB wrote: On 26/05/2011 06:17, Chris Rebert wrote: list.remove(), list.sort(), and list.extend() similarly return None rather than the now-modified list. I'd just like to point out that it's a convention, not a rigid rule. Sometimes it's not followed, for example, dic

RE: Puzzled by list-appending behavior

2011-05-26 Thread Prasad, Ramit
>> And why do you insist on calling an instance of list, "list"? Even a >> human reader will confuse which is which. What you are showing is an >> example how confusing things become when a keyword (list) is >> over-written (with list instance). > (Minor note: 'list' is not a keyword (if it were,

Re: Puzzled by list-appending behavior

2011-05-26 Thread Terry Reedy
On 5/26/2011 3:18 AM, Algis Kabaila wrote: And why do you insist on calling an instance of list, "list"? Even a human reader will confuse which is which. What you are showing is an example how confusing things become when a keyword (list) is over-written (with list instance). (Minor note: 'lis

Re: Puzzled by list-appending behavior

2011-05-26 Thread John Ladasky
On May 25, 9:46 pm, Uncle Ben wrote: > list = [1,2,3] Somewhat unrelated, but... is it a good idea to name your list "list"? Isn't that the name of Python's built-in list constructor method? Shadowing a built-in has contributed to more than one subtle bug in my code, and I've learned to avoid

Re: Puzzled by list-appending behavior

2011-05-26 Thread Chris Angelico
On Fri, May 27, 2011 at 1:58 AM, MRAB wrote: > I'd just like to point out that it's a convention, not a rigid rule. > Sometimes it's not followed, for example, dict.setdefault. dict.setdefault is more like dict.get but it also stores the result. It's probably more a name issue than a protocol iss

Re: Puzzled by list-appending behavior

2011-05-26 Thread MRAB
On 26/05/2011 06:17, Chris Rebert wrote: On Wed, May 25, 2011 at 9:46 PM, Uncle Ben wrote: In playing with lists of lists, I found the following: (In 3.1, but the same happens also in 2.7) list = [1,2,3] list.append ( [4,5,6] ) Note the lack of output after this line. This indicates that li

Re: Puzzled by list-appending behavior

2011-05-26 Thread Chris Rebert
On Thu, May 26, 2011 at 12:23 AM, Chris Angelico wrote: > On Thu, May 26, 2011 at 5:20 PM, Chris Angelico wrote: >> >> Ben Finney has already answered the main question > > Giving credit where credit's due, it was more Chris Rebert's post that > answered the question. Sorry Chris! Eh, one can't

Re: Puzzled by list-appending behavior

2011-05-26 Thread Uncle Ben
On May 26, 12:46 am, Uncle Ben wrote: > In playing with lists of lists, I found the following: > > (In 3.1, but the same happens also in 2.7) > > list = [1,2,3] > list.append ( [4,5,6] ) > x = list > x   -> >     [1,2,3,[4,5,6]] > as expected. > > But the shortcut fails: > > list=[1,2,3] > x = lis

Re: Puzzled by list-appending behavior

2011-05-26 Thread Chris Angelico
On Thu, May 26, 2011 at 5:20 PM, Chris Angelico wrote: > > Ben Finney has already answered the main question Giving credit where credit's due, it was more Chris Rebert's post that answered the question. Sorry Chris! Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: Puzzled by list-appending behavior

2011-05-26 Thread Chris Angelico
On Thu, May 26, 2011 at 2:46 PM, Uncle Ben wrote: > In playing with lists of lists, I found the following: > > (In 3.1, but the same happens also in 2.7) > > list = [1,2,3] Ben Finney has already answered the main question, but as a side point, I would generally avoid creating a variable called '

Re: Puzzled by list-appending behavior

2011-05-26 Thread Algis Kabaila
On Thursday 26 May 2011 14:46:45 Uncle Ben wrote: > In playing with lists of lists, I found the following: > > (In 3.1, but the same happens also in 2.7) > > list = [1,2,3] > list.append ( [4,5,6] ) > x = list > x -> > [1,2,3,[4,5,6]] > as expected. > > But the shortcut fails: > > list=[1

Re: Puzzled by list-appending behavior

2011-05-25 Thread Chris Rebert
On Wed, May 25, 2011 at 9:46 PM, Uncle Ben wrote: > In playing with lists of lists, I found the following: > > (In 3.1, but the same happens also in 2.7) > > list = [1,2,3] > list.append ( [4,5,6] ) Note the lack of output after this line. This indicates that list.append([4,5,6]) returned None. C

Re: Puzzled by list-appending behavior

2011-05-25 Thread Ben Finney
Uncle Ben writes: > Can someone explain this to me? Yes, the documentation for that function (‘list.append’) can explain it. In short: if a method modifies the instance, that method does not return the instance. This policy holds for the built-in types, and should be followed for user-defined t

Re: Puzzled by code pages

2010-05-15 Thread Martin v. Loewis
> Conclusions: > > It's worth closely scrutinising "accented characters - equivalent to > ISO-8859-2 > (I believe)". Which variety of "OpenStep plist files" are you looking at: > NeXTSTEP, GNUstep, or MAC OS X? If the latter, it's evidently an XML document, > and you should be letting the XML pa

Re: Puzzled by code pages

2010-05-15 Thread John Machin
Adam Tauno Williams whitemice.org> writes: > On Fri, 2010-05-14 at 20:27 -0400, Adam Tauno Williams wrote: > > I'm trying to process OpenStep plist files in Python. I have a parser > > which works, but only for strict ASCII. However plist files may contain > > accented characters - equivalent t

Re: Puzzled by code pages

2010-05-15 Thread Mark Tolonen
"Adam Tauno Williams" wrote in message news:1273932760.3929.18.ca...@linux-yu4c.site... On Sat, 2010-05-15 at 20:30 +1000, Lie Ryan wrote: On 05/15/10 10:27, Adam Tauno Williams wrote: [snip] Yep. But in the interpreter both unicode() and repr() produce the same output. Nothing displays

Re: Puzzled by code pages

2010-05-15 Thread Lie Ryan
On 05/16/10 00:12, Adam Tauno Williams wrote: > On Sat, 2010-05-15 at 20:30 +1000, Lie Ryan wrote: >> On 05/15/10 10:27, Adam Tauno Williams wrote: >>> I'm trying to process OpenStep plist files in Python. I have a parser >>> which works, but only for strict ASCII. However plist files may contain

Re: Puzzled by code pages

2010-05-15 Thread Adam Tauno Williams
On Sat, 2010-05-15 at 20:30 +1000, Lie Ryan wrote: > On 05/15/10 10:27, Adam Tauno Williams wrote: > > I'm trying to process OpenStep plist files in Python. I have a parser > > which works, but only for strict ASCII. However plist files may contain > > accented characters - equivalent to ISO-8859

Re: Puzzled by code pages

2010-05-15 Thread Lie Ryan
On 05/15/10 10:27, Adam Tauno Williams wrote: > I'm trying to process OpenStep plist files in Python. I have a parser > which works, but only for strict ASCII. However plist files may contain > accented characters - equivalent to ISO-8859-2 (I believe). For example > I read in the line: >

Re: Puzzled by code pages

2010-05-14 Thread Kelly
Buy high quality TAG Heuer Tiger Woods Golf Watches at low price, you can not believe, but it is true. There are two models on http://www.luxuryowner.net/Replica-TAG-Heuer-Tiger-Woods-Golf-Watches.html White: Tag Heuer Tiger Woods Golf White Mens Watch WAE1112.FT6008: http://www.luxuryowner.net

Re: Puzzled by code pages

2010-05-14 Thread Adam Tauno Williams
On Fri, 2010-05-14 at 20:27 -0400, Adam Tauno Williams wrote: > I'm trying to process OpenStep plist files in Python. I have a parser > which works, but only for strict ASCII. However plist files may contain > accented characters - equivalent to ISO-8859-2 (I believe). For example > I read in th

Re: Puzzled about this regex

2009-04-17 Thread Chris Rebert
On Fri, Apr 17, 2009 at 7:17 PM, Jean-Claude Neveu wrote: > Hello, > > I wonder if someone could tell me where I am going wrong with my regular > expression, please. My regex only matches the text I'm looking for (a number > followed by a distance unit) when it appears at the beginning of the stri

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Tim Rau
On Jan 25, 5:54 pm, [EMAIL PROTECTED] wrote: > On Jan 25, 5:46 pm, Bjoern Schliessmann > > > [EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > print x.ends,y.ends,z.ends > > > # > > > Running the following code outputs: > > [(0, 2)] [(0, 2)] [(0, 2)] > > > > Can anyone

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread dbaston
On Jan 25, 5:46 pm, Bjoern Schliessmann wrote: > [EMAIL PROTECTED] wrote: > > print x.ends,y.ends,z.ends > > # > > Running the following code outputs: > [(0, 2)] [(0, 2)] [(0, 2)] > > > Can anyone explain this? > > Yes. You bound a single list to the name "ends" inside the class.

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hello, > > I have a class called 'Axis' that I use as a base class for several > types of axes that can be created by a grid generation program that I > have written: equally-spaced grids, logarithmic grids, etc. In any > case, if I use this base class by itself, I se

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Tomek Paczkowski
[EMAIL PROTECTED] wrote: > Hello, > > I have a class called 'Axis' that I use as a base class for several > types of axes that can be created by a grid generation program that I > have written: equally-spaced grids, logarithmic grids, etc. In any > case, if I use this base class by itself, I see

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > print x.ends,y.ends,z.ends > # > Running the following code outputs: [(0, 2)] [(0, 2)] [(0, 2)] > > Can anyone explain this? Yes. You bound a single list to the name "ends" inside the class. This name is shared by all instances. If you want the instanc

Re: puzzled about floats

2007-09-24 Thread Marc 'BlackJack' Rintsch
On Mon, 24 Sep 2007 14:13:18 -0400, Neal Becker wrote: > from math import modf > > class nco (object): > def __init__ (self, delta): > self.delta = delta > self.phase = 0.0 > def __call__ (self): > self.phase += self.delta > f,i = modf (self.phase) >

Re: Puzzled in the coding of Chinese

2007-09-19 Thread Carsten Haese
On Wed, 2007-09-19 at 13:57 +0800, Xing wrote: > Dear list members, > I am a newcomer in the world of Python. But I am attracted by > Python's power in handling text! Now I apply it to handle Chinese but > the Chinese character cann't be displayed on the screen. What > displayed on the screen

Re: Puzzled by "is"

2007-08-12 Thread Dick Moores
At 09:59 AM 8/12/2007, Steve Holden wrote: >Dick Moores wrote: > > At 08:23 AM 8/12/2007, Steve Holden wrote: > >> Dick Moores wrote: > >>> So would a programmer EVER use "is" in a script? > >> Sure. For example, the canonical test for None uses > >> > >> x is None > >> > >> because there is o

Re: Puzzled by "is"

2007-08-12 Thread Steve Holden
Dick Moores wrote: > At 08:23 AM 8/12/2007, Steve Holden wrote: >> Dick Moores wrote: >>> So would a programmer EVER use "is" in a script? >> Sure. For example, the canonical test for None uses >> >> x is None >> >> because there is only ever one instance of type Nonetype, so it's the >> faste

Re: Puzzled by "is"

2007-08-12 Thread Dick Moores
At 08:23 AM 8/12/2007, Steve Holden wrote: >Dick Moores wrote: > > So would a programmer EVER use "is" in a script? > >Sure. For example, the canonical test for None uses > > x is None > >because there is only ever one instance of type Nonetype, so it's the >fastest test. Generally speaking yo

Re: Puzzled by "is"

2007-08-12 Thread Steve Holden
Dick Moores wrote: > On 8/12/07, *Ben Finney* <[EMAIL PROTECTED] > > wrote: > > Dick Moores <[EMAIL PROTECTED] > writes: > > > At 06:13 PM 8/9/2007, Ben Finney wrote: > > >it's entirely left to the language implementation which >

Re: Puzzled by "is"

2007-08-12 Thread Dick Moores
On 8/12/07, Ben Finney <[EMAIL PROTECTED]> wrote: > > Dick Moores <[EMAIL PROTECTED]> writes: > > > At 06:13 PM 8/9/2007, Ben Finney wrote: > > >it's entirely left to the language implementation which > > >optimisation trade-offs to make, and the language user (that's you > > >and I) should *not* e

Re: Puzzled by "is"

2007-08-12 Thread Ben Finney
Dick Moores <[EMAIL PROTECTED]> writes: > At 06:13 PM 8/9/2007, Ben Finney wrote: > >it's entirely left to the language implementation which > >optimisation trade-offs to make, and the language user (that's you > >and I) should *not* expect any particular behaviour to hold between > >different imp

Re: Puzzled by "is"

2007-08-10 Thread Trent Mick
Dick Moores wrote: > At 06:13 PM 8/9/2007, Ben Finney wrote: >> It's important to also realise that the language is *deliberately* >> non-committal on whether any given value will have this behaviour; >> that is, it's entirely left to the language implementation which >> optimisation trade-offs to

Re: Puzzled by "is"

2007-08-10 Thread Marc 'BlackJack' Rintsch
On Fri, 10 Aug 2007 10:57:22 -0700, Dick Moores wrote: > At 06:13 PM 8/9/2007, Ben Finney wrote: >>Others have already said that it's an implementation optimisation, >>which seems to partly answer your question. >> >>It's important to also realise that the language is *deliberately* >>non-committa

Re: Puzzled by "is"

2007-08-10 Thread Dick Moores
At 06:13 PM 8/9/2007, Ben Finney wrote: >Content-Transfer-Encoding: base64Grzegorz >Słodkowicz <[EMAIL PROTECTED] [EMAIL PROTECTED] >theorisation but I'd rather expect the interpreter > > simply not to create a second tuple while there already is an > > identical one. > >Others have already sai

Re: Puzzled by "is"

2007-08-09 Thread Paul Rudin
John K Masters <[EMAIL PROTECTED]> writes: > > OK fiddling around with this and reading the docs I tried:- > a = 'qq' #10 q's > b = 'qq' #10 q's > a is b > true > c = 'q' * 10 > c > 'qq' #10 q's > d = 'q' * 10 > d > 'qq' #10 q's > c is d > false > > So from what I'v

Re: Puzzled by "is"

2007-08-09 Thread Erik Max Francis
Ben Finney wrote: > It's important to also realise that the language is *deliberately* > non-committal on whether any given value will have this behaviour; > that is, it's entirely left to the language implementation which > optimisation trade-offs to make, and the language user (that's you and >

Re: Puzzled by "is"

2007-08-09 Thread Ben Finney
Grzegorz Słodkowicz <[EMAIL PROTECTED]> writes: > That's just theorisation but I'd rather expect the interpreter > simply not to create a second tuple while there already is an > identical one. Others have already said that it's an implementation optimisation, which seems to partly answer your qu

Re: Puzzled by "is"

2007-08-09 Thread Hrvoje Niksic
Grzegorz Słodkowicz <[EMAIL PROTECTED]> writes: >> Seriously, it's just an optimization by the implementers. There is >> no need for more than one empty tuple, since tuples can never be >> modified once created. >> >> But they decided not to create (1, ) in advance. They probably knew >> that hard

Re: Puzzled by "is"

2007-08-09 Thread Steve Holden
Grzegorz Słodkowicz wrote: >> Why? Because. >> >> Seriously, it's just an optimization by the implementers. There is no >> need for more than one empty tuple, since tuples can never be modified >> once created. >> >> But they decided not to create (1, ) in advance. They probably knew that >> har

Re: Puzzled by "is"

2007-08-09 Thread Erik Max Francis
Grzegorz Słodkowicz wrote: > That's just theorisation but I'd rather expect the interpreter simply > not to create a second tuple while there already is an identical one. > This could save some memory if the tuple was large (Although by the same > token comparison of large tuples can be expensi

Re: Puzzled by "is"

2007-08-09 Thread Erik Max Francis
John K Masters wrote: > OK fiddling around with this and reading the docs I tried:- > a = 'qq' #10 q's > b = 'qq' #10 q's > a is b > true > c = 'q' * 10 > c > 'qq' #10 q's > d = 'q' * 10 > d > 'qq' #10 q's > c is d > false > > So from what I've read "==" tests for

Re: Puzzled by "is"

2007-08-09 Thread Grzegorz Słodkowicz
> > Why? Because. > > Seriously, it's just an optimization by the implementers. There is no > need for more than one empty tuple, since tuples can never be modified > once created. > > But they decided not to create (1, ) in advance. They probably knew that > hardly anybody would want to create

Re: Puzzled by "is"

2007-08-09 Thread Steve Holden
[EMAIL PROTECTED] wrote: [...] > > Steve, > > I thought you'd probably weigh in on this esoteric matter. Very > illuminating, as usual. > Thank you! regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb

Re: Puzzled by "is"

2007-08-09 Thread Neil Cerutti
On 2007-08-09, John K Masters <[EMAIL PROTECTED]> wrote: > On 15:53 Thu 09 Aug , Steve Holden wrote: >> Dick Moores wrote: >> > At 10:46 AM 8/9/2007, Bill Scherer wrote: >> >> Dick Moores wrote: >> [...] >> >> There is only one empty tuple. >> >> Does that clear it up for you? >> > >> > But is

Re: Puzzled by "is"

2007-08-09 Thread kyosohma
On Aug 9, 2:53 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Dick Moores wrote: > > At 10:46 AM 8/9/2007, Bill Scherer wrote: > >> Dick Moores wrote: > [...] > >> There is only one empty tuple. > >> Does that clear it up for you? > > > But isn't that the same as saying, "That's just the reality of

Re: Puzzled by "is"

2007-08-09 Thread John K Masters
On 15:53 Thu 09 Aug , Steve Holden wrote: > Dick Moores wrote: > > At 10:46 AM 8/9/2007, Bill Scherer wrote: > >> Dick Moores wrote: > [...] > >> There is only one empty tuple. > >> Does that clear it up for you? > > > > But isn't that the same as saying, "That's just the reality of > > Pytho

Re: Puzzled by "is"

2007-08-09 Thread Steve Holden
Dick Moores wrote: > At 10:46 AM 8/9/2007, Bill Scherer wrote: >> Dick Moores wrote: [...] >> There is only one empty tuple. >> Does that clear it up for you? > > But isn't that the same as saying, "That's just the reality of > Python; it is what it is."? I want to know why there is only one > e

Re: Puzzled by "is"

2007-08-09 Thread Dick Moores
At 10:46 AM 8/9/2007, Bill Scherer wrote: >Dick Moores wrote: > > >>> () is () > > True > > >>> (1,) is (1,) > > False > > > > Why? > > > > >>> a = () > >>> b = () > >>> c = (1,) > >>> d = (1,) > >>> a is b >True > >>> c is d >False > >>> id(a) >3086553132 > >>> id(b) >3086553132 > >>> id(c) >308

Re: Puzzled by "is"

2007-08-09 Thread Jay Loden
Jay Loden wrote: > Dick Moores wrote: >> >>> () is () >> True >> >>> (1,) is (1,) >> False >> >> Why? >> >> Thanks, >> >> Dick Moores > >From the docs for 'is': The operators is and is not test for object identity: x is y is true if and only if x and y are the same object. x is not y yi

Re: Puzzled by "is"

2007-08-09 Thread Neil Cerutti
On 2007-08-09, Dick Moores <[EMAIL PROTECTED]> wrote: > >>> () is () > True > >>> (1,) is (1,) > False > > Why? >From _Python Reference Manual_: 5.2.4 List displays: An empty pair of parentheses yields an empty tuple object. Since tuples are immutable, the rules for literals apply (i.e., tw

Re: Puzzled by "is"

2007-08-09 Thread Bill Scherer
Dick Moores wrote: > >>> () is () > True > >>> (1,) is (1,) > False > > Why? > >>> a = () >>> b = () >>> c = (1,) >>> d = (1,) >>> a is b True >>> c is d False >>> id(a) 3086553132 >>> id(b) 3086553132 >>> id(c) 3086411340 >>> id(d) 3086390892 There is only one empty tuple. Does that clear

Re: Puzzled by "is"

2007-08-09 Thread Jay Loden
Dick Moores wrote: > >>> () is () > True > >>> (1,) is (1,) > False > > Why? > > Thanks, > > Dick Moores >From the docs for 'is': -- http://mail.python.org/mailman/listinfo/python-list

Re: puzzled about class attribute resolution and mangling

2005-12-11 Thread Brian van den Broek
James Stroud said unto the world upon 2005-12-09 20:39: > Brian van den Broek wrote: > >>Hi all, >> >>I've the following code snippet that puzzles me: >> >>class Base(object): >>__v, u = "Base v", "Base u" >>def __init__(self): >>print self.__v, self.u >> >>class Derived(Base): >>

Re: puzzled about class attribute resolution and mangling

2005-12-09 Thread James Stroud
Brian van den Broek wrote: > Hi all, > > I've the following code snippet that puzzles me: > > class Base(object): > __v, u = "Base v", "Base u" > def __init__(self): > print self.__v, self.u > > class Derived(Base): > __v, u = "Derived v", "Derived u" > def __init__(self)

Re: Puzzled

2005-07-12 Thread Colin J. Williams
Bengt Richter wrote: > On Mon, 11 Jul 2005 22:10:33 -0400, "Colin J. Williams" <[EMAIL PROTECTED]> > wrote: > > >>The snippet of code below gives the result which follows >> >>for k in ut.keys(): >> name= k.split('_') >> print '\n1', name >> if len(name) > 1: >>name[0]= name[0] + name[1].

Re: Puzzled

2005-07-11 Thread Bengt Richter
On Mon, 11 Jul 2005 22:10:33 -0400, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: >The snippet of code below gives the result which follows > >for k in ut.keys(): > name= k.split('_') > print '\n1', name > if len(name) > 1: > name[0]= name[0] + name[1].capitalize() > print '2', nam

Re: Puzzled

2005-07-11 Thread Robert Kern
Colin J. Williams wrote: > The snippet of code below gives the result which follows > > for k in ut.keys(): >name= k.split('_') >print '\n1', name >if len(name) > 1: > name[0]= name[0] + name[1].capitalize() > print '2', name >name[0]= name[0].capitalize() >print '3',