Terry Reedy wrote:
Hendrik van Rooyen wrote:
"S Arrowsmith" wrote:
"Small" integers get a similar treatment:
a = 256
b = 256
a is b
True
a = 257
b = 257
a is b
False
This is weird - I would have thought that the limit
of "small" would be at 255 - the biggest number to fit in a byte. 2
Hendrik van Rooyen wrote:
"S Arrowsmith" wrote:
"Small" integers get a similar treatment:
a = 256
b = 256
a is b
True
a = 257
b = 257
a is b
False
This is weird - I would have thought that the limit
of "small" would be at 255 - the biggest number to
fit in a byte. 256 takes two bytes,
Avetis KAZARIAN a écrit :
> Well, it's not about curiosity, it's more about performance.
Steve Holden wrote:
(snip)
So, don't try to translate concepts from one language to another.
I'll try ;]
Also and FWIW:
1/ Python has some very handy tools when it comes to perfs - like a
couple pr
Hendrik van Rooyen a écrit :
"S Arrowsmith" wrote:
"Small" integers get a similar treatment:
a = 256
b = 256
a is b
True
a = 257
b = 257
a is b
False
This is weird - I would have thought that the limit
of "small" would be at 255 - the biggest number to
fit in a byte. 256 takes two byt
"S Arrowsmith" wrote:
> "Small" integers get a similar treatment:
>
> >>> a = 256
> >>> b = 256
> >>> a is b
> True
> >>> a = 257
> >>> b = 257
> >>> a is b
> False
This is weird - I would have thought that the limit
of "small" would be at 255 - the biggest number to
fit in a byte. 256 takes
Avetis KAZARIAN wrote:
>It seems that any strict ASCII alpha-numeric string is instantiated as
>an unique object, like a "singleton" ( a =3D "x" and b =3D "x" =3D> a is b =
>)
>and that any non strict ASCII alpha-numeric string is instantiated as
>a new object every time with a new id.
What no-o
Steve Holden wrote:
> Does PHP really keep only one copy of every string?
Not at all.
I might have said something confusing if you understood that...
> So, don't try to translate concepts from one language to another.
>
> --
> Gabriel Genellina
I'll try ;]
--
http://mail.python.org/mailman/lis
En Wed, 04 Mar 2009 07:07:44 -0200, Avetis KAZARIAN
escribió:
Gary Herron wrote:
The question now is: Why do you care? The properties of strings do
not depend on the implementation's choice, so you shouldn't care because
of programming considerations. Perhaps it's just a matter of curios
Avetis KAZARIAN wrote:
> Gary Herron wrote:
>> The question now is: Why do you care? The properties of strings do
>> not depend on the implementation's choice, so you shouldn't care because
>> of programming considerations. Perhaps it's just a matter of curiosity
>> on your part.
>>
>> Gary Her
Avetis KAZARIAN wrote:
> Gary Herron wrote:
>> The question now is: Why do you care? The properties of strings do
>> not depend on the implementation's choice, so you shouldn't care because
>> of programming considerations. Perhaps it's just a matter of curiosity
>> on your part.
>>
>> Gary He
Everything's clear now.
Thanks all (especially Christian and Tino) :]
--
http://mail.python.org/mailman/listinfo/python-list
Avetis KAZARIAN schrieb:
> Gary Herron wrote:
>> The question now is: Why do you care? The properties of strings do
>> not depend on the implementation's choice, so you shouldn't care because
>> of programming considerations. Perhaps it's just a matter of curiosity
>> on your part.
>>
>> Gary H
Avetis KAZARIAN wrote:
Gary Herron wrote:
The question now is: Why do you care? The properties of strings do
not depend on the implementation's choice, so you shouldn't care because
of programming considerations. Perhaps it's just a matter of curiosity
on your part.
Gary Herron
Well, it's
Gary Herron wrote:
> The question now is: Why do you care? The properties of strings do
> not depend on the implementation's choice, so you shouldn't care because
> of programming considerations. Perhaps it's just a matter of curiosity
> on your part.
>
> Gary Herron
Well, it's not about curio
Avetis KAZARIAN wrote:
After reading the discussion about the same subject ( From: "Thomas
Moore" Date: Tue, 1 Nov 2005 21:45:56
+0800 ), I tried myself some tests with some confusing results (I'm a
beginner with Python, I'm coming from PHP)
For immutable objects, identity is essentially irrel
Avetis KAZARIAN wrote:
After reading the discussion about the same subject ( From: "Thomas
Moore" Date: Tue, 1 Nov 2005 21:45:56
+0800 ), I tried myself some tests with some confusing results (I'm a
beginner with Python, I'm coming from PHP)
# 1. Short alpha-numeric String without space
a =
After reading the discussion about the same subject ( From: "Thomas
Moore" Date: Tue, 1 Nov 2005 21:45:56
+0800 ), I tried myself some tests with some confusing results (I'm a
beginner with Python, I'm coming from PHP)
# 1. Short alpha-numeric String without space
a = "b747"
b = "b747"
>>> a
"Richard Brodie" <[EMAIL PROTECTED]> wrote:
>
>"Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>
>> On the other hand, I can't imagine any reason why you would want to
>> define such a class,
>
>PEP 754?
My congratulations on a very subtle and somewhat multicultural joke...
Hi:
> Were you planning to write code that relied on id(x) being different
> for different but identical strings x or do you just try to understand
> what's going on?
>
Just try to understand what's going on.
Thanks All.
--
http://mail.python.org/mailman/listinfo/python-list
"Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> On the other hand, I can't imagine any reason why you would want to
> define such a class,
PEP 754?
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth <[EMAIL PROTECTED]> wrote:
> If 'a!=b' then it will also be the case that 'a is not b'
That's true for strings, and (as far as I know), all pre-defined
types, but it's certainly possible to define a class which violates
that.
class isButNotEqual:
def __ne__ (self, other):
Thomas Moore wrote:
a="test"
b="test"
a is b
>
> True
>
> About identity, I think a is not b, but "a is b" returns True.
> Does that mean equality and identity is the same thing for strings?
Not exactly:
>>> a="this is also a string"
>>> b="this is also a string"
>>> a is b
False
I
Thomas Moore wrote:
> I am confused at string identity test:
>
> Does that mean equality and identity is the same thing for strings?
>
Definitely not. What is actually happening is that certain string literals
get folded together at compile time to refer to the same string consta
Thomas Moore wrote:
> I am confused at string identity test:
>
> Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> a
Thomas Moore wrote:
> I am confused at string identity test:
>>>>a="test"
>>>>b="test"
>>>>a is b
>
> True
> About identity, I think a is not b, but "a is b" returns True.
> Does that mean equality and identity i
Hi:
I am confused at string identity test:
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a="test"
>>> b="test"
26 matches
Mail list logo