RE: Tuple Comprehension ???

2023-02-20 Thread avi.e.gross
Tuples are immutable and sort of have to be created all at once. This does not jive well wth being made incrementally in a comprehension. And, as noted, the use of parentheses I too many contexts means that what looks like a comprehension in parentheses is used instead as a generator. If you reall

Re: why is a search thru a Tuple slower ? ---- (meaningless indentations)

2023-02-20 Thread Michael Torrie
On 2/20/23 18:01, Hen Hanna wrote: > is Comp.Lang.Python very active Fairly. Apparently the cool kids are using the Python Discourse forum. > why is a linear search thru a Tuple slower > (than thru a (corresponding) List ) ??? I cannot say, unfortunately.

Re: is [comprehension] the right word???

2023-02-20 Thread Michael Torrie
On 2/20/23 18:06, Hen Hanna wrote: > is [comprehension] the right word??? > > i swear i never heard the word before > getting into Python a few years ago. Seems as though the term was borrowed from formal mathematics set theory. A simple search reveals that the term "list comprehen

Re: Tuple Comprehension ???

2023-02-20 Thread Michael Torrie
On 2/20/23 20:36, Hen Hanna wrote: > For a while, i've been curious about a [Tuple Comprehension] I've never heard of a "Tuple comprehension." No such thing exists as far as I know. > So finally i tried it, and the result was a bit surprising... > > > X= [ x for x in range(10) ] > X= (

Tuple Comprehension ???

2023-02-20 Thread Hen Hanna
For a while, i've been curious about a [Tuple Comprehension] So finally i tried it, and the result was a bit surprising... X= [ x for x in range(10) ] X= ( x for x in range(10) ) print(X) a= list(X) print(a) -- https://mail.python.org/mailman/listinfo/python-list

Re: is [comprehension] the right word???

2023-02-20 Thread Hen Hanna
On Monday, February 20, 2023 at 5:45:39 PM UTC-8, Paul Rubin wrote: > Hen Hanna writes: > > is [comprehension] the right word??? > Yes, it comes from math, particularly set theory. An expression like > > { n | n:integer, n mod 2 = 0 } > > is called a set comprehension, and then one there deno

why is a search thru a Tuple slower ? ---- (meaningless indentations)

2023-02-20 Thread Hen Hanna
is Comp.Lang.Python very active why is a linear search thru a Tuple slower (than thru a (corresponding) List ) ??? sometimes, i 'd like to put meaningless indentations like i do (twice) below ( how ca

is [comprehension] the right word???

2023-02-20 Thread Hen Hanna
is [comprehension] the right word??? i swear i never heard the word before getting into Python a few years ago. What was it called in the Lisp (Scheme) world ok... in Common Lisp, (and MacLisp) it was Loop and Collect https://en.wikipedia.org/wiki/List_comprehension#Hi

Re: Add angle brackets for required args in argparse

2023-02-20 Thread Mark Bourne
scruel tao wrote: If we have the following code: ``` parser = argparse.ArgumentParser(description="test") parser.add_argument('path') ``` Run it without args, will get error message: ``` usage: test.py [-h] path test.py: error: the following arguments are required: path ``` However, I hope the