About the implementation of del in Python 3

Marko Rauhamaa marko at pacujo.net
Thu Jul 6 18:56:03 EDT 2017


Chris Angelico <rosuav at gmail.com>:
> On Fri, Jul 7, 2017 at 7:10 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> Whether id() returns one such thing or not can't be discerned by a
>> Python program. What's more, for any compliant implementation of id(),
>> you can interpret the returned number as an address in some address
>> space (whether it's useful or not to interpret it that way).
>> And I can interpret "Marko Rauhamaa" as a MIME-encoded IPv6 address.
> Does that mean it is one?
>> 31:aae4::45ab:a16a:669a
>> This is clearly your identity, and your address.
>> [...]
>> I've no idea what you're saying here with all that concatenation and
> stuff, but the truth is way simpler. If the two sides are the same
> object, 'is' returns true. Seriously, what's not clear?

Google finds a Dutch master's thesis from 2009 that gives formal
semantics to a subset of Python. I was interested in seeing how it
treated identity. Lo and behold:
 The is operator determines whether its operands are the same object.
 This is achieved by comparing the addresses of the operands.
 <Θ, Γ, S|a[l] is ◦, a[r] >
 ⇒ <Θ, Γ, S , a[l] ≡ a[r]> (13.7)
 <URL: http://gideon.smdng.nl/wp-content/uploads/thesis.pdf> [p. 61/91]
(just sayin')
Marko


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /