[Baypiggies] Question about breaking out of a loop

Hy Carrinski hcarrinski at gmail.com
Thu Jun 9 07:02:56 CEST 2011

Thank you for the advice. I have updated the gist to include each of
the suggestions and to serve as a set of examples rather than a
question. Finally, I found that this may be a good application for



On Tue, Jun 7, 2011 at 5:22 PM, Mark Voorhies <mvoorhie at yahoo.com> wrote:
> On Tuesday, June 07, 2011 05:03:26 pm Hy Carrinski wrote:
>> 2. I wrote the gist in order to answer the primary question:
>>     Is it an antipattern to change a datatype to cause an exception?
> A different way to phrase this might be:
>   What are reasonable sentinel patterns?
> In Python, None is a reasonable sentinel value in a container of references,
> in the same way that a null pointer is a reasonable sentinel value in C/C++.
> It is also reasonable to use an exception to handle an "exceptional" case of
> control flow (encountering the sentinel value), and you've shown that this
> doesn't introduce overhead in Python.
> So, I don't think there's anything inherently objectionable about your implementation
> (comments about premature optimization notwithstanding).  It might be useful to
> think of what you're doing as the special case: "marking a reference as null"
> rather than the more general and potentially hackier: "changing a datatype".
> Mark
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies

More information about the Baypiggies mailing list