assignment expression peeve

Carl Banks imbosol at aerojockey.invalid
Wed Oct 15 20:07:23 EDT 2003


Paul Rubin wrote:
> Carl Banks <imbosol at aerojockey.invalid> writes:
>> >> The real reason is that assignment expressions lead to all kinds of
>> >> ugly and unreadable code.  This is because there is no linguistic
>> >> analogue for assignment as an expression.
>> > 
>> > Swell, tell me the linguistic analog for metaclasses.  Or should those
>> > be removed too?
>> 
>> Paragraph that defines some of its own words?
>> 
>> Seriously, you're comparing apples to oranges here.  I'm comparing
>> syntax here, and there's nothing syntactical about metaclasses.  If
>> you want to compare a class statement to natural language, that works.
> 
> Actually, assignment expressions happen in natural language too.  
> In English you could say "A guy named Bob walks into a bar".
> In Python with assignment expressions, you'd write
> 
>   bar.enter(bob := Guy())

No.  The English equivalent of "a=b" is "set a to b" or "let a equal
b" or something like that.  Your construction "a named b" completely
fails to communicate that a's value becomes the same as b's.

Again, apples and oranges.  You are comparing meanings, when the
problem is syntax.  "A guy named Bob walks into a bar" and
"bar.enter(bob := Guy())" might have the same meaning, but they use a
diffenent syntax to convey it.  And the latter uses a syntax with no
analogue in any natural language I know of.


-- 
CARL BANKS                   http://www.aerojockey.com/software

As the newest Lady Turnpot descended into the kitchen wrapped only in
her celery-green dressing gown, her creamy bosom rising and falling
like a temperamental souffle, her tart mouth pursed in distaste, the
sous-chef whispered to the scullery boy, "I don't know what to make of
her." 
          --Laurel Fortuner, Montendre, France 
            1992 Bulwer-Lytton Fiction Contest Winner




More information about the Python-list mailing list