Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
throwaway110116
· 8y ago · 0 comments
not in python. exceptions for flow control are not looked down upon unless it’s gratuitous usage. many frameworks do exactly this.
Comments
[–]
icebraining
8y ago
Even the language itself does this: if a generator that is being processed by a for loop returns (rather than yield), the language will raise a StopIteration exception, which the for loop with catch and use as a signal that it should exit.
[–]
oneweekwonder
8y ago
Yes! the more I dive into general py libraries the more I see `try: import pylib2 except: pylib2 = None` etc,