[Python-Dev] Validators (was Re: Python-Dev Digest, Vol 9, Issue 17)

Josiah Carlson jcarlson at uci.edu
Mon Apr 5 22:06:47 EDT 2004


> >Please note that you seem to be using the syntax ``type: variable''.
> >We've settled on using ``variable: type'' instead.  (How to express
> >types is quite a different story...)
> >
> I haven't been following the thread on the subject much at all, I've 
> just heard some rumbling about introducing static typing into python, 

Python is not going to have static typing as a part of the base language,
so worry not.

> and frankly I'm a bit wary about the whole thing. I was just thinking 
> that in keeping with python's dynamic nature that something more like a 
> generalized way of validating the _nature_ of something as opposed to 
> it's underlying *type* would be more appropriate. It's just that it 

How do you propose to get at the "nature" of what an object is? 
Currently in Python, we really only have types to determine what an
object is.  With that, we /can/ do per-call checks on the types of the
input, heck, if we're smart, we can even do polymorphism.  Such a
solution is doable in current Python with various approaches.  Making a
decorator that would handle type checking and polymorphism has been
provided here already, or we can go a class-based route to do the same
thing, though not nearly as neat.

Still, what do you mean by the "nature" of what something is?

 - Josiah

More information about the Python-Dev mailing list