Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Amit Saha
On Fri, Apr 12, 2013 at 1:42 PM, Amit Saha wrote: > On Fri, Apr 12, 2013 at 1:36 PM, Steven D'Aprano wrote: >> On 12/04/13 12:53, Amit Saha wrote: >> >>> So for example: >>> >> a=1 >> b=1 >> a is b >>> >>> True >> >> id(a) == id(b) >>> >>> True >> >> >> >> This is not a very g

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Amit Saha
On Fri, Apr 12, 2013 at 1:36 PM, Steven D'Aprano wrote: > On 12/04/13 12:53, Amit Saha wrote: > >> So for example: >> > a=1 > b=1 > a is b >> >> True > > id(a) == id(b) >> >> True > > > > This is not a very good example, because that behaviour itself is > implementation-depende

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Steven D'Aprano
On 12/04/13 12:53, Amit Saha wrote: So for example: a=1 b=1 a is b True id(a) == id(b) True This is not a very good example, because that behaviour itself is implementation-dependent and not guaranteed. For example, in IronPython 2.6 I get completely different behaviour: a = 1 b = 1

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Amit Saha
On Thu, Apr 11, 2013 at 8:41 PM, w qj wrote: > I found this under Windows Python3 l="http://f/"; l[-1] is not '/' > False > > and this under Linux Python3 l = "http://ff.f/"; l[-1] > '/' l[-1] is not '/' > True > > It's Looks like a python bug? No, this is not. The '

Re: [Tutor] Sharing Code Snippets

2013-04-11 Thread Steven D'Aprano
On 11/04/13 11:28, Amit Saha wrote: Hello everyone, I am not sure if this has been shared on this list. However, to help both those seeking help and those wanting to help, may I suggest that for all of you posting your programs, how about using a service such as GitHub's Gists [1]. It allows you

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Steven D'Aprano
On 11/04/13 20:41, w qj wrote: I found this under Windows Python3 l="http://f/"; l[-1] is not '/' False and this under Linux Python3 l = "http://ff.f/"; l[-1] '/' l[-1] is not '/' True It's Looks like a python bug? No, it is a bug in your understanding. The "is" and "is not" operat

Re: [Tutor] Sharing Code Snippets

2013-04-11 Thread Amit Saha
On Thu, Apr 11, 2013 at 9:33 PM, Albert-Jan Roskam wrote: >> Subject: [Tutor] Sharing Code Snippets >> >> Hello everyone, >> >> I am not sure if this has been shared on this list. However, to help >> both those seeking help and those wanting to help, may I suggest that >> for all of you posting yo

Re: [Tutor] Guidance if possible

2013-04-11 Thread Alan Gauld
On 11/04/13 23:33, Scurvy Scott wrote: the other for something like this. I have no intention of doing anything professional/shady/annoying with this code and want to write it purely for my own amusement as well as to learn and obviously to perhaps win something cool. Which is fine but you sho

[Tutor] Guidance if possible

2013-04-11 Thread Scurvy Scott
Hello again wonderful python tutor mailing list. I've got I guess more of a broad question than is usually asked on this list and perhaps some of you might find it annoying, that's fine, if it's inappropriate feel free to say so. I want to start work on a new python project that would visit a spe

Re: [Tutor] Running python from windows command prompt

2013-04-11 Thread Prasad, Ramit
On 11/04/13 07:08, Arijit Ukil wrote: > Thanks for the help. Now I have modifed the code as: > > import sys > > def main(argv): > data = int(sys.argv[1]) > avg = average (data) > print "Average:", avg > > def average(num_list): > return sum(num_list)/len(num_list) Note that in

Re: [Tutor] Appending an extra column in a data file

2013-04-11 Thread Oscar Benjamin
On 11 April 2013 13:25, Albert-Jan Roskam wrote: > > >>> Cool. This solves a problem it had with contextlib.nested some time ago. >>> (sorry for kinda hijacking this thread, but..) >>> Would it be safe (both __exit__ calls are guaranteed to be made) to use >>> code like this (if it worked, that i

Re: [Tutor] Appending an extra column in a data file

2013-04-11 Thread Albert-Jan Roskam
>> Cool. This solves a problem it had with contextlib.nested some time ago. >> (sorry for kinda hijacking this thread, but..) >> Would it be safe (both __exit__ calls are guaranteed to be made) to use >> code like this (if it worked, that is!)? > > Partly because it doesn't work I really can't f

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Wayne Werner
On Thu, 11 Apr 2013, Timo wrote: Op 11-04-13 12:41, w qj schreef: I found this under Windows Python3 l="http://f/"; l[-1] is not '/' False and this under Linux Python3 l = "http://ff.f/"; l[-1] '/' l[-1] is not '/' True It's Looks like a python bug? This looks like a "is not" versus "!="

Re: [Tutor] Appending an extra column in a data file

2013-04-11 Thread Oscar Benjamin
On 11 April 2013 12:24, Albert-Jan Roskam wrote: > > >> Subject: Re: [Tutor] Appending an extra column in a data file >> >> On Wed, Apr 10, 2013 at 5:49 PM, Oscar Benjamin >> wrote: fin = open('old.dat') fout = open('new.dat', 'w') with fin, fout: for

Re: [Tutor] Sharing Code Snippets

2013-04-11 Thread Albert-Jan Roskam
> Subject: [Tutor] Sharing Code Snippets > > Hello everyone, > > I am not sure if this has been shared on this list. However, to help > both those seeking help and those wanting to help, may I suggest that > for all of you posting your programs, how about using a service such > as GitHub's Gists

Re: [Tutor] Appending an extra column in a data file

2013-04-11 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] Appending an extra column in a data file > > On Wed, Apr 10, 2013 at 5:49 PM, Oscar Benjamin > wrote: >>>     fin = open('old.dat') >>>     fout = open('new.dat', 'w') >>> >>>     with fin, fout: >>>         for line in fin: >> >> This has the same problems as contextli

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Timo
Op 11-04-13 12:41, w qj schreef: I found this under Windows Python3 l="http://f/"; l[-1] is not '/' False and this under Linux Python3 l = "http://ff.f/"; l[-1] '/' l[-1] is not '/' True It's Looks like a python bug? This looks like a "is not" versus "!=" thing. Someone (I think Steven Ap

[Tutor] Looks like a judgment bug.

2013-04-11 Thread w qj
I found this under Windows Python3 >>> l="http://f/"; >>> l[-1] is not '/' False >>> and this under Linux Python3 >>> l = "http://ff.f/"; >>> l[-1] '/' >>> l[-1] is not '/' True It's Looks like a python bug? ___ Tutor maillist - Tutor@python.org To un