2to3 refactoring [was Re: Tuple parameter unpacking in 3.x]

Harald Luessen harald.luessen at gmx.de
Mon Oct 6 13:10:26 EDT 2008


On Sun, 05 Oct 2008 "Aaron \"Castironpi\" Brady" wrote:

>There's the possibility that the most important words should go first in 
>this case:
>
>result_flag__t
>
>But, I'll admit that other people could have learned different orders of 
>scanning words than I, especially depending on their spoken language 
>backgrounds.  A poll of the newsgroup isn't exactly academically 
>impartial sampling, but there aren't any better ways to make decisions, 
>are there?  (I think it would be easy to make either one a habit.)
>
>Here's the other option in the same context:
>
>def function(vocab_list, result_flag__t, max_value):
>     result, flag = result_flag__t
>     pass
>
>To be thorough, there's also a trailing double underscore option.
>
>def function(vocab_list, result_flag__, max_value):
>     result, flag = result_flag__
>     pass
>
>Which I don't recognize from any other usages, but I defer.  If there 
>aren't any, conditionally, I think this is my favorite.

t__result_flag and result_flag__t have the advantage that you can 
search for t__ or __t as start or end of a name if you want to 
find and change all these places in the source. You can compare 
it with the decision to use reinterpret_cast<long>(...) as a cast 
operator in C++. It is ugly but much easier to find than (long)...
A search for __ alone would have too many hits in Python.

Harald




More information about the Python-list mailing list