Re: [Tutor] Need help wrapping my head around duck typing

2011-05-24 Thread Cory Teshera-Sterne
Hmm ... I thought I was going to try to keep this as general as possible, but it may be more helpful if I gave a more concrete example. The code below is the existing function; I'd be ok with throwing it out & starting over, but originally thought I could modify it fairly easily. The directory str

Re: [Tutor] Need help wrapping my head around duck typing

2011-05-24 Thread Wayne Werner
On Tue, May 24, 2011 at 9:17 PM, Cory Teshera-Sterne wrote: > Hello, > > Thanks for the input. I guess you're right, this is more of a case of > argument assertion - but then I'm not sure how to do error handling here, > because, for example, multiple issues that should be dealt with in very > dif

Re: [Tutor] Need help wrapping my head around duck typing

2011-05-24 Thread Cory Teshera-Sterne
Hello, Thanks for the input. I guess you're right, this is more of a case of argument assertion - but then I'm not sure how to do error handling here, because, for example, multiple issues that should be dealt with in very different ways could raise the same error (as in the original example). I'

Re: [Tutor] Need help wrapping my head around duck typing

2011-05-24 Thread Izz ad-Din Ruhulessin
I forgot to mention strptime 2011/5/25 Izz ad-Din Ruhulessin > Hi Cory, > > From your description it seems to me that your case is more one of > asserting that your function received valid arguments, than a matter of > stat

Re: [Tutor] Need help wrapping my head around duck typing

2011-05-24 Thread Izz ad-Din Ruhulessin
Hi Cory, >From your description it seems to me that your case is more one of asserting that your function received valid arguments, than a matter of static-vs-ducktyping. Even with type checking, they can still generate errors (out of bounds, incorrect formatting). Now i've seen some discussions

[Tutor] Need help wrapping my head around duck typing

2011-05-24 Thread Cory Teshera-Sterne
Hi folks, Coming from a language background that has a different approach to variables (*cough* Java *cough*), I'm trying to understand Python's typing conventions and how to deal with unknown variable types in my code. And as a newbie, I'm really concerned with not writing code that will make the