Re: Effects of caching frequently used objects, was Re: Explaining names vs variables in Python

2016-03-25 Thread Ethan Furman
On 03/25/2016 06:03 AM, Albert-Jan Roskam wrote: > Somebody wrote: >> Somebody else wrote: I know Python does not have variables, but names. Multiple names cant then be bound to the same objects. So this behavior --> b = 234 --> v = 234 --> b is v True according to the above that is ok

Re: Effects of caching frequently used objects, was Re: Explaining names vs variables in Python

2016-03-25 Thread Chris Angelico
On Sat, Mar 26, 2016 at 12:03 AM, Albert-Jan Roskam wrote: >> You should not bother with object identity for objects other than None. > > > A little late to the party, but: how about Ellipsis? Shouldn't "is" also be > used for that one? (It's rare, I know :)) Yes, and

RE: Effects of caching frequently used objects, was Re: Explaining names vs variables in Python

2016-03-25 Thread Albert-Jan Roskam
> To: python-list@python.org > From: __pete...@web.de > Subject: Effects of caching frequently used objects, was Re: Explaining > names vs variables in Python > Date: Wed, 2 Mar 2016 10:12:48 +0100 > > Salvatore DI DIO wrote: > > > Hello, > > >

Re: Explaining names vs variables in Python

2016-03-03 Thread Ian Kelly
On Thu, Mar 3, 2016 at 10:03 AM, Rustom Mody wrote: > Is it so damn hard to be a bit honest and when asked about is in python to > reply: > > If you dont know what you are doing, dont use 'is' (None excepted) > If you know why are you asking? That seems like a rather

Re: Explaining names vs variables in Python

2016-03-03 Thread Rustom Mody
On Thursday, March 3, 2016 at 7:22:43 AM UTC+5:30, Steven D'Aprano wrote: > On Thu, 3 Mar 2016 05:12 am, Marko Rauhamaa wrote: > > > Steven D'Aprano : > > > >> In this case, "same object" carries the normal English meaning of > >> "same" and the normal computer science meaning of "object" in the

Re: Explaining names vs variables in Python

2016-03-03 Thread Mark Lawrence
On 03/03/2016 02:05, Steven D'Aprano wrote: On Thu, 3 Mar 2016 08:49 am, Mark Lawrence wrote: On 02/03/2016 17:23, Steven D'Aprano wrote: On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: What is missing is the rules that are obeyed by the "is" operator. I think what is actually missing

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 08:49 am, Mark Lawrence wrote: > On 02/03/2016 17:23, Steven D'Aprano wrote: >> On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: >> >>> What is missing is the rules that are obeyed by the "is" operator. >> >> I think what is actually missing is some common bloody sense. The

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 05:12 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> In this case, "same object" carries the normal English meaning of >> "same" and the normal computer science meaning of "object" in the >> sense of "Object Oriented Programming". There's no mystery

Re: Explaining names vs variables in Python

2016-03-02 Thread Rustom Mody
On Thursday, March 3, 2016 at 3:22:42 AM UTC+5:30, Chris Angelico wrote: > On Thu, Mar 3, 2016 at 8:49 AM, Mark Lawrence wrote: > > Are we discussing UK (highly generalised), Geordie, Glaswegian, US, > > Canadian, South African, Australian, New Zealand, or some other form of > > English? > > Is

Re: Explaining names vs variables in Python

2016-03-02 Thread Mark Lawrence
On 02/03/2016 21:52, Chris Angelico wrote: On Thu, Mar 3, 2016 at 8:49 AM, Mark Lawrence wrote: Are we discussing UK (highly generalised), Geordie, Glaswegian, US, Canadian, South African, Australian, New Zealand, or some other form of English? Is there any

Re: Explaining names vs variables in Python

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 8:49 AM, Mark Lawrence wrote: > Are we discussing UK (highly generalised), Geordie, Glaswegian, US, > Canadian, South African, Australian, New Zealand, or some other form of > English? Is there any disagreement among them about the word "same"?

Re: Explaining names vs variables in Python

2016-03-02 Thread Mark Lawrence
On 02/03/2016 17:23, Steven D'Aprano wrote: On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: What is missing is the rules that are obeyed by the "is" operator. I think what is actually missing is some common bloody sense. The Python docs are written in English, and don't define *hundreds*,

Re: Explaining names vs variables in Python

2016-03-02 Thread Marko Rauhamaa
Steven D'Aprano : > In this case, "same object" carries the normal English meaning of > "same" and the normal computer science meaning of "object" in the > sense of "Object Oriented Programming". There's no mystery here, no > circular definition. I see three possible ways of

Re: Explaining names vs variables in Python

2016-03-02 Thread Ben Finney
Salvatore DI DIO writes: > I know Python does not have variables, but names. In addition to the other food answers in this thread, you will want to watch Ned Batchelder's presentation on “Facts and myths about Python

Re: Explaining names vs variables in Python

2016-03-02 Thread Rustom Mody
On Wednesday, March 2, 2016 at 10:53:40 PM UTC+5:30, Steven D'Aprano wrote: > On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: > > > What is missing is the rules that are obeyed by the "is" operator. > > I think what is actually missing is some common bloody sense. The Python > docs are

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: > What is missing is the rules that are obeyed by the "is" operator. I think what is actually missing is some common bloody sense. The Python docs are written in English, and don't define *hundreds*, possible *thousands* of words because they

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 12:48 am, Chris Angelico wrote: > On Thu, Mar 3, 2016 at 12:39 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> Python defines that every object has an identity, which can be >>> represented as an integer. Since this is an intrinsic part

Re: Explaining names vs variables in Python

2016-03-02 Thread Jussi Piitulainen
Ian Kelly writes: > On Wed, Mar 2, 2016 at 2:35 AM, Jussi Piitulainen wrote: >> The following are too delicate for me. I suppose the answers could have >> been different, but I can't guess what mechanism actually leads to these >> results. Just idle curiosity on my part. >> > 890 is 890 >>

Re: Explaining names vs variables in Python

2016-03-02 Thread Ian Kelly
On Wed, Mar 2, 2016 at 2:35 AM, Jussi Piitulainen wrote: > The following are too delicate for me. I suppose the answers could have > been different, but I can't guess what mechanism actually leads to these > results. Just idle curiosity on my part. > 890 is 890

Re: Explaining names vs variables in Python

2016-03-02 Thread Rustom Mody
On Wednesday, March 2, 2016 at 7:42:09 PM UTC+5:30, Marko Rauhamaa wrote: > Chris Angelico : > > > On Thu, Mar 3, 2016 at 12:39 AM, Marko Rauhamaa wrote: > >> Chris Angelico : > >> > >>> Python defines that every object has an identity, which can be > >>> represented as an integer. Since this is

Re: Explaining names vs variables in Python

2016-03-02 Thread Marko Rauhamaa
Chris Angelico : > On Thu, Mar 3, 2016 at 12:39 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> Python defines that every object has an identity, which can be >>> represented as an integer. Since this is an intrinsic part of the >>>

Re: Explaining names vs variables in Python

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 12:39 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Python defines that every object has an identity, which can be >> represented as an integer. Since this is an intrinsic part of the >> object, no two distinct objects can truly have

Re: Explaining names vs variables in Python

2016-03-02 Thread Marko Rauhamaa
Chris Angelico : > Python defines that every object has an identity, which can be > represented as an integer. Since this is an intrinsic part of the > object, no two distinct objects can truly have identical > characteristics. Python's objects are like rifles - there are many >

Re: Explaining names vs variables in Python

2016-03-02 Thread Jussi Piitulainen
Chris Angelico writes: > Python defines that every object has an identity, which can be > represented as an integer. Since this is an intrinsic part of the > object, no two distinct objects can truly have identical > characteristics. Python's objects are like rifles - there are

Re: Explaining names vs variables in Python

2016-03-02 Thread Chris Angelico
On Wed, Mar 2, 2016 at 11:34 PM, Marko Rauhamaa wrote: > The ontological question is, can two *distinct* objects with *identical* > characteristics exist? > > The fermionic answer is, no. > > The bosonic answer is, sure. > > Set theory has fermionic ontology (it's called

Re: Explaining names vs variables in Python

2016-03-02 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 2 Mar 2016 08:03 pm, Jesper K Brogaard wrote: > >> As I understand it, when you use 'is', you are comparing addresses to >> objects, not the values contained in the objects. Use '==' instead. > > You should not think about addresses, because the

Re: Explaining names vs variables in Python

2016-03-02 Thread Salvatore DI DIO
Thank you very much ast and all of you. I better understant now Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: Explaining names vs variables in Python

2016-03-02 Thread ast
"Salvatore DI DIO" a écrit dans le message de news:a894d5ed-d906-4ff7-a537-32bf0187e...@googlegroups.com... It is a little difficult to explain this behavior to a newcommer in Python Can someone give me the right argument to expose ? It is explained with many

Explaining names vs variables in Python (follow)

2016-03-02 Thread Salvatore DI DIO
Thank you very much all of you. I better understand now Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Wed, 2 Mar 2016 08:03 pm, Jesper K Brogaard wrote: > As I understand it, when you use 'is', you are comparing addresses to > objects, not the values contained in the objects. Use '==' instead. You should not think about addresses, because the location of objects is not part of the language.

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Wed, 2 Mar 2016 07:32 pm, Salvatore DI DIO wrote: > Hello, > > I know Python does not have variables, but names. > Multiple names cant then be bound to the same objects. Multiple names CAN be bound to the same object: py> x = y = [] py> x is y True py> z = x py> y.append("Hello world!") py>

Re: Explaining names vs variables in Python

2016-03-02 Thread Jussi Piitulainen
Salvatore DI DIO writes: [- -] > But where is the consistency ? if I try : > v = 890 w = 890 v is w > False I think it goes as follows. Python keeps a cached pool of some numbers that may occur relatively often. When a numerical expression evaluates to a cached value, it returns

Effects of caching frequently used objects, was Re: Explaining names vs variables in Python

2016-03-02 Thread Peter Otten
Salvatore DI DIO wrote: > Hello, > > I know Python does not have variables, but names. > Multiple names cant then be bound to the same objects. > > So this behavior > b = 234 v = 234 b is v > True > > according to the above that is ok > > > > But where is the consistency ?

Re: Explaining names vs variables in Python

2016-03-02 Thread Antoon Pardon
On 02/03/2016 09:32, Salvatore DI DIO wrote: > Hello, > > I know Python does not have variables, but names. > Multiple names cant then be bound to the same objects. > > So this behavior Python has variables. They are just not the kind of variables you find in C and variations but more like

Re: Explaining names vs variables in Python

2016-03-02 Thread Jesper K Brogaard
Den 02-03-2016 kl. 09:32 skrev Salvatore DI DIO: Hello, I know Python does not have variables, but names. Multiple names cant then be bound to the same objects. So this behavior b = 234 v = 234 b is v True according to the above that is ok But where is the consistency ? if I try : v =

Explaining names vs variables in Python

2016-03-02 Thread Salvatore DI DIO
Hello, I know Python does not have variables, but names. Multiple names cant then be bound to the same objects. So this behavior >>> b = 234 >>> v = 234 >>> b is v True according to the above that is ok But where is the consistency ? if I try : >>> v = 890 >>> w = 890 >>> v is w False It