Trying again the following email, don't know if the list received it..

<rant>Who wrote translator_proto.py and the rest of the builtin's? And what about comments on the code, so someone can understand what is happening?</rant>

--------------------------------

Anyone,

in pyjs/builtin/_pyjs.js, in function $pyjs__class_instance(class_name, 
module_name), does anyone knows what is the purpose of this piece of code?

        if (cls_fn.__number__ !== null) {
            instance = cls_fn.__new__.apply(null, [cls_fn, arguments[0]]);
            args = arguments;
        }

For what I've been able to understand, the function $pyjs__class_instance is 
called when the class is being defined and also
when an object of a certain class is being created.

But if cls_fn.__number (as Luke said) is there to identify classes which are 
instances of numbers, so this piece of code is saying something like  "If you 
are an instance of a subclass of a number, only your first
argument matters", correct?

But that is not true at all! If I do something like:

        if (cls_fn.__number__ !== null&&  1==0) {
            instance = cls_fn.__new__.apply(null, [cls_fn, arguments[0]]);
            args = arguments;
        }

this piece of code is never called and the arguments pass alright and 
everything works fine again, as far as I could test..

Anyone knows something about this?!


Thanks,
João Ventura

Reply via email to