Is An Element of a Sequence an Object?
Peter Otten
__peter__ at web.de
Mon Jun 5 05:50:57 EDT 2017
Thomas Jollans wrote:
> What I thought was going on was that single-character strings return
> self on [0], as they do on full-length slices.
>
>>>> c = 'δ'
>>>> c[0] is c
> False
>>>> c[:] is c
> True
>>>> c[0:1] is c
> True
>>>>
>
> I wonder why they don't do this...
Perhaps noone has found a use-case that would profit from this optimization,
straight-forward as it may be...
More information about the Python-list
mailing list