Re: Python for beginners or not? [was Re: syntax difference]

2018-06-27 Thread Neil Cerutti
On 2018-06-25, Alister wrote: > for i in range(len(list)): is a python anti-pattern it is almost a 100% > guarantee that you are doing something wrong* > > *as with all rules of thumb there is probably at least 1 > exception that the python experts will now point out. When you need look-ahead or

Re: syntax difference

2018-06-27 Thread Bart
On 27/06/2018 12:42, Peter J. Holzer wrote: On 2018-06-27 11:11:37 +1200, Gregory Ewing wrote: Bart wrote: x = set(range(10_000_000)) This used up 460MB of RAM (the original 100M I tried exhausted the memory). The advantage of Pascal-style sets is that that same set will occupy only

Re: syntax difference

2018-06-27 Thread Peter J. Holzer
On 2018-06-27 11:11:37 +1200, Gregory Ewing wrote: > Bart wrote: > >x = set(range(10_000_000)) > > > > This used up 460MB of RAM (the original 100M I tried exhausted the memory). > > > > The advantage of Pascal-style sets is that that same set will occupy > > only 1.25MB, as it is a bit-map.

Re: syntax difference

2018-06-26 Thread Gregory Ewing
Bart wrote: I don't know whether there is a direct equivalent in Python (I thought somebody would point it out) Not built-in, but a tiny bit of googling turns this up: https://pypi.org/project/bitarray/ "This module provides an object type which efficiently represents an array of booleans.

Re: syntax difference

2018-06-26 Thread Gregory Ewing
Bart wrote: x = set(range(10_000_000)) This used up 460MB of RAM (the original 100M I tried exhausted the memory). The advantage of Pascal-style sets is that that same set will occupy only 1.25MB, as it is a bit-map. That's true, but they're also extremely limited compared to the things

Re: syntax difference

2018-06-26 Thread Mark Lawrence
On 26/06/18 12:39, Chris Angelico wrote: On Tue, Jun 26, 2018 at 9:30 PM, Bart wrote: On 19/06/2018 11:33, Steven D'Aprano wrote: On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote: * Integer sets (Pascal-like sets) Why do you need them if you have real sets? I tried Python sets for the

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Mark Lawrence
From: Mark Lawrence On 25/06/18 17:15, jkn wrote: > On Monday, June 25, 2018 at 4:23:57 PM UTC+1, Chris Angelico wrote: >> On Mon, Jun 25, 2018 at 11:15 PM, jkn wrote: >>> (as well as pedanticism ;-o). >> >> Pedantry. >> >> ChrisA >> (You know I can't let that one pass.) > > I was chanel[l]ing

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Mark Lawrence
From: Mark Lawrence On 25/06/18 10:10, Alister via Python-list wrote: > On Mon, 25 Jun 2018 11:36:25 +0400, Abdur-Rahmaan Janhangeer wrote: > >> i think he means like for a loop to iterate over a list you might do >> >> list = [1,2,3] >> for i in range(len(list)): >> print(list[i]) >> >> >>

Re: syntax difference

2018-06-26 Thread Mark Lawrence
From: Mark Lawrence On 24/06/18 00:44, boB Stepp wrote: > I imagine that the > transition from version 2 to 3 was not undertaken halfheartedly, but > only after much thought and discussion since it did break backwards > compatibility. > So much so that a specific mailing list was set up just to

Re: syntax difference

2018-06-26 Thread Bart
To: boB Stepp From: "Bart" To: boB Stepp From: Bart On 24/06/2018 16:37, boB Stepp wrote: > On Sun, Jun 24, 2018 at 5:21 AM Bart wrote: > "... And of course, you would have to know how to use Python properly in > idiomatic style. No. I want to program in /my/ style, one more like the

Re: syntax difference

2018-06-26 Thread Bart
To: Chris Angelico From: "Bart" To: Chris Angelico From: Bart On 24/06/2018 15:46, Chris Angelico wrote: > On Sun, Jun 24, 2018 at 8:40 PM, Steven D'Aprano > wrote: >> On Sun, 24 Jun 2018 11:18:37 +0100, Bart wrote: >> >>> I wonder why it is just me that constantly needs to justify his

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Rick Johnson
To: Steven D'Aprano From: Rick Johnson On Monday, June 25, 2018 at 5:56:04 AM UTC-5, Steven D'Aprano wrote: > Nearly everybody misses the fact that the Zen is a joke, > not to be taken *too* seriously. A particularly subtle > joke, but still a joke. The Python Zen is not merely a joke. But

Re: syntax difference

2018-06-26 Thread Rick Johnson
To: Steven D'Aprano From: "Rick Johnson" To: Steven D'Aprano From: Rick Johnson On Sunday, June 24, 2018 at 10:05:14 AM UTC-5, Steven D'Aprano wrote: [...] > Be fair. It's more like 50% of the time. Let's not dogpile > onto Bart. He asked a question, I answered it, we don't all > need to

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Stefan Ram
To: Steven D'Aprano From: "Stefan Ram" To: Steven D'Aprano From: r...@zedat.fu-berlin.de (Stefan Ram) Steven D'Aprano writes: >It has been a long, long time since Python has been a "simple" language >suitable for rank beginners, if it ever was. Python is not Scratch. Python is simpler

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Bart
To: Ben Bacarisse From: "Bart" To: Ben Bacarisse From: Bart On 24/06/2018 01:53, Ben Bacarisse wrote: > Bart writes: >> Wow. (Just think of all the times you write a function containing a >> neat bunch of local functions, every time it's called it has to create >> a new function

Re: syntax difference

2018-06-26 Thread Bart
To: boB Stepp From: "Bart" To: boB Stepp From: Bart On 24/06/2018 00:44, boB Stepp wrote: > On Sat, Jun 23, 2018 at 5:35 PM Bart wrote: >> I'm not a user... > > Then I am truly puzzled, Bart. Why do you even bother to hang out on > this list? If you do not want to use Python and you do

Re: syntax difference

2018-06-26 Thread Gregory Ewing
To: Bart From: "Gregory Ewing" To: Bart From: Gregory Ewing Bart wrote: > But 40 years > ago it was just 'readln a,b,c'; it was just taken for granted. The problem with something like that is that it's really only useful for throwaway code. For any serious application, you need to deal

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Gregory Ewing
To: Bart From: "Gregory Ewing" To: Bart From: Gregory Ewing Bart wrote: > Wow. (Just think of all the times you write a function containing a neat > bunch of local functions, every time it's called it has to create a new > function instances for each of those functions, even if they are

Re: syntax difference

2018-06-26 Thread Bart
To: boB Stepp From: "Bart" To: boB Stepp From: Bart On 23/06/2018 20:52, boB Stepp wrote: > I've finally found time to examine this rather long, rambling thread. >> There is a place for various levels of programming language. I'm saying that Python which is always touted as a 'simple'

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Ben Bacarisse
To: Bart From: "Ben Bacarisse" To: Bart From: Ben Bacarisse Bart writes: > On 23/06/2018 23:25, Ben Bacarisse wrote: >> Bart writes: >> >>> On 23/06/2018 21:13, Chris Angelico wrote: On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: >>> > (At what point would that happen anyway;

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Ben Bacarisse
To: Bart From: "Ben Bacarisse" To: Bart From: Ben Bacarisse Bart writes: > On 23/06/2018 21:13, Chris Angelico wrote: >> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: > >>> (At what point would that happen anyway; if you do this: > >> NONE of your examples are taking copies of the

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Bart
To: Ben Bacarisse From: "Bart" To: Ben Bacarisse From: Bart On 23/06/2018 23:25, Ben Bacarisse wrote: > Bart writes: > >> On 23/06/2018 21:13, Chris Angelico wrote: >>> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: >> (At what point would that happen anyway; if you do this: >> >>>

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Bart
To: Chris Angelico From: "Bart" To: Chris Angelico From: Bart On 23/06/2018 21:13, Chris Angelico wrote: > On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: >> (At what point would that happen anyway; if you do this: > NONE of your examples are taking copies of the function. They all are >

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread jkn
To: Chris Angelico From: jkn On Monday, June 25, 2018 at 4:23:57 PM UTC+1, Chris Angelico wrote: > On Mon, Jun 25, 2018 at 11:15 PM, jkn wrote: > > (as well as pedanticism ;-o). > > Pedantry. > > ChrisA > (You know I can't let that one pass.) I was chanel[l]ing the TimBot, as any fule kno...

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Alister
To: Mark Lawrence From: Alister On Mon, 25 Jun 2018 11:42:27 +0100, Mark Lawrence wrote: > On 25/06/18 10:10, Alister via Python-list wrote: >> On Mon, 25 Jun 2018 11:36:25 +0400, Abdur-Rahmaan Janhangeer wrote: >> >>> i think he means like for a loop to iterate over a list you might do >>>

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Chris Angelico
From: Chris Angelico On Mon, Jun 25, 2018 at 11:15 PM, jkn wrote: > (as well as pedanticism ;-o). Pedantry. ChrisA (You know I can't let that one pass.) --- BBBS/Li6 v4.10 Toy-3 * Origin: Prism bbs (1:261/38) -- https://mail.python.org/mailman/listinfo/python-list

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread jkn
To: Paul Moore From: jkn On Monday, June 25, 2018 at 12:17:29 PM UTC+1, Paul Moore wrote: > On 25 June 2018 at 11:53, Steven D'Aprano > wrote: > > > And the specific line you reference is *especially* a joke, one which > > flies past nearly everyone's head: > > > > There should be one-- and

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Grant Edwards
From: Grant Edwards On 2018-06-25, Steven D'Aprano wrote: > And the specific line you reference is *especially* a joke, one which > flies past nearly everyone's head: > > There should be one-- and preferably only one --obvious way to do it. > > Notice the dashes? There are *two* traditional

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Steven D'Aprano
From: Steven D'Aprano On Sun, 24 Jun 2018 10:46:09 -0700, Jim Lee wrote: > On 06/24/2018 04:35 AM, Steven D'Aprano wrote: >> >> Indeed. That's one of the beauties of Python -- even when there's an >> advanced way to do it, there's generally a simple way too. >> >> > What happened to the Python

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Paul Moore
From: Paul Moore On 25 June 2018 at 11:53, Steven D'Aprano wrote: > And the specific line you reference is *especially* a joke, one which > flies past nearly everyone's head: > > There should be one-- and preferably only one --obvious way to do it. > > > Notice the dashes? There are *two*

Re: syntax difference

2018-06-26 Thread Bart
To: Steven D'Aprano From: Bart On 25/06/2018 01:52, Steven D'Aprano wrote: > On Sun, 24 Jun 2018 21:21:57 +0100, Bart wrote: > >> I've had half a dozen users > > Come back when you've had *half a million users* then we'll take your > experiences seriously. That being the case with Python

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Alister
To: Abdur-Rahmaan Janhangeer From: Alister On Mon, 25 Jun 2018 11:36:25 +0400, Abdur-Rahmaan Janhangeer wrote: > i think he means like for a loop to iterate over a list you might do > > list = [1,2,3] > for i in range(len(list)): > print(list[i]) > > > but the you might as well go for the

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Abdur-Rahmaan Janhangeer
From: Abdur-Rahmaan Janhangeer we must maybe fibd an example where both are pythonic but one is simpler unless my type of example was intented by @steve Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ > --- BBBS/Li6 v4.10 Toy-3 * Origin: Prism bbs (1:261/38) --

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Jim Lee
From: Jim Lee On 06/24/2018 04:35 AM, Steven D'Aprano wrote: > > Indeed. That's one of the beauties of Python -- even when there's an > advanced way to do it, there's generally a simple way too. > > What happened to the Python maxim "There should be oneΓ ÷and preferably only oneΓ ÷obvious way

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Abdur-Rahmaan Janhangeer
From: Abdur-Rahmaan Janhangeer i think he means like for a loop to iterate over a list you might do list = [1,2,3] for i in range(len(list)): print(list[i]) but the you might as well go for the simpler : for elem in list: print(elem) Abdur-Rahmaan Janhangeer

Re: syntax difference

2018-06-26 Thread Steven D'Aprano
From: Steven D'Aprano On Sun, 24 Jun 2018 21:21:57 +0100, Bart wrote: > I've had half a dozen users Come back when you've had *half a million users* then we'll take your experiences seriously. https://blog.pythonanywhere.com/67/ https://stackoverflow.blog/2017/09/06/incredible-growth-python/

Re: syntax difference

2018-06-26 Thread Bart
To: Steven D'Aprano From: Bart On 24/06/2018 20:02, Steven D'Aprano wrote: > On Sun, 24 Jun 2018 19:37:33 +0100, Bart wrote: > >> I want to program in /my/ style > > Python is not Java, and Java is not Python either. Nor is it "Bart's > Language", or C, or Forth, or Lisp, or bash. > >

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Stefan Ram
To: Stefan Ram From: r...@zedat.fu-berlin.de (Stefan Ram) r...@zedat.fu-berlin.de (Stefan Ram) writes: >Still, one must not forget that learning Python encompasses >all the hard work it takes to learn how to program in every >language. "Beginner", however, is a very vague term. A good

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Abdur-Rahmaan Janhangeer
From: Abdur-Rahmaan Janhangeer naaa it was not meant to be python ^^ Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ > > --- BBBS/Li6 v4.10 Toy-3 * Origin: Prism bbs (1:261/38) -- https://mail.python.org/mailman/listinfo/python-list

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Bart
To: Stefan Ram From: "Bart" To: Stefan Ram From: Bart On 23/06/2018 14:32, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >> def f(): >> def g(): >> g.x += 1 >> return g.x >> g.x = 0 >> return g > >Or, "for all g to share the same x": > >

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Stefan Ram
To: Stefan Ram From: "Stefan Ram" To: Stefan Ram From: r...@zedat.fu-berlin.de (Stefan Ram) r...@zedat.fu-berlin.de (Stefan Ram) writes: >def f(): >def g(): >g.x += 1 >return g.x >g.x = 0 >return g Or, "for all g to share the same x": main.py def f():

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Stefan Ram
To: Steven D'Aprano From: "Stefan Ram" To: Steven D'Aprano From: r...@zedat.fu-berlin.de (Stefan Ram) Steven D'Aprano writes: >def f(): >static x = 0 >def g(): >x += 1 >return x >return g What one can do today: main.py def g(): g.x += 1 return g.x

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Bart
To: Steven D'Aprano From: "Bart" To: Steven D'Aprano From: Bart On 23/06/2018 04:51, Steven D'Aprano wrote: > On Wed, 20 Jun 2018 14:18:19 +1000, Chris Angelico wrote: > >> Ah. Yeah, that would be a plausible feature to add to Python. But in C, >> a static variable is basically the same

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Chris Angelico
From: "Chris Angelico" From: Chris Angelico On Sat, Jun 23, 2018 at 1:51 PM, Steven D'Aprano wrote: > On Wed, 20 Jun 2018 14:18:19 +1000, Chris Angelico wrote: > >> Ah. Yeah, that would be a plausible feature to add to Python. But in C, >> a static variable is basically the same thing as a

Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Chris Angelico
From: "Chris Angelico" From: Chris Angelico On Sat, Jun 23, 2018 at 2:16 PM, Chris Angelico wrote: > For getting rid of the "len=len" trick, though, I would REALLY like to > transform those into LOAD_CONST. That'd be a fun bytecode hack all on > its own. In fact, I'm gonna have a shot at

Static variables [was Re: syntax difference]

2018-06-26 Thread Steven D'Aprano
From: "Steven D'Aprano" From: Steven D'Aprano On Wed, 20 Jun 2018 14:18:19 +1000, Chris Angelico wrote: > Ah. Yeah, that would be a plausible feature to add to Python. But in C, > a static variable is basically the same thing as a global variable, > except that its name is scoped to the

Re: syntax difference

2018-06-26 Thread Richard Damon
From: Richard Damon On 6/24/18 3:02 PM, Steven D'Aprano wrote: > On Sun, 24 Jun 2018 19:37:33 +0100, Bart wrote: > >> I want to program in /my/ style > Python is not Java, and Java is not Python either. Nor is it "Bart's > Language", or C, or Forth, or Lisp, or bash. > >

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Bart
To: Abdur-Rahmaan Janhangeer From: Bart On 24/06/2018 19:36, Abdur-Rahmaan Janhangeer wrote: > see for example > > https://en.m.wikipedia.org/wiki/Bresenham%27s_line_algorithm > > see the pseudocode, i was implementing some raster algos when i found > myself aux anges > > so close to py. i

Re: syntax difference

2018-06-26 Thread Steven D'Aprano
From: Steven D'Aprano On Sun, 24 Jun 2018 19:37:33 +0100, Bart wrote: > I want to program in /my/ style Python is not Java, and Java is not Python either. Nor is it "Bart's Language", or C, or Forth, or Lisp, or bash. https://dirtsimple.org/2004/12/python-is-not-java.html

Re: syntax difference

2018-06-26 Thread Terry Reedy
From: Terry Reedy On 6/24/2018 11:39 AM, Bart wrote: Bart, I agree that people should not dogpile onto you. As with Rick, I read your posts or not, depending on whether I feel like being entertained at the moment, and usually move on without comment. > I know I'm going to get flak for

Re: syntax difference

2018-06-26 Thread Antoon Pardon
On 26-06-18 14:47, Bart wrote: > > [About bitsets] > > Here's the set of characters allowed in a C identifier (not using > Python syntax): > >   cident = {'A'..'Z', 'a'..'z', '0'..'9', '_', '9'} > > The characters allowed in a hex constant: > >   {'0'..'9', 'A'..'F', 'a'..'f'} > > A set

Re: syntax difference

2018-06-26 Thread Bart
On 26/06/2018 12:39, Chris Angelico wrote: On Tue, Jun 26, 2018 at 9:30 PM, Bart wrote: On 19/06/2018 11:33, Steven D'Aprano wrote: On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote: * Integer sets (Pascal-like sets) Why do you need them if you have real sets? I tried Python sets for

Re: syntax difference

2018-06-26 Thread Chris Angelico
On Tue, Jun 26, 2018 at 9:30 PM, Bart wrote: > On 19/06/2018 11:33, Steven D'Aprano wrote: >> >> On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote: > > >> * Integer sets (Pascal-like sets) >> >> Why do you need them if you have real sets? > > > I tried Python sets for the first time. They seemed

Re: syntax difference

2018-06-26 Thread Bart
On 19/06/2018 11:33, Steven D'Aprano wrote: On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote: * Integer sets (Pascal-like sets) Why do you need them if you have real sets? I tried Python sets for the first time. They seemed workable but rather clunky to set up. But here is one problem on my

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Steven D'Aprano
On Mon, 25 Jun 2018 18:22:56 +, Grant Edwards wrote: > On 2018-06-24, Steven D'Aprano wrote: > >> Building functions is cheap. Cheap is not free. >> >> Inner functions that aren't exposed to the outside cannot be tested in >> isolation, you can't access them through help() interactively.

Re: syntax difference

2018-06-25 Thread boB Stepp
On Mon, Jun 25, 2018 at 2:37 AM Mark Lawrence wrote: > > On 24/06/18 00:44, boB Stepp wrote: > > I imagine that the > > transition from version 2 to 3 was not undertaken halfheartedly, but > > only after much thought and discussion since it did break backwards > > compatibility. > > > > So much

Re: syntax difference

2018-06-25 Thread Chris Angelico
On Tue, Jun 26, 2018 at 6:04 AM, Grant Edwards wrote: > On 2018-06-24, Steven D'Aprano wrote: > >> That's nothing, there are languages where the standard way to write >> a for loop is to call an external program that generates a stream of >> numeric strings separated by spaces in a subprocess,

Re: syntax difference

2018-06-25 Thread Grant Edwards
On 2018-06-24, Steven D'Aprano wrote: > That's nothing, there are languages where the standard way to write > a for loop is to call an external program that generates a stream of > numeric strings separated by spaces in a subprocess, and read the > strings from standard input as text. What

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Marko Rauhamaa
Grant Edwards : > IOW, you use a local function instead of a global one for the exact > same reasons you use local "variables" instead of global ones. > > In Python, functions are first class objects. Binding a name to a > function is no different than binding it to an integer, list, string, > or

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Grant Edwards
On 2018-06-24, Steven D'Aprano wrote: > Building functions is cheap. Cheap is not free. > > Inner functions that aren't exposed to the outside cannot be tested > in isolation, you can't access them through help() > interactively. Given the choice between: [...] > so not expensive, but not free

Re: syntax difference

2018-06-25 Thread Bart
To: boB Stepp From: Bart On 24/06/2018 16:37, boB Stepp wrote: > On Sun, Jun 24, 2018 at 5:21 AM Bart wrote: > "... And of course, you would have to know how to use Python properly in > idiomatic style. No. I want to program in /my/ style, one more like the pseudo-code that was mentioned

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Abdur-Rahmaan Janhangeer
From: Abdur-Rahmaan Janhangeer see for example https://en.m.wikipedia.org/wiki/Bresenham%27s_line_algorithm see the pseudocode, i was implementing some raster algos when i found myself aux anges so close to py. i guess it was written in prehistoric times with the author trying to simplify

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Chris Angelico
From: Chris Angelico On Mon, Jun 25, 2018 at 2:23 AM, Abdur-Rahmaan Janhangeer wrote: > Python is rightly called executable pseudocode. i appreciated the fact that > you can go on wikipaedia, find the pseudocode of algorithms remove curly > braces and replace by py's more powerful syntax and

Re: syntax difference

2018-06-25 Thread Chris Angelico
From: Chris Angelico On Mon, Jun 25, 2018 at 1:02 AM, Steven D'Aprano wrote: > On Mon, 25 Jun 2018 00:46:00 +1000, Chris Angelico wrote: > >> On Sun, Jun 24, 2018 at 8:40 PM, Steven D'Aprano >> wrote: >>> On Sun, 24 Jun 2018 11:18:37 +0100, Bart wrote: >>> I wonder why it is just me that

Re: syntax difference

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sun, 24 Jun 2018 16:39:19 +0100, Bart wrote: > More like utter disbelief at how it works. Surely it cannot work like > that because it would be too inefficient? Apparently, yes it can... Apparently, no it doesn't, because the fact that Python is used by tens of

Re: syntax difference

2018-06-25 Thread boB Stepp
From: boB Stepp On Sun, Jun 24, 2018 at 5:21 AM Bart wrote: > > On 24/06/2018 00:44, boB Stepp wrote: > > On Sat, Jun 23, 2018 at 5:35 PM Bart wrote: > > >> I'm not a user... > > > > Then I am truly puzzled, Bart. Why do you even bother to hang out on > > this list? If you do not want to use

Re: syntax difference

2018-06-25 Thread Rick Johnson
To: Steven D'Aprano From: Rick Johnson On Sunday, June 24, 2018 at 10:05:14 AM UTC-5, Steven D'Aprano wrote: [...] > Be fair. It's more like 50% of the time. Let's not dogpile > onto Bart. He asked a question, I answered it, we don't all > need to sink the boot in as well. And why am i _not_

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Abdur-Rahmaan Janhangeer
From: Abdur-Rahmaan Janhangeer Python is rightly called executable pseudocode. i appreciated the fact that you can go on wikipaedia, find the pseudocode of algorithms remove curly braces and replace by py's more powerful syntax and poof, suddenly it becomes too easy. Abdur-Rahmaan Janhangeer

Re: syntax difference

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Mon, 25 Jun 2018 00:46:00 +1000, Chris Angelico wrote: > On Sun, Jun 24, 2018 at 8:40 PM, Steven D'Aprano > wrote: >> On Sun, 24 Jun 2018 11:18:37 +0100, Bart wrote: >> >>> I wonder why it is just me that constantly needs to justify his >>> existence in this group? >>

Re: syntax difference

2018-06-25 Thread Bart
To: Chris Angelico From: Bart On 24/06/2018 15:46, Chris Angelico wrote: > On Sun, Jun 24, 2018 at 8:40 PM, Steven D'Aprano > wrote: >> On Sun, 24 Jun 2018 11:18:37 +0100, Bart wrote: >> >>> I wonder why it is just me that constantly needs to justify his >>> existence in this group? >> >>

Re: syntax difference

2018-06-25 Thread Chris Angelico
From: Chris Angelico On Sun, Jun 24, 2018 at 8:40 PM, Steven D'Aprano wrote: > On Sun, 24 Jun 2018 11:18:37 +0100, Bart wrote: > >> I wonder why it is just me that constantly needs to justify his >> existence in this group? > > Because its just you who spends 90% of his time here complaining

Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 14:52:24 -0500, boB Stepp wrote: [...] >> There is a place for various levels of programming language. I'm saying >> that Python which is always touted as a 'simple' language suitable for >> beginners, is missing a surprising number of basics. > > I

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Stefan Ram
To: Steven D'Aprano From: r...@zedat.fu-berlin.de (Stefan Ram) Steven D'Aprano writes: >It has been a long, long time since Python has been a "simple" language >suitable for rank beginners, if it ever was. Python is not Scratch. Python is simpler insofar as you can write on a higher level

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Bart
To: Ben Bacarisse From: Bart On 24/06/2018 01:53, Ben Bacarisse wrote: > Bart writes: >> Wow. (Just think of all the times you write a function containing a >> neat bunch of local functions, every time it's called it has to create >> a new function instances for each of those functions, even

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sun, 24 Jun 2018 11:23:12 +0100, Bart wrote: > On 24/06/2018 01:53, Ben Bacarisse wrote: >> Bart writes: > >>> Wow. (Just think of all the times you write a function containing a >>> neat bunch of local functions, every time it's called it has to create >>> a new

Re: syntax difference

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sun, 24 Jun 2018 11:18:37 +0100, Bart wrote: > I wonder why it is just me that constantly needs to justify his > existence in this group? Because its just you who spends 90% of his time here complaining about how Python does it wrong. -- Steven D'Aprano "Ever since I

Re: syntax difference

2018-06-25 Thread Bart
To: boB Stepp From: Bart On 24/06/2018 00:44, boB Stepp wrote: > On Sat, Jun 23, 2018 at 5:35 PM Bart wrote: >> I'm not a user... > > Then I am truly puzzled, Bart. Why do you even bother to hang out on > this list? If you do not want to use Python and you do not want to > improve Python's

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 18:29:51 +0100, MRAB wrote: > You can already do something similar like this: > > def f(): > f.x += 1 > return f.x > f.x = 0 > > [snip] You can, but only as an illustration, not as a serious implementation. The whole point of static local

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 21:44:00 +0100, Bart wrote: > Since these references are created via the return g statement here: > > def f(): > def g(): > > return g > > (say to create function references i and j like this: > > i = f() >

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sun, 24 Jun 2018 00:37:36 +0100, Bart wrote: > Do you mean that if the same 'def' block is re-executed, it will create > a different instance of the function? (Same byte-code, but a different > set of everything else the function uses.) That's not as slow as you think

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Gregory Ewing
To: Bart From: Gregory Ewing Bart wrote: > Wow. (Just think of all the times you write a function containing a neat > bunch of local functions, every time it's called it has to create a new > function instances for each of those functions, even if they are not used.) Fortunately, function

Re: syntax difference

2018-06-25 Thread boB Stepp
From: boB Stepp On Sat, Jun 23, 2018 at 5:35 PM Bart wrote: > > On 23/06/2018 20:52, boB Stepp wrote: > The first programming exercise I ever did involved asking for three > numbers, then determining whether those numbers could form the sides of > a triangle. > > Then [40 years ago], the easy

Re: syntax difference

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 23:26:43 +0100, Bart wrote: > Then [40 years ago], the easy part was reading the three numbers. Now > that would be the more challenging part. # Get three numbers, separated by spaces, with no error-recovery. # If you try to read bad data, the process

Re: syntax difference

2018-06-25 Thread Gregory Ewing
To: Bart From: Gregory Ewing Bart wrote: > But 40 years > ago it was just 'readln a,b,c'; it was just taken for granted. The problem with something like that is that it's really only useful for throwaway code. For any serious application, you need to deal with the possibility of malformed

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Chris Angelico
From: Chris Angelico On Sun, Jun 24, 2018 at 9:37 AM, Bart wrote: > On 23/06/2018 23:25, Ben Bacarisse wrote: >> >> Bart writes: >> >>> On 23/06/2018 21:13, Chris Angelico wrote: On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: >>> >>> > (At what point would that happen anyway; if

Re: syntax difference

2018-06-25 Thread Bart
To: boB Stepp From: Bart On 23/06/2018 20:52, boB Stepp wrote: > I've finally found time to examine this rather long, rambling thread. >> There is a place for various levels of programming language. I'm saying that Python which is always touted as a 'simple' language suitable for beginners,

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Ben Bacarisse
To: Bart From: Ben Bacarisse Bart writes: > On 23/06/2018 23:25, Ben Bacarisse wrote: >> Bart writes: >> >>> On 23/06/2018 21:13, Chris Angelico wrote: On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: >>> > (At what point would that happen anyway; if you do this: >>> NONE of

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Ben Bacarisse
To: Bart From: Ben Bacarisse Bart writes: > On 23/06/2018 21:13, Chris Angelico wrote: >> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: > >>> (At what point would that happen anyway; if you do this: > >> NONE of your examples are taking copies of the function. They all are >> making

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Bart
To: Ben Bacarisse From: Bart On 23/06/2018 23:25, Ben Bacarisse wrote: > Bart writes: > >> On 23/06/2018 21:13, Chris Angelico wrote: >>> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: >> (At what point would that happen anyway; if you do this: >> >>> NONE of your examples are taking

Re: syntax difference

2018-06-25 Thread boB Stepp
From: boB Stepp I've finally found time to examine this rather long, rambling thread. On Wed, Jun 20, 2018 at 5:46 AM wrote: > > Yeah, people keep bringing that up when they run out of arguments. > > So, every programmer must always use the most advanced, most esoteric features possible at

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Bart
To: Chris Angelico From: Bart On 23/06/2018 21:13, Chris Angelico wrote: > On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: >> (At what point would that happen anyway; if you do this: > NONE of your examples are taking copies of the function. They all are > making REFERENCES to the same

Re: Static variables [was Re: syntax difference]

2018-06-25 Thread Chris Angelico
From: Chris Angelico On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote: > This is an example of a simple concept getting so out of hand that it will > either never be implemented, or the resulting implementation becomes > impractical to use. > > This is what we're trying to do: > > def nextx():

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Mark Lawrence
On 25/06/18 17:15, jkn wrote: On Monday, June 25, 2018 at 4:23:57 PM UTC+1, Chris Angelico wrote: On Mon, Jun 25, 2018 at 11:15 PM, jkn wrote: (as well as pedanticism ;-o). Pedantry. ChrisA (You know I can't let that one pass.) I was chanel[l]ing the TimBot, as any fule kno... Ritten

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread jkn
On Monday, June 25, 2018 at 4:23:57 PM UTC+1, Chris Angelico wrote: > On Mon, Jun 25, 2018 at 11:15 PM, jkn wrote: > > (as well as pedanticism ;-o). > > Pedantry. > > ChrisA > (You know I can't let that one pass.) I was chanel[l]ing the TimBot, as any fule kno... --

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Alister via Python-list
On Mon, 25 Jun 2018 11:42:27 +0100, Mark Lawrence wrote: > On 25/06/18 10:10, Alister via Python-list wrote: >> On Mon, 25 Jun 2018 11:36:25 +0400, Abdur-Rahmaan Janhangeer wrote: >> >>> i think he means like for a loop to iterate over a list you might do >>> >>> list = [1,2,3] >>> for i in

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Chris Angelico
On Mon, Jun 25, 2018 at 11:15 PM, jkn wrote: > (as well as pedanticism ;-o). Pedantry. ChrisA (You know I can't let that one pass.) -- https://mail.python.org/mailman/listinfo/python-list

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Grant Edwards
On 2018-06-25, Steven D'Aprano wrote: > And the specific line you reference is *especially* a joke, one which > flies past nearly everyone's head: > > There should be one-- and preferably only one --obvious way to do it. > > Notice the dashes? There are *two* traditional ways to use an pair >

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread jkn
On Monday, June 25, 2018 at 12:17:29 PM UTC+1, Paul Moore wrote: > On 25 June 2018 at 11:53, Steven D'Aprano > wrote: > > > And the specific line you reference is *especially* a joke, one which > > flies past nearly everyone's head: > > > > There should be one-- and preferably only one

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Mark Lawrence
On 25/06/18 10:10, Alister via Python-list wrote: On Mon, 25 Jun 2018 11:36:25 +0400, Abdur-Rahmaan Janhangeer wrote: i think he means like for a loop to iterate over a list you might do list = [1,2,3] for i in range(len(list)): print(list[i]) but the you might as well go for the

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-25 Thread Paul Moore
On 25 June 2018 at 11:53, Steven D'Aprano wrote: > And the specific line you reference is *especially* a joke, one which > flies past nearly everyone's head: > > There should be one-- and preferably only one --obvious way to do it. > > > Notice the dashes? There are *two* traditional ways to use

  1   2   3   4   >