Correct use of try,except and raise?

Roy Smith roy at panix.com
Sun Jul 13 09:38:45 EDT 2008


Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:

> If you are passing a sequence conceptually, then it's more Pythonic to
> pass it as a sequence explicitly::
> 
>     def __init__(self, items):
>         """ Call with e.g. Stack(["foo", "bar"]) """
>         self.stack = list(items)

I don't get this.  You're forcing a copy to be made of the list.  This 
changes the semantics of the original class, because the operations no 
longer change the original list.  That may or may not be what you want.  
It's a design decision, not a "doing it this way is more pythonic" kind of 
thing.



More information about the Python-list mailing list