[Python-ideas] Introduce collections.Reiterable

Neil Girdhar mistersheik at gmail.com
Thu Sep 19 12:39:35 CEST 2013


That was just for illustration.  Here's the code I just fixed to use
Reiterable:

class Network:
    def update(self, nodes):
        nodes = Reiterable(nodes)
        super().update(self, nodes)
        for node in nodes:
            node.setParent(self)
            node.propertyValuesChanged.connect(self.modelPropertiesChanged)
        self.modelNodesAddedRemoved.emit()



On Thu, Sep 19, 2013 at 6:31 AM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 9/19/2013 4:59 AM, Neil Girdhar wrote:
>
>> Well, generators are iterable, but if you write a function like:
>>
>> def f(s):
>>       for x in s:
>>               do_something(x)
>>       for x in s:
>>               do_something_else(x)
>>
>
> This strikes me as bad design. It should perhaps a) be two functions or b)
> take two iterable arguments or c) jam the two loops together.
>
> --
> Terry Jan Reedy
>
>
> ______________________________**_________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/**mailman/listinfo/python-ideas<https://mail.python.org/mailman/listinfo/python-ideas>
>
> --
>
> --- You received this message because you are subscribed to a topic in the
> Google Groups "python-ideas" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/python-ideas/**OumiLGDwRWA/unsubscribe<https://groups.google.com/d/topic/python-ideas/OumiLGDwRWA/unsubscribe>
> .
> To unsubscribe from this group and all its topics, send an email to
> python-ideas+unsubscribe@**googlegroups.com<python-ideas%2Bunsubscribe at googlegroups.com>
> .
> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130919/4daf8d59/attachment.html>


More information about the Python-ideas mailing list