Reference

Marko Rauhamaa marko at pacujo.net
Wed Mar 5 21:46:29 CET 2014


Grant Edwards <invalid at invalid.invalid>:

> Wrong. If the two objects are not the same, then they will have
> different ID values. If the ID values are the same, then you've only
> got one object.

Ok, that circularity again.

Say I implement Python. Say I returned a random number for id(), how
would that violate the language spec?

It would violate the spec. But there would have to be a paragraph in the
specification that was violated or a reference test case that failed.

For example, this test would demonstrate obviously invalid behavior:

   >>> print(id(x))
   129
   >>> print(id(x))
   201

> I'm sorry, what problem are you trying to solve?

I think the discussion spawned from the problem of teaching programming
students the right idea of values and objects. A teacher would like to
bring in advanced concepts last, but Python seems to force you to get
them at the very beginning.


Marko



More information about the Python-list mailing list