[IPython-dev] IPython traitlet problem

Robert McGibbon rmcgibbo@gmail....
Sun Apr 21 14:26:40 CDT 2013


I would be +1 on allowing position arguments to the constructor, if its that easy.
This feature/bug has bitten me before, which is why I remembered that error
message.

In general, with traitlets, you really end up moving a lot of logic out of the __init__
method, and into _X_changed or _X_default, so it doesn't end up being that important.

-Robert

On Apr 21, 2013, at 6:17 AM, Robert Kern wrote:

> On 2013-04-21 16:43, Thomas Kluyver wrote:
>> For what it's worth, Python 3 introduces keyword-only arguments, which can be
>> required arguments. That's specified as part of the function signature, though;
>> I agree that this limitation in traitlets isn't ideal.
> 
> It's relatively easily fixed. Just include *args in the __new__() and __init__() 
> and ignore them.
> 
> I don't recall, but this might have been an explicit design choice for traitlets 
> in order to force the use of keyword arguments exclusively. It is a deviation 
> from Traits behavior.
> 
> -- 
> Robert Kern
> 
> "I have come to believe that the whole world is an enigma, a harmless enigma
>  that is made terrible by our own mad attempt to interpret it as though it had
>  an underlying truth."
>   -- Umberto Eco
> 
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list