Awful code of the week

Chris Angelico rosuav at gmail.com
Sun Aug 7 04:04:18 EDT 2016


On Sun, Aug 7, 2016 at 4:54 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Seen in the office IRC channel:
>
>
> (13:23:07) fred:     near_limit = []
> (13:23:07) fred:     near_limit.append(1)
> (13:23:07) fred:     near_limit = len(near_limit)
> (13:23:09) fred: WTF
>
>
>
> Speaks for itself.

The Real WTF is that it needs to have a type declaration.

near_limit: Union[int,list]

There, fixed.

ChrisA



More information about the Python-list mailing list