Re: Python in endless loop

2018-09-17 Thread Bob Gailer
On Sep 17, 2018 9:31 AM, "YnIk" wrote: > > Dear Python, > Hello. This is an email concerning about my Python program(3.7.0). It keeps printing out stuff that’s too fast to read. If I try to write code, it just keeps on going. I have tried Ctrl+C, but even that’s not working. I searched through all

Re: Python in endless loop

2018-09-17 Thread Peter Otten
YnIk wrote: > Dear Python, > Hello. This is an email concerning about my Python program(3.7.0). It > keeps printing out stuff that’s too fast to read. If I try to write code, > it just keeps on going. I have tried Ctrl+C, but even that’s not working. > I searched through all my flies and can’t fin

Python in endless loop

2018-09-17 Thread YnIk
Dear Python, Hello. This is an email concerning about my Python program(3.7.0). It keeps printing out stuff that’s too fast to read. If I try to write code, it just keeps on going. I have tried Ctrl+C, but even that’s not working. I searched through all my flies and can’t find one error that wou

Re: An endless loop

2017-10-16 Thread bartc
On 16/10/2017 18:53, Stefan Ram wrote: Ian Kelly writes: I honestly can't remember the last time I programmed an endless loop, and I also can't remember the last time I used a while loop. Those two things are probably related. My Python installation has a "Lib" direct

Re: An endless loop

2017-10-16 Thread Ian Kelly
On Sat, Oct 14, 2017 at 8:10 PM, Stefan Ram wrote: > I made an error I made a thousand times before. > > I had programmed an endless loop. > > But never did I see before so clear why it's called > an endless loop. (Tested in IDLE.) > > from turtle import

Re: An endless loop

2017-10-15 Thread Steve D'Aprano
On Mon, 16 Oct 2017 01:38 am, Ned Batchelder wrote: > We've covered this before.  A challenge for the group: let's not create > yet another 100-reply thread rehashing the design of Python looping... > Please? :) Certainly! So... who thinks that Python should implement tail recursion optimization

Re: An endless loop

2017-10-15 Thread Ned Batchelder
On 10/15/17 9:59 AM, bartc wrote: On 15/10/2017 12:20, Chris Angelico wrote: On Sun, Oct 15, 2017 at 9:15 PM, bartc wrote: I assume you're talking about the while-loop (because on my machine, it hangs just using 'from turtle...' or 'import turtle'). (Machine was screwed up I think, as I ha

Re: An endless loop

2017-10-15 Thread bartc
On 15/10/2017 12:20, Chris Angelico wrote: On Sun, Oct 15, 2017 at 9:15 PM, bartc wrote: I assume you're talking about the while-loop (because on my machine, it hangs just using 'from turtle...' or 'import turtle'). (Machine was screwed up I think, as I had to restart it shortly after for

Re: An endless loop

2017-10-15 Thread Chris Angelico
On Sun, Oct 15, 2017 at 9:15 PM, bartc wrote: > On 15/10/2017 03:10, Stefan Ram wrote: >> >>I made an error I made a thousand times before. >> >>I had programmed an endless loop. >> >>But never did I see before so clear why it's c

Re: An endless loop

2017-10-15 Thread Peter J. Holzer
On 2017-10-15 10:15, bartc wrote: > On 15/10/2017 03:10, Stefan Ram wrote: >>I made an error I made a thousand times before. >> >> I had programmed an endless loop. >> >>But never did I see before so clear why it's called >>an endles

Re: An endless loop

2017-10-15 Thread bartc
On 15/10/2017 03:10, Stefan Ram wrote: I made an error I made a thousand times before. I had programmed an endless loop. But never did I see before so clear why it's called an endless loop. (Tested in IDLE.) from turtle import * reset(); reset(); shape( 'turtle'

Re: An endless loop

2017-10-14 Thread Steve D'Aprano
On Sun, 15 Oct 2017 01:43 pm, Dennis Lee Bieber wrote: > On 15 Oct 2017 02:10:15 GMT, r...@zedat.fu-berlin.de (Stefan Ram) declaimed > the following: [...] >>def poly( n, length ): >>i = 0 >>while i < n: >>forward( length ) >>left( 360/n ) >> > > A clear example of why a p

Re: Endless loop

2010-01-02 Thread vsoler
. what I get is     S p a m     which seems logical to me since the > > loop stops after the 4th character. > > I think you're mistaking the cause and effect here, see below. > > > class stepper: > >     def __getitem__(self, i): > >         return i > >

Re: Endless loop

2010-01-02 Thread Ulrich Eckhardt
ps after the 4th character. I think you're mistaking the cause and effect here, see below. > class stepper: > def __getitem__(self, i): > return i > > X=stepper() > X.data="Spam" > for item in X: > print item, > > ... what I get is an endles

Re: Endless loop

2010-01-02 Thread alexru
On Jan 2, 3:50 pm, vsoler wrote: > My question is: why does this second script not stop after printing > number 3?  what made the first one stop while the second one will not? First one will raise IndexError when string is over, second one won't. -- http://mail.python.org/mailman/listinfo/pytho

Endless loop

2010-01-02 Thread vsoler
p a m which seems logical to me since the loop stops after the 4th character. However if I run class stepper: def __getitem__(self, i): return i X=stepper() X.data="Spam" for item in X: print item, ... what I get is an endless loop, starting at zero:0 1 2 3 4 5

Re: Fill memeory with endless loop?

2008-05-14 Thread Grant Edwards
On 2008-05-14, Tim Roberts <[EMAIL PROTECTED]> wrote: > globalrev <[EMAIL PROTECTED]> wrote: > >>and when the program gets killed because out of memory all this >>will be deleted from the memory? > > Yes. When a process is killed, all of the memory it was using > is released. > >>so there is no wa

Re: Fill memeory with endless loop?

2008-05-14 Thread Bruno Desthuilliers
Tim Roberts a écrit : globalrev <[EMAIL PROTECTED]> wrote: and when the program get skiled because out of memory all this will be deleted from the memory? Yes. When a process is killed, all of the memory it was using is released. so there is no way that you can, by accident, fill your whole

Re: Fill memeory with endless loop?

2008-05-13 Thread Tim Roberts
globalrev <[EMAIL PROTECTED]> wrote: > >and when the program get skiled because out of memory all this will be >deleted from the memory? Yes. When a process is killed, all of the memory it was using is released. >so there is no way that you can, by accident, fill your whole >harddrive and make i

Re: Fill memeory with endless loop?

2008-05-13 Thread Gabriel Genellina
En Tue, 13 May 2008 15:18:31 -0300, globalrev <[EMAIL PROTECTED]> escribió: On 13 Maj, 18:59, Filip Štědronský <[EMAIL PROTECTED]> wrote: On Út, kvě 13, 2008 at 06:49:33 +0200, globalrev wrote: > if i do something like > while 1: > print "x" > will the program ever stop because it runs ou

Re: Fill memeory with endless loop?

2008-05-13 Thread globalrev
On 13 Maj, 18:59, Filip Štědronský <[EMAIL PROTECTED]> wrote: > On Út, kvě 13, 2008 at 06:49:33 +0200, globalrev wrote: > > > if i do something like > > while 1: > > print "x" > > > will the program ever stop because it runs out of memory? > > No, there is no reason to run out of memory. This w

Re: Fill memeory with endless loop?

2008-05-13 Thread Mensanator
On May 13, 11:59 am, Filip Štědronský <[EMAIL PROTECTED]> wrote: > On Út, kvě 13, 2008 at 06:49:33 +0200, globalrev wrote: > > > if i do something like > > while 1: > >     print "x" > > > will the program ever stop because it runs out of memory? > > No, there is no reason to run out of memory. Thi

Re: Fill memeory with endless loop?

2008-05-13 Thread Filip Štědronský
On Út, kvě 13, 2008 at 06:49:33 +0200, globalrev wrote: > if i do something like > while 1: > print "x" > > will the program ever stop because it runs out of memory? No, there is no reason to run out of memory. This will simply make an everlasting x-printer and there is no need to store anyth

Fill memeory with endless loop?

2008-05-13 Thread globalrev
if i do something like while 1: print "x" will the program ever stop because it runs out of memory? or is the print x never stored somewhere? if u do soemhting like add element to a list it has an upper nbr of elements right? if though huge... does windows or any other OS have some proces that

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Tim Peters
[Claudio Grondi] >> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 - IDLE 1.1.2 >> >>> a=[] >> >>> a.append(a) >> >>> b=[] >> >>> b.append(b) >> >>> a==b >> >> Traceback (most recent call last): >>File "", line 1, in -toplevel- >> a==b >> RuntimeError:

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Steven D'Aprano
On Sat, 21 Jan 2006 01:12:28 +0100, Claudio Grondi wrote: > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on > win32 - IDLE 1.1.2 > >>> a=[] > >>> a.append(a) > >>> b=[] > >>> b.append(b) > >>> a==b > > Traceback (most recent call last): >File "", line 1, in -top

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Claudio Grondi
simple >> if a==b: print 'a==b' >>statement results in an endless loop. > > > Why would you want to? > > >>To my knowledge this is not possible to achieve in C, but is probably >>achievable in Python. > > > I doubt it. > > The closes

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Steven D'Aprano
ent results in an endless loop. Why would you want to? > To my knowledge this is not possible to achieve in C, but is probably > achievable in Python. I doubt it. The closest I can think of is something like this: a = [] a.append(a) b = [] b.append(b) a == b which I'm told us

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Claudio Grondi
Magnus Lycka wrote: > Claudio Grondi wrote: > >> You seem here to try to give a definition of the term 'value' for >> Python. If I understand it right, the definition of the term can't be >> generally given for many reasons. It depends at least on type and in >> advanced usage it can be arbitra

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Magnus Lycka
Claudio Grondi wrote: > You seem here to try to give a definition of the term 'value' for > Python. If I understand it right, the definition of the term can't be > generally given for many reasons. It depends at least on type and in > advanced usage it can be arbitrary defined or changed. > That

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Grant Edwards
On 2006-01-19, Terry Hancock <[EMAIL PROTECTED]> wrote: >>> given that it's trivial to create fork bombs and memory >>> monsters in all those languages, I think you might need >>> to define the term "real OS". >>> >>> (or do you run all your programs in a virtual sandbox ?) >> >> I guess I never

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Steve Holden
Claudio Grondi wrote: > Dennis Lee Bieber wrote: > >>On Thu, 19 Jan 2006 17:25:38 +0100, Claudio Grondi >><[EMAIL PROTECTED]> declaimed the following in comp.lang.python: >> >> >> >>>Any hints towards enlightenment what this from the geometry known term >>>'ellipsis' mean in Python? Googling show

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Terry Hancock
On Thu, 19 Jan 2006 19:30:18 +0100 Claudio Grondi <[EMAIL PROTECTED]> wrote: > Dennis Lee Bieber wrote: > > On Thu, 19 Jan 2006 17:25:38 +0100, Claudio Grondi > > <[EMAIL PROTECTED]> declaimed the following in > > comp.lang.python: > As shown just above in this thread the code: > >>> a = [1] >

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Terry Hancock
On Thu, 19 Jan 2006 17:42:40 - Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2006-01-19, Fredrik Lundh <[EMAIL PROTECTED]> > wrote: > > >> > It is precisely this power that makes C such a > >dangerous > > language to program in -- it's what makes > >it so easy to crash > > your program, any o

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Claudio Grondi <[EMAIL PROTECTED]> wrote: > Donn Cave wrote: ... > > exactly, "value". The realization you just had, that is so valid, > > is that it is futile to talk about value, per se. Changing the > > word you use will do nothing to improve this. > That's ri

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > Claudio Grondi <[EMAIL PROTECTED]> wrote: > > >>You seem here to try to give a definition of the term 'value' for >>Python. If I understand it right, the definition of the term can't be >>generally given for many reasons. It depends at l

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
Dennis Lee Bieber wrote: > On Thu, 19 Jan 2006 17:25:38 +0100, Claudio Grondi > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >>Any hints towards enlightenment what this from the geometry known term >>'ellipsis' mean in Python? Googling shows, that I am not the first who

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Grant Edwards
On 2006-01-19, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >> > It is precisely this power that makes C such a dangerous >> > language to program in -- it's what makes it so easy to crash >> > your program, any other program running on the same machine, >> >> Nonsense. Under Windows 3.0 that may be

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Fredrik Lundh
Grant Edwards wrote: > > It is precisely this power that makes C such a dangerous > > language to program in -- it's what makes it so easy to crash > > your program, any other program running on the same machine, > > Nonsense. Under Windows 3.0 that may be true, but on any real > OS, you can't "c

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Christopher Subich
Claudio Grondi wrote: > The Python tutorial '3.2 The standard type hierarchy' says: > """ > Ellipsis: This type has a single value. There is a single object with > this value. This object is accessed through the built-in name Ellipsis. > It is used to indicate the presence of the "..." syntax i

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Grant Edwards
On 2006-01-19, Terry Hancock <[EMAIL PROTECTED]> wrote: > It is precisely this power that makes C such a dangerous > language to program in -- it's what makes it so easy to crash > your program, any other program running on the same machine, Nonsense. Under Windows 3.0 that may be true, but on a

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Claudio Grondi <[EMAIL PROTECTED]> wrote: ... > You seem here to try to give a definition of the term 'value' for > Python. If I understand it right, the definition of the term can't be > generally given for many reasons. It depends at least on type and in > adva

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Terry Hancock
On Thu, 19 Jan 2006 14:22:34 +0100 Claudio Grondi <[EMAIL PROTECTED]> wrote: > this is still _not_ what I am looking for, because Python > detects here the problem and throws an exception. What I > am looking for is an endless loop where there is no any > response from Python a

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Terry Hancock
On Wed, 18 Jan 2006 17:10:09 +0100 Claudio Grondi <[EMAIL PROTECTED]> wrote: > or when the objects being members of the list redefine > __eq__ so, that no matter how different they are, the > lists always compare True. If those objects have redefined __eq__ so that they are all equal in value to

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
Steve Holden wrote: > Claudio Grondi wrote: > >> Steven D'Aprano wrote: > > [...] > The higher level of abstraction/indirection in Python results in making the concepts of 'value', 'having a value' or 'comparing values' useless, where it helps in C to express the difference

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Terry Hancock
On Thu, 19 Jan 2006 10:25:12 +0100 Claudio Grondi <[EMAIL PROTECTED]> wrote: > From the one side I am glad that Python cares about > memory allocation > for me, but on the other side I have trouble to accept, > that I have no direct access to the memory area where > data are stored in order to

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Dave Hansen
On Thu, 19 Jan 2006 08:06:50 +0100 in comp.lang.python, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Dave Hansen wrote: > [EMAIL PROTECTED] wrote] >> >Fuzzyman wrote: [...] >> >> In this case : >> >> >> >> a = ['some string'] >> >> b = ['somestring'] >> >> a == b >> >> False (probably) >> >That d

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
t True, the Python engine is definitely broken. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> Why are you comparing C behaviour to Python behaviour? What is the >>>>> point of the discussion? >>>

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
Fuzzyman wrote: > (If I understand correctly...) > > The reason he is looking for it, is in order to assert that Python > 'comparison' is broken. a bit this way, but why formulate it with such a negative touch? Lets understand it more as looking for a way to get a deep understanding of the concep

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Fuzzyman
append() goes not that far to try to > generate the actual list (getting trapped in the endless loop) and only > lets the second list element point to the object with the list itself. I think you've got this. a = [] Here a is a reference to a list object. a.append(a) As mentioend

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Steve Holden
t;>>>Why are you comparing C behaviour to Python behaviour? What is the >>>>point of the discussion? >>> >>> >>> >>>The point is to find a way to create in Python two indentifiers a and >>>b without manipulating any of the __eq__ and to __

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
rint "True" >>>> _does not_ print True, the Python engine is definitely broken. >>> >>> >>> >>> >>> Why are you comparing C behaviour to Python behaviour? What is the >>> point of the discussion? >> >> >&g

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Fuzzyman
(If I understand correctly...) The reason he is looking for it, is in order to assert that Python 'comparison' is broken. Part of this is because of his assertation that the term 'value' has no meaning in Python. He bases this on the fact that Java and C define 'value' to mean the pointer when t

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Steve Holden
Claudio Grondi wrote: > Steven D'Aprano wrote: [...] >>>The higher level of abstraction/indirection in Python results in making >>>the concepts of 'value', 'having a value' or 'comparing values' useless, >>>where it helps in C to express the difference between address and >>>content at that address

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Steve Holden
en. >> >> >> >>Why are you comparing C behaviour to Python behaviour? What is the point >>of the discussion? > > > The point is to find a way to create in Python two indentifiers a and b > without manipulating any of the __eq__ and to __eq__ rel

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
Steven D'Aprano wrote: > On Wed, 18 Jan 2006 15:29:24 +0100, Claudio Grondi wrote: > > >>The problem here is, that I mean, that in Python it makes no sense to >>talk about a value of an object, because it leads to weird things when >>trying to give a definition what a value of an object is. >

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
thon behaviour? What is the point > of the discussion? The point is to find a way to create in Python two indentifiers a and b without manipulating any of the __eq__ and to __eq__ related functions in a way, that the simple if a==b: print 'a==b' statement results in an endl

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Steven D'Aprano
Claudio Grondi wrote: > Exactly this is what Python does under the hood when writing > a = "some string" > b = "some string" > where a and b are actually, in terms of C, pointer to Python object data > structures which provide strings as arrays where it is possible to say > a[0], but ... if here

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Claudio Grondi
Fredrik Lundh wrote: > Dave Hansen wrote: > > >>>Fuzzyman wrote: >>> I'm not familiar with the C basic datatypes - I assume it has an array or list like object. Would it contain a sequence of poitners to the members ? In which case they would only be equal if the pointers are

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fredrik Lundh
Dave Hansen wrote: > >Fuzzyman wrote: > >> I'm not familiar with the C basic datatypes - I assume it has an array > >> or list like object. > >> > >> Would it contain a sequence of poitners to the members ? In which case > >> they would only be equal if the pointers are the same. > >> > >> In this

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Claudio Grondi <[EMAIL PROTECTED]> wrote: ... > It is probably true, that it doesn't much matter when writing Python > code when one do not understand how Python works internally. The rare > practical cases of getting into trouble because of lack of such > unders

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Steven D'Aprano
On Wed, 18 Jan 2006 15:29:24 +0100, Claudio Grondi wrote: > The problem here is, that I mean, that in Python it makes no sense to > talk about a value of an object, because it leads to weird things when > trying to give a definition what a value of an object is. Python object: 1 The value of th

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Dave Hansen
On 18 Jan 2006 08:41:00 -0800 in comp.lang.python, [EMAIL PROTECTED] wrote: > >Fuzzyman wrote: >> I'm not familiar with the C basic datatypes - I assume it has an array >> or list like object. >> >> Would it contain a sequence of poitners to the members ? In which case >> they would only be equal

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Dave Hansen
On Wed, 18 Jan 2006 17:03:23 +0100 in comp.lang.python, Claudio Grondi <[EMAIL PROTECTED]> wrote: [...] > > >>> a = 1L > >>> b = 1L > >>> a is b >False > >Python fails to reuse the long integer object. It would be interesting >to know why, because it seems to be strange, that in case of integers

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Steve Holden
Claudio Grondi wrote: > > > > Subject: > Re: Can a simple a==b 'hang' in and endless loop? > From: > Claudio Grondi <[EMAIL PROTECTED]> > Date: > Wed, 18 Jan 2006 19:59:12

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Claudio Grondi
Steve Holden wrote: > Claudio Grondi wrote: > >> Steve Holden wrote: > > [...] > >> The problem here is, that I mean, that in Python it makes no sense to >> talk about a value of an object, because it leads to weird things when >> trying to give a definition what a value of an object is. >> >

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
Fredrik Lundh wrote: > Fuzzyman wrote: > > > I'm not familiar with the C basic datatypes - I assume it has an array > > or list like object. > > > > Would it contain a sequence of poitners to the members ? In which case > > they would only be equal if the pointers are the same. > > > > In this cas

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread bonono
Fuzzyman wrote: > I'm not familiar with the C basic datatypes - I assume it has an array > or list like object. > > Would it contain a sequence of poitners to the members ? In which case > they would only be equal if the pointers are the same. > > In this case : > > a = ['some string'] > b = ['som

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
Peter Hansen wrote: > Claudio Grondi wrote: > > but I mean, that it is not possible to use 'is' as replacement for '==' > > operator to achieve in Python same behaviour as it is the case in C and > > Javascript when comparing values with '=='. > > 'is' does the C, Javascript job when comparing lis

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fredrik Lundh
Fuzzyman wrote: > I'm not familiar with the C basic datatypes - I assume it has an array > or list like object. > > Would it contain a sequence of poitners to the members ? In which case > they would only be equal if the pointers are the same. > > In this case : > > a = ['some string'] > b = ['som

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
So you're no longer wanting to test for equality (as Fredrik has pointed out). All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
Fuzzyman wrote: > I'm not familiar with the C basic datatypes - I assume it has an array > or list like object. > > Would it contain a sequence of poitners to the members ? In which case > they would only be equal if the pointers are the same. > > In this case : > > a = ['some string'] > b = ['som

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread bonono
Claudio Grondi wrote: > As also the fact, that when > a = [1,2.0,3L] > b = [1.0,2,3 ] > a==b # gives True > even if the objects in the lists are actually different, > or when the objects being members of the list redefine __eq__ so, that > no matter how different they are, the lists always compare

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fredrik Lundh
Claudio Grondi wrote: > As also the fact, that when > a = [1,2.0,3L] > b = [1.0,2,3 ] > a==b # gives True > even if the objects in the lists are actually different, they all compare equal: >>> 1 == 1.0 True >>> 2.0 == 2 True >>> 3L == 3 True > or when the objects being members of the list redef

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
I'm not familiar with the C basic datatypes - I assume it has an array or list like object. Would it contain a sequence of poitners to the members ? In which case they would only be equal if the pointers are the same. In this case : a = ['some string'] b = ['somestring'] a == b False (probably)

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Claudio Grondi
Fuzzyman wrote: > Oops... my misreading, sorry. > > The reason that, in Python, short ints have the same identity is not > fickle - it's just True. Python creates a new reference (pointer) to > the same object. > > You're saying you want one comparison operator that for : > > >>a=[1] >>... many

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
Ok... so I'm now assuming that the information about '==' provided by the above gentleman *and* that I understand it correctly. The only confusion in C (which doesn't have classes) is that two list (like) objects can't be tested by value - only identity. In Java, comparing strings using '==' comp

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread bonono
Fuzzyman wrote: > Ok... so I'm now assuming that the information about '==' provided by > the above gentleman *and* that I understand it correctly. > > The only confusion in C (which doesn't have classes) is that two list > (like) objects can't be tested by value - only identity. > In C, they are

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Claudio Grondi
Fuzzyman wrote: > Claudio Grondi wrote: > [snip..] > >>Yes, I know about 'is', >> >>but I mean, that it is not possible to use 'is' as replacement for '==' >>operator to achieve in Python same behaviour as it is the case in C and >>Javascript when comparing values with '=='. >>'is' does the C, Jav

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread bonono
Fuzzyman wrote: > The above gentleman is asserting that in *Python* the term value has no > meaning. I don't know what he meant and don't want to get into that value/reference/object thingy discussion as it would be a never ending thing. I just want to say that '==' in C is very clear to me, wheth

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
[EMAIL PROTECTED] wrote: > Fuzzyman wrote: > > Claudio Grondi wrote: > > > Steve Holden wrote: > > [snip..] > > > The problem here is, that I mean, that in Python it makes no sense to > > > talk about a value of an object, because it leads to weird things when > > > trying to give a definition wha

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Peter Hansen
Claudio Grondi wrote: > but I mean, that it is not possible to use 'is' as replacement for '==' > operator to achieve in Python same behaviour as it is the case in C and > Javascript when comparing values with '=='. > 'is' does the C, Javascript job when comparing lists, but I mean it > fails to

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread bonono
Fuzzyman wrote: > Claudio Grondi wrote: > > Steve Holden wrote: > [snip..] > > The problem here is, that I mean, that in Python it makes no sense to > > talk about a value of an object, because it leads to weird things when > > trying to give a definition what a value of an object is. > > > > You'

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Steve Holden
Claudio Grondi wrote: > Steve Holden wrote: [...] > The problem here is, that I mean, that in Python it makes no sense to > talk about a value of an object, because it leads to weird things when > trying to give a definition what a value of an object is. > I don;t understand why you say that. >

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
Oops... my misreading, sorry. The reason that, in Python, short ints have the same identity is not fickle - it's just True. Python creates a new reference (pointer) to the same object. You're saying you want one comparison operator that for : > a=[1] > ... many other statements here ... > b=[1]

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
Claudio Grondi wrote: [snip..]> > Perhaps you could try again in English? :-) Sorry, that's a very complex > > sentence and it isn't clear what yo mean. > Here in English ;-) : > a=[1] > ... many other statements here ... > b=[1] > a is b # False > a == b # True > a[0] is b[0] # unpredictable(?)

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Claudio Grondi
Steve Holden wrote: > Claudio Grondi wrote: > [...] > >>> >> Yes, I know about 'is', >> >> but I mean, that it is not possible to use 'is' as replacement for >> '==' operator to achieve in Python same behaviour as it is the case in >> C and Javascript when comparing values with '=='. >> 'is' doe

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
Claudio Grondi wrote: > Steve Holden wrote: [snip..] > The problem here is, that I mean, that in Python it makes no sense to > talk about a value of an object, because it leads to weird things when > trying to give a definition what a value of an object is. > You're saying that C and Java get rou

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
Claudio Grondi wrote: [snip..] > Yes, I know about 'is', > > but I mean, that it is not possible to use 'is' as replacement for '==' > operator to achieve in Python same behaviour as it is the case in C and > Javascript when comparing values with '=='. > 'is' does the C, Javascript job when compar

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Steve Holden
Claudio Grondi wrote: [...] >> > Yes, I know about 'is', > > but I mean, that it is not possible to use 'is' as replacement for '==' > operator to achieve in Python same behaviour as it is the case in C and > Javascript when comparing values with '=='. > 'is' does the C, Javascript job when comp

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Claudio Grondi
prefix' code assigning to a >>>> and b something special, so, that Python gets trapped in an endless >>>> loop in a line with: >>>> >>>> if a==b: print 'OK' >>>> >>>> I mean, it would be of much help to me on my

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Claudio Grondi
probably looking for the identity operator which just > (effectively) compares pointers ('is'). > >a is b > > does more what you would expect. > > This is a better system than the ones you describe. :-) > > All the best, > > Fuzzyman > http:/

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Steve Holden
Claudio Grondi wrote: > Steve Holden wrote: > >>Claudio Grondi wrote: >> >> >>>In the process of learning about some deeper details of Python I am >>>curious if it is possible to write a 'prefix' code assigning to a and >>>b somet

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fuzzyman
oes more what you would expect. This is a better system than the ones you describe. :-) All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > With the solution to the question above I intended to have an example of > Python code which outcome is an endless loop and the p

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Claudio Grondi
Steve Holden wrote: > Claudio Grondi wrote: > >> In the process of learning about some deeper details of Python I am >> curious if it is possible to write a 'prefix' code assigning to a and >> b something special, so, that Python gets trapped in an endless loop

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Steve Holden
Claudio Grondi wrote: > In the process of learning about some deeper details of Python I am > curious if it is possible to write a 'prefix' code assigning to a and b > something special, so, that Python gets trapped in an endless loop in a > line with: > > if a==b

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Fredrik Lundh
Claudio Grondi wrote: > In the process of learning about some deeper details of Python I am > curious if it is possible to write a 'prefix' code assigning to a and b > something special, so, that Python gets trapped in an endless loop in a > line with: > > if a==b: pri

Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Claudio Grondi
In the process of learning about some deeper details of Python I am curious if it is possible to write a 'prefix' code assigning to a and b something special, so, that Python gets trapped in an endless loop in a line with: if a==b: print 'OK' I mean, it would be of much