[Python-ideas] The "in"-statement

Calvin Spealman ironfroggy at gmail.com
Tue Nov 6 23:17:43 CET 2012


On Mon, Nov 5, 2012 at 2:28 PM, Markus Unterwaditzer <
markus at unterwaditzer.net> wrote:

> This is my first post on this mailinglist and i haven't lurked a long time
> yet,
> so please be gentle.
>
> While mocking objects, i got annoyed by the following code pattern i had to
> use when modifying multiple attributes on a single object::
>
>     obj.first_attr = "value"
>     obj.second_attr = "value2"
>
>     some_other = "lel"
>
> I thought it would be neat if i could do::
>
>     in obj:
>         first_attr = "value"
>         second_attr = "value2"
>
>     some_other = "lel"  # indenting this would cause it to appear as an
> attribute of obj
>

in obj_1:
    in obj_2:
        a = b

Tell me what this does, then.


> Just a vague idea. Tell me what you think.
>
> -- Markus
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing:
http://www.twitter.com/ironfroggy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121106/81b3ac85/attachment.html>


More information about the Python-ideas mailing list