Re: learnpython.org - an online interactive Python tutorial

2011-04-25 Thread Gregory Ewing
harrismh777 wrote: maybe the way to be really consistent (especially with the Zen of Python, explicit is better than implicit) that int --> float --> complex (imaginary) should not occur either ! Applying parts of the Zen selectively can be dangerous. Practicality also beats purity. I've used

Re: learnpython.org - an online interactive Python tutorial

2011-04-25 Thread Terry Reedy
On 4/25/2011 2:20 AM, harrismh777 wrote: Steven D'Aprano wrote: It seems to me that weak typing is a Do What I Mean function, and DWIM is a notoriously bad anti-pattern that causes far more trouble than it is worth. I'm even a little suspicious of numeric coercions between integer and float. (Bu

Re: learnpython.org - an online interactive Python tutorial

2011-04-24 Thread harrismh777
Steven D'Aprano wrote: It seems to me that weak typing is a Do What I Mean function, and DWIM is a notoriously bad anti-pattern that causes far more trouble than it is worth. I'm even a little suspicious of numeric coercions between integer and float. (But only a little.) I'm wondering about th

Re: learnpython.org - an online interactive Python tutorial

2011-04-24 Thread harrismh777
Dave Angel wrote: time echo "scale = 1010; 16 * a(1/5) - 4 * a(1/239)" |bc -lq Wouldn't it be shorter to say: time echo "scale = 1010; 4 * a(1)" |bc -lq Well, you can check it out by doing the math... (its fun...) ... you will notice that 'time' is called first, which on *nix systems c

Re: learnpython.org - an online interactive Python tutorial

2011-04-24 Thread jmfauth
On 24 avr, 05:10, harrismh777 wrote: > >     I've been giving this some more thought. From the keyboard, all I am > able to enter are character strings (not numbers). Presumably these are > UTF-8 strings in python3.  If I enter ... In Python 3, input() returns a unicode, a sequence/table/array o

Re: Re: learnpython.org - an online interactive Python tutorial

2011-04-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, harrismh777 wrote: Cameron Simpson wrote: | folks are not aware that 'bc' also has arbitrary precision floating | point math and a standard math library. Floating point math? I thought, historically at least, that bc is built on dc (arbitrary precision integer math, r

Re: learnpython.org - an online interactive Python tutorial

2011-04-24 Thread Steven D'Aprano
On Sat, 23 Apr 2011 22:10:47 -0500, harrismh777 wrote: > I've been giving this some more thought. From the keyboard, all I am > able to enter are character strings (not numbers). Presumably these are > UTF-8 strings in python3. If I enter the character string 57 then > python converts my ch

Re: learnpython.org - an online interactive Python tutorial

2011-04-24 Thread Chris Angelico
On Sun, Apr 24, 2011 at 6:13 PM, Steven D'Aprano wrote: > suppose an implementation might choose to trade off memory for time, > skipping string -> bignum conversations at the cost of doubling the > memory requirements. But even if I grant you bignums, you have to do the > same for floats. Re-impl

Re: learnpython.org - an online interactive Python tutorial

2011-04-24 Thread Steven D'Aprano
On Sun, 24 Apr 2011 11:35:28 +1000, Chris Angelico wrote: > On Sun, Apr 24, 2011 at 10:42 AM, Steven D'Aprano > wrote: >> This is much like my experience with Apple's Hypertalk, where the only >> data structure is a string. I'm very fond of Hypertalk, but it is >> hardly designed with machine eff

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Steven D'Aprano wrote: If that's a "serious" flaw, it's a flaw shared by the vast majority of programming languages. Yes, agreed. As for the question of "consistency", I would argue the opposite: that auto-promoting strings to numbers arguably is useful, but that is what is inconsistent, n

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Cameron Simpson wrote: | folks are not aware that 'bc' also has arbitrary precision floating | point math and a standard math library. Floating point math? I thought, historically at least, that bc is built on dc (arbitrary precision integer math, reverse polish syntax) and that consequently bc

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Cameron Simpson
On 23Apr2011 19:37, harrismh777 wrote: [...] | Yes, my "big num" research stuff was initially done in REXX, on | VM/CMS. I later ported my libraries over to OS/2 and continued with | that well into the '90s, when I discovered Unix and 'bc'. Many | folks are not aware that 'bc' also has arbitrary

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Chris Angelico
On Sun, Apr 24, 2011 at 10:42 AM, Steven D'Aprano wrote: > This is much like my experience with Apple's Hypertalk, where the only > data structure is a string. I'm very fond of Hypertalk, but it is hardly > designed with machine efficiency in mind. If you think Python is slow > now, imagine how sl

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Steven D'Aprano
On Fri, 22 Apr 2011 01:38:21 -0500, harrismh777 wrote: > Heiko Wundram wrote: >> The difference between strong typing and weak typing is best described >> by: >> >> Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 >> (release) 1] on cygwin Type "help", "copyright", "credits" or

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Chris Angelico wrote: Wow, someone else who knows REXX and OS/2! REXX was the first bignum language I met, and it was really cool after working in BASIC and 80x86 assembly to suddenly be able to work with arbitrary-precision numbers! Yes, my "big num" research stuff was initially done in REXX,

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Westley Martínez
On Fri, Apr 22, 2011 at 04:48:39PM -0700, Dan Stromberg wrote: > On Thu, Apr 21, 2011 at 11:38 PM, harrismh777 wrote: > > > > > Yes. And you have managed to point out a serious flaw in the overall logic > > and consistency of Python, IMHO. > > > > Strings should auto-type-promote to numbers if app

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Tim Chase
On 04/23/2011 11:51 AM, Dotan Cohen wrote: harrismh777 wrote: If an operation like (+) is used to add 1 + '1' then the string should be converted to int and the addition should take place, returning a reference to object int (2). No, the int 1 should be cast to a string, and the result shoul

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Dotan Cohen
On Fri, Apr 22, 2011 at 09:38, harrismh777 wrote: > If an operation like (+) is used to add  1 + '1' then the string should be > converted to int and the addition should take place, returning a reference > to object int (2). > No, the int 1 should be cast to a string, and the result should be the

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread rantingrick
On Apr 22, 1:38 am, harrismh777 wrote: > Strings should auto-type-promote to numbers if appropriate. No they should not! We do not want a language to "guess" our intentions. We are big boys and girls and should be responsible for own actions. > This behavior should occur in input() as well. If

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread rantingrick
On Apr 23, 1:28 am, Dennis Lee Bieber wrote: > But what if /I/ want >                 "A" + 1 > to return >                 "B" No problem! Python even allows you to create your own functions! I know, amazing! 8-O >>> def succ(s): return chr(ord(s) + 1) >>> succ('a') 'b' >>> succ('B')

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Dotan Cohen
On Wed, Apr 20, 2011 at 20:15, Ron wrote: > Hey everyone. > > I've written an online interactive Python tutorial atop Google App Engine: > http://www.learnpython.org. > > All you need to do is log in using your Google account and edit the wiki to > add your tutorials. > > Read more on the websit

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread flebber
On Apr 23, 4:28 pm, Dennis Lee Bieber wrote: > On Fri, 22 Apr 2011 17:08:53 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: > > > I'm not so sure that all strings should autopromote to integer (or > > "numeric" generally). However, adding a string and a number _shoul

Re: learnpython.org - an online interactive Python tutorial

2011-04-22 Thread Dan Stromberg
On Thu, Apr 21, 2011 at 11:38 PM, harrismh777 wrote: > > Yes. And you have managed to point out a serious flaw in the overall logic > and consistency of Python, IMHO. > > Strings should auto-type-promote to numbers if appropriate. Please no. It's a little more convenient sometimes when you're c

Re: learnpython.org - an online interactive Python tutorial

2011-04-22 Thread Roy Smith
In article , Mel wrote: > > Strings should auto-type-promote to numbers if appropriate. > > "Appropriate" is the problem. This is why Perl needs two completely > different kinds of comparison -- one that works as though its operands are > numbers, and one that works as though they're strings

Re: learnpython.org - an online interactive Python tutorial

2011-04-22 Thread Mel
harrismh777 wrote: > Heiko Wundram wrote: >> The difference between strong typing and weak typing is best described >> by: >> >> Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) >> [GCC 4.3.4 20090804 (release) 1] on cygwin >> Type "help", "copyright", "credits" or "license" for more information.

Re: learnpython.org - an online interactive Python tutorial

2011-04-22 Thread Chris Angelico
On Fri, Apr 22, 2011 at 4:38 PM, harrismh777 wrote: > My feelings about this are strongly influenced by my experiences with the > REXX language on IBM's SAA systems--- OS/2 and VM/CMS. In REXX everything is > a string... everything. If a string just happens to be a REXX number, then > it can be ma

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread harrismh777
Heiko Wundram wrote: The difference between strong typing and weak typing is best described by: Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 (release) 1] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> 1+'2' Traceback (most recent c

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Diego Arias
On Thu, Apr 21, 2011 at 8:20 PM, Dan Stromberg wrote: > > On Thu, Apr 21, 2011 at 9:13 AM, MRAB wrote: > >> On 21/04/2011 15:14, Westley Martínez wrote: >> >>> On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote: >>> On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: >>>

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Dan Stromberg
On Thu, Apr 21, 2011 at 9:13 AM, MRAB wrote: > On 21/04/2011 15:14, Westley Martínez wrote: > >> On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote: >> >>> On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila >>> wrote: >>> False: Python IS strongly typed, without doubt (though the >>

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread MRAB
On 21/04/2011 15:14, Westley Martínez wrote: On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote: On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: False: Python IS strongly typed, without doubt (though the variables are not explicitly declared.) Strongly duck-typed though. If

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Westley Martínez
On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote: > On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: > > False: Python IS strongly typed, without doubt (though the > > variables are not explicitly declared.) > > Strongly duck-typed though. If I create a class that has all the r

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Heiko Wundram
Am 21.04.2011 09:19, schrieb Chris Angelico: > On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: >> False: Python IS strongly typed, without doubt (though the >> variables are not explicitly declared.) > > Strongly duck-typed though. If I create a class that has all the right > members, it ca

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread harrismh777
Algis Kabaila wrote: [quote] Python is completely object oriented, and not "strongly typed" [/quote] False: Python IS strongly typed, without doubt (though the variables are not explicitly declared.) Playing the advocate for a moment here, this is something that I was confused about early o

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Chris Angelico
On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: > False: Python IS strongly typed, without doubt (though the > variables are not explicitly declared.) Strongly duck-typed though. If I create a class that has all the right members, it can simultaneously be a file, an iterable, a database, an

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Algis Kabaila
On Thursday 21 April 2011 03:15:50 Ron wrote: > Hey everyone. > > I've written an online interactive Python tutorial atop > Google App Engine: http://www.learnpython.org. > > All you need to do is log in using your Google account and > edit the wiki to add your tutorials. > > Read more on the we

Re: learnpython.org - an online interactive Python tutorial

2011-04-20 Thread Yico Gaga
well ,i can't visit your website ,required time out ,maybe it's the GFW'S problem ~ 2011/4/21 Ron > Hey everyone. > > I've written an online interactive Python tutorial atop Google App Engine: > http://www.learnpython.org. > > All you need to do is log in using your Google account and edit the

Re: learnpython.org - an online interactive Python tutorial

2011-04-20 Thread Chris Angelico
On Thu, Apr 21, 2011 at 3:15 AM, Ron wrote: > Hey everyone. > > I've written an online interactive Python tutorial atop Google App Engine: > http://www.learnpython.org. That looks very handy! And I notice you've protected yourself by running it in a sandbox: import time time.sleep(3) Tracebac

Re: learnpython.org - an online interactive Python tutorial

2011-04-20 Thread Terry Reedy
On 4/20/2011 1:15 PM, Ron wrote: I've written an online interactive Python tutorial atop Google App Engine: http://www.learnpython.org. Currently giving 500 server error. Hope something clears up. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: learnpython.org - an online interactive Python tutorial

2011-04-20 Thread FELD Boris
Excellent idea, I've some ideas on specific subjects misunderstood by beginners. One idea for facilitating the contribution, create a mercurial repository (or a git), everyone has not a google account and your contributors will be developers so they should use a SCM. Once again, it's an excell

Re: learnpython.org - an online interactive Python tutorial

2011-04-20 Thread Ron
Thanks! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: learnpython.org - an online interactive Python tutorial

2011-04-20 Thread Matty Sarro
Awesome project, I really like it. I'll see if I can't help adding some material that's missing when I get on the train. Keep up the great work! On Wed, Apr 20, 2011 at 1:15 PM, Ron wrote: > Hey everyone. > > I've written an online interactive Python tutorial atop Google App Engine: > http://www

learnpython.org - an online interactive Python tutorial

2011-04-20 Thread Ron
Hey everyone. I've written an online interactive Python tutorial atop Google App Engine: http://www.learnpython.org. All you need to do is log in using your Google account and edit the wiki to add your tutorials. Read more on the website. Thanks for your help, and I would appreciate if you he