Can global variable be passed into Python function?
Chris Angelico <rosuav at gmail.com>:
> id() is (if I recall correctly) supposed to return an integer in the
> native range
That restriction seems beyond the scope of the language definition.
Still, it can be trivially provided for.
> In any case, you'd need some way to pretend that every integer is
> really an object, so you'd need to define id(), the 'is' operator, and
> everything else that can work with objects, to ensure that they
> correctly handle this.
Trivial, I should say.
> It would be a reasonable performance improvement to use native
> integers for the small ones
Maybe. Point is, whether it's done this way or that is irrelevant from
the point of view of functional correctness. Whether an integer is an
object or not has absolutely nothing to do with the implementation of
And thus, Python variables are barely distinguishable from C variables.