[Python-Dev] deprecating .pyo and -O

Steven D'Aprano steve at pearwood.info
Thu Jun 14 22:38:45 CEST 2012


Floris Bruynooghe wrote:
> On 14 June 2012 11:25, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> Honestly, I think the best option would be to deprecate .pyo files as
>> well as the useless -O option. They only cause confusion without
>> providing any significant benefits.
> 
> +1
> 
> But what happens to __debug__ and assert statements?  I think it
> should be possible to always put assert statements inside a __debug__
> block and then create -O a simple switch for setting __debug__ to
> False.  If desired a simple strip tool could then easily remove
> __debug__ blocks and (unused) docstrings.

So in other words, you want to keep the functionality of -O, but make it the 
responsibility of the programmer to write an external tool to implement it?

Apart from the duplication of effort (everyone who wants to optimize their 
code has to write their own source-code strip tool), that surely is only going 
to decrease the reliability and usefulness of Python optimization, not 
increase it.

-O may be under-utilized by programmers who don't need or want it, but that 
doesn't mean it isn't useful to those who do want it. -1 on deprecation.



-- 
Steven


More information about the Python-Dev mailing list