Fwd: PEP: add a `no` keyword as an alias for `not`
Karsten Hilbert
Karsten.Hilbert at gmx.net
Thu Aug 1 17:19:25 EDT 2019
On Thu, Aug 01, 2019 at 01:25:21PM -0700, Daniel Okey-Okoro wrote:
> Good point Calvin,
> ------------------------------------------------------------
> But in many cases, when people write `if not val` they're checking if the
> val is `None`
>
> i.e. `if val is None`, `if val == None`
>
> (so in effect it's kind of like they're checking if "something isn't there")
No. Something being None does not mean something isn't there.
Something isn't there if something isn't there:
hasattr(object_or_scope_to_check, 'name_of_attribute')
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
More information about the Python-list
mailing list