Everyone in this thread should absolutely read Lewis Caroll's delightful
and "What the Tortoise Said to Achilles." It's a very short 3-page story
that addressed exactly this topic in 1895... even before Guido's Time
Machine.
One free copy of the public domain work is at:
Dear Developers,
After some findings and further thoughts through this thread, I have
formulated a proposal as follows. (I thank everyone who has commented
in this thread). For the necessary definitions, please look at
https://docs.python.org/3/reference/expressions.html#subscriptions
On 2021-08-23 01:28, Steven D'Aprano wrote:
On Sun, Aug 22, 2021 at 07:01:28PM +0300, Serhiy Storchaka wrote:
(len(collection) == 0) is True
Ha ha, yes, very good, you got me. But the trouble is, if you don't
trust the truth value of the predicate, it is hard to know when to
stop:
On Sun, Aug 22, 2021 at 07:01:28PM +0300, Serhiy Storchaka wrote:
> (len(collection) == 0) is True
Ha ha, yes, very good, you got me. But the trouble is, if you don't
trust the truth value of the predicate, it is hard to know when to
stop:
len(collection) == 0
(len(collection) ==
Sorry, the formatting was terrible. I copy and pasted it from the original
issue without really thinking about it.
Here's the same thing, but actually readable:
In _collections_abc.py is a private function titled _check_methods(). It
takes a class and a number of method names (as strings), checks
While this does comply with "explicit is better than implicit", there's
another line of the Zen of Python that this idea definitely violates:
"There should be one-- and preferably only one-- obvious way to do it."
(Followed by the line "Although that way may not be obvious at first...",
which I'd
On Sun, Aug 22, 2021, 1:07 PM MRAB wrote:
> On 2021-08-22 17:36, Thomas Grainger wrote:
> > bool((len(collection) == 0) is True) == True and issubclass(True, bool)
> >
> 'True' is a reserved word, so you don't need to check it.
>
> However, 'bool' might have been overridden, so:
>
>
On 2021-08-22 17:36, Thomas Grainger wrote:
bool((len(collection) == 0) is True) == True and issubclass(True, bool)
'True' is a reserved word, so you don't need to check it.
However, 'bool' might have been overridden, so:
__builtins__.bool((len(collection) == 0) is True) == True
Come to
bool((len(collection) == 0) is True) == True and issubclass(True, bool)
On Sun, 22 Aug 2021, 17:09 Valentin Berlier, wrote:
> > (len(collection) == 0) is True
>
> bool((len(collection) == 0) is True) == True
> ___
> Python-ideas mailing list --
> (len(collection) == 0) is True
bool((len(collection) == 0) is True) == True
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
22.08.21 16:27, Steven D'Aprano пише:
> Quoting the subject line:
>
> "We should have an explicit concept of emptiness for collections"
>
> We do. It's spelled:
>
> len(collection) == 0
>
> You can't get more explicit than that.
(len(collection) == 0) is True
Quoting the subject line:
"We should have an explicit concept of emptiness for collections"
We do. It's spelled:
len(collection) == 0
You can't get more explicit than that.
--
Steve
___
Python-ideas mailing list -- python-ideas@python.org
To
On Sun, Aug 22, 2021 at 10:28 PM Tim Hoffmann via Python-ideas
wrote:
>
> Hi all,
>
> The Programming Recommendations section in PEP-8 states
>
> "For sequences, (strings, lists, tuples), use the fact that empty sequences
> are false:"
>
> # Correct:
> if not seq:
> if seq:
>
> # Wrong:
Hi all,
The Programming Recommendations section in PEP-8 states
"For sequences, (strings, lists, tuples), use the fact that empty sequences are
false:"
# Correct:
if not seq:
if seq:
# Wrong:
if len(seq):
if not len(seq):
In the talk "When Python Practices Go Wrong" Brandon
On 2021-08-22 11:51, Matsuoka Takuo wrote:
Dear developers,
According to the Language Reference, a starred expression is defined
by
starred_expression ::= expression | (starred_item ",")* [starred_item]
https://docs.python.org/3/reference/expressions.html#expression-lists
However, in
Dear developers,
According to the Language Reference, a starred expression is defined
by
starred_expression ::= expression | (starred_item ",")* [starred_item]
https://docs.python.org/3/reference/expressions.html#expression-lists
However, in view of the definition of an assignment statement
16 matches
Mail list logo