Re: Lists And Extra Commas at end

2019-12-24 Thread Cameron Simpson
On 25Dec2019 01:20, mail.python@marco.sulla.e4ward.com wrote: About the extra comma, it's da**ed useful: [...] The real problem is this one: a = 1, Unreadable and prone to subtle errors, because maybe you added the comma by mistake. Caution: Debugging Nightmares. Hoo, yes. Only the ot

Re: Most elegant way to do something N times

2019-12-24 Thread Marco Sulla via Python-list
Anyway, from itertools recipes: def repeatfunc(func, times=None, *args): """Repeat calls to func with specified arguments. Example: repeatfunc(random.random) """ if times is None: return starmap(func, repeat(args)) return starmap(func, repeat(args, times)) On Tue, 24

Re: Lists And Extra Commas at end

2019-12-24 Thread Marco Sulla via Python-list
On Wed, 25 Dec 2019 at 00:56, Avi Gross wrote: > I may not be understanding what you are objecting to I, sir, am objecting that I replied to a topic, and you answered to me, but in another topic. You could have respond to me in the correct topic, and then create this other one (that I'm not real

Re: Lists And Extra Commas at end

2019-12-24 Thread Chris Angelico
On Wed, Dec 25, 2019 at 10:50 AM Avi Gross via Python-list wrote: > > Cameron, > > I am not at all against the feature. I like it as my programming style is > like you describe. One entry per line indented at the same level, in > multiple languages. I often do graphics where I generate an image th

RE: Lists And Extra Commas at end

2019-12-24 Thread Avi Gross via Python-list
Cameron, I am not at all against the feature. I like it as my programming style is like you describe. One entry per line indented at the same level, in multiple languages. I often do graphics where I generate an image then fine-tune additional parameters to get the effect I want. Some functions ta

Re: More efficient/elegant branching

2019-12-24 Thread Marco Sulla via Python-list
I agree with Chris Angelico, branch1 is "the way to go". Maybe you have to add a default at start, maybe None, and maybe raise an exception if res is None. Anyway, despite I'm a pain in the... arse and I usually activate ALL the possible warnings in the world, I always disable cyclomatic complexity

Re: Lists And Missing Commas

2019-12-24 Thread Marco Sulla via Python-list
On Tue, 24 Dec 2019 at 19:05, Avi Gross via Python-list wrote: > There are some lint programs that check your code and supply warnings and I > see some languages have the option to generate warnings when the two strings > are on the same line. I wonder if a Python lint does that. It may at least >

Re: Lists And Extra Commas at end

2019-12-24 Thread Marco Sulla via Python-list
On Tue, 24 Dec 2019 at 22:51, Avi Gross via Python-list wrote: > So, is that a feature you want warnings about? After all, a dangling comma > may simply mean you left something out and meant to add later? .completely OT. I responded to a topic named "List and missing commas", and suggested a

Re: Lists And Extra Commas at end

2019-12-24 Thread Cameron Simpson
On 24Dec2019 16:48, Avi Gross wrote: Let me switch gears to the terminal comma situation. Unlike many languages, Python decided a dangling comma is perfectly allowable in many situations, perhaps all. a=[1,2,3,] a [1, 2, 3] [...] And, of course, you can use the same dangling comma in makin

Lists And Extra Commas at end

2019-12-24 Thread Avi Gross via Python-list
Marco, Python is used by some in an interactive mode but also in more of a batch mode such as on a server. The former can possibly see a SyntaxWarning. Do you want that as a default or something you set when you start the Python Interpreter or perhaps a command within it? I note a brief search

Re: Most elegant way to do something N times

2019-12-24 Thread Marco Sulla via Python-list
On Tue, 24 Dec 2019 at 01:07, Chris Angelico wrote: > On Tue, Dec 24, 2019 at 10:45 AM Marco Sulla <...> wrote: > > ??? Excuse me, but why you needed to call the same function SIX times? This > > seems to me not elegant in primis. > > > > Can you give us a practical example? > > File parsing. You

Re: Lists And Missing Commas

2019-12-24 Thread Ethan Furman
On 12/24/2019 10:02 AM, Avi Gross via Python-list wrote: This being Python (which lies about how there should be one unique way to logically do something) The koan is: There should be one-- and preferably only one --obvious way to do it. It is not: - only one way - one unique way - the on

RE: Lists And Missing Commas

2019-12-24 Thread Avi Gross via Python-list
As a purist, it makes people uncomfortable if all 'objects' are not treated alike. But I look at the question from a definition and parsing mechanism view. When an interpreter (or compiler) reads a program, it often does it in phases and tries to tokenize parts. So, the definition of something o

Re: [ANN] Retrospective of Python compilation efforts

2019-12-24 Thread Guido van Rossum
Nice work. On Tue, Dec 24, 2019 at 2:59 AM Paul Sokolovsky wrote: > Hello, > > Over the years, the Python community produced many compiler projects for > the language, second to probably only C and LISP. Majority are of > course of research and proof of concept quality, but there're a number > o

Re: Lists And Missing Commas

2019-12-24 Thread Richard Damon
On 12/24/19 10:45 AM, Tim Daneliuk wrote: On 12/24/19 6:37 AM, Stefan Ram wrote: And you all are aware that this kind of string concatenation happens in C and C++, too, aren't you? main.c #include int main( void ){ puts( "a" "b" ); } transcript ab Noting that it has been a long

Re: Lists And Missing Commas

2019-12-24 Thread Tim Daneliuk
On 12/24/19 6:37 AM, Stefan Ram wrote: > And you all are aware that this kind of string concatenation > happens in C and C++, too, aren't you? > > main.c > > #include > int main( void ){ puts( "a" "b" ); } > > transcript > > ab Noting that it has been a long time since I looked at the