I'm trying to validate some dragon arguments. Unless we find new stable typing in Python 3.0, what is the best way to go about this.
Here's an example of what I'm trying to do:
class A (object): @ acc (int, int, int) def __init __ (a, B, c): Close square b (a): @accepts (int, int, int, int) def __init __ (a, b, c, d): A.__ init __ (A, B, C)
As you can see the decorator is checking the type of input for my class, but I have to define all the arguments for the second class, which gets very bad when I have There are many levels of heritage i quad with some success I can use it, but it is not good enough for the type of investigation as above.
Basically I want to pop an argument from the Kuwaiti list and type it, then the rest is the parent, but do it in a very flexible and clean way.
Any suggestions?
Why not only define a any
value, and @accepts (any, any, any, integer) to decorate the subclass maker? Your decorator will not check the parameters marked with
any
and check all the arguments passed by the @accepts
subclasses on the Superclass constructor.
Comments
Post a Comment