Hendrik van Rooyen a écrit :
S Arrowsmith si...intbox.UUCP 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
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
Hendrik van Rooyen wrote:
S Arrowsmith si...intbox.UUCP 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
Terry Reedy wrote:
Hendrik van Rooyen wrote:
S Arrowsmith si...intbox.UUCP 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
Avetis KAZARIAN wrote:
After reading the discussion about the same subject ( From: Thomas
Moore jsfrank.c...@msa.hinet.net 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,
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 curiosity,
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,
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 Herron
Everything's clear now.
Thanks all (especially Christian and Tino) :]
--
http://mail.python.org/mailman/listinfo/python-list
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
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,
En Wed, 04 Mar 2009 07:07:44 -0200, Avetis KAZARIAN aveti...@gmail.com
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
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 ;]
--
Avetis KAZARIAN aveti...@gmail.com 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.
S Arrowsmith si...intbox.UUCP 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, so it
After reading the discussion about the same subject ( From: Thomas
Moore jsfrank.c...@msa.hinet.net 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 =
Avetis KAZARIAN wrote:
After reading the discussion about the same subject ( From: Thomas
Moore jsfrank.c...@msa.hinet.net 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
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
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...
--
- Tim
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
a is b
True
About identity, I think a is not b, but a is b returns True.
Does that mean
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 is the same thing for strings?
Nope:
a = 'te' + 'st'
b = 'test'
a is b
False
You're seeing
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=test
b=test
a is b
True
About identity, I think a is not b, but a is b returns
Thomas Moore wrote:
I am confused at string identity test:
snip
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 constant,
but you
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
It's the same with integers. Small
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):
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
26 matches
Mail list logo