Python's "only one way to do it" philosophy isn't good?
Steve Holden
steve at holdenweb.com
Mon Jul 9 14:56:02 EDT 2007
Douglas Alan wrote:
> "Chris Mellon" <arkanes at gmail.com> writes:
[...]
>> The Python language reference explicitly does *not* guarantee the
>> behavior of the refcounter.
>
> Are you suggesting that it is likely to change? If so, I think you
> will find a huge uproar about it.
>
>> By relying on it, you are relying on an implementation specific,
>> non-specified behavior.
>
> I'm relying on a feature that has worked fine since the early '90s,
> and if it is ever changed in the future, I'm sure that plenty of other
> language changes will come along with it that will make adapting code
> that relies on this feature to be the least of my porting worries.
>
Damn, it seems to be broken on my Jython/IronPython installations, maybe
I should complain. Oh no, I can't, because it *isn't* *part* *of* *the*
*language*. ...
>> Exactly like you'd be doing if you rely on the value of
>> uninitialized variables in C.
>
> Exactly like I'd be doing if I made Unix system calls in my C code.
> After all, system calls are implementation dependent, aren't they?
> That doesn't mean that I don't rely on them every day.
>
That depends on whether you program to a specific standard or not.
>>> There are languages other than C that guarantee that values are
>>> initialized in certain ways. Are you going to also assert that in
>>> those languages you should not rely on the initialization rules?
>
>> Of course not. Because they *do* guarantee and specify that. C
>> doesn't, and neither does Python.
>
> CPython does by tradition *and* by popular will.
>
But you make the mistake of assuming that Python is CPython, which it isn't.
> Also the language reference manual specifically indicates that CPython
> uses a refcounter and documents that it collects objects as soon as
> they become unreachable (with the appropriate caveats about circular
> references, tracing, debugging, and stored tracebacks).
>
Indeed, but that *is* implementation dependent. As long as you stick to
CPython you'll be fine. That's allowed. Just be careful about the
discussions you get into :-)
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
More information about the Python-list
mailing list