two ideoms at one blow: line-reading and regexp-matching
Jeff Shannon
jeff at ccvcorp.com
Wed Feb 20 14:10:40 EST 2002
Paul Rubin wrote:
> "Sean 'Shaleh' Perry" <shalehperry at attbi.com> writes:
> > this is a design decision in the language. By not allowing this style of
> > programming we do not have the ever so fun:
> >
> > if foo = 2:
> > handle_foo()
> >
> > type bugs. Sure there are ways around it.
>
> So why are augmented assignments not allowed in expressions?
>
> if (foo += 2) < 7:
> handle_foo()
>
> doesn't seem likely be an =/== confusion.
Because the benefits of doing this are small compared to the detriment of
muddying the statement/expression distinction, perhaps? It would be a weird
special case, behaving differently from everything else in the language, and
therefore a wart.
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list