Re: [sympy] Re: Subclassing Symbol and caching problem

2013-07-25 Thread Stefan Krastanov
Have you tried? I assure you, you can create classes with constructors which signature differs from the signature of the superclass constructor. Anyway, even if you prefer to use `__new__`, you still need to pay attention to the `args` attribute. Also, keep in mind that what you are doing mixes t

[sympy] Re: Subclassing Symbol and caching problem

2013-07-25 Thread Prasoon Shukla
Okay. So, this is what happens if I use __init__: Symbol.__new__ is called. Here's the definition: def __new__(cls, name, **assumptions): """Symbols are identified by name and assumptions:: As you can see, the method expects 2 positional arguments and rest are keyword arguments (the assu

Re: [sympy] Re: Subclassing Symbol and caching problem

2013-07-25 Thread Stefan Krastanov
> But, that's what's happening right now as well. Symbol.__new__ is called and it is cached. Therefore, the problem persists. Except that you will probably have the correct `args`. Check this first. I do not understand what is the issue with Symbol's __new__ could you show the code that actually

[sympy] Re: Subclassing Symbol and caching problem

2013-07-25 Thread Prasoon Shukla
@Stefan : Let us say I use __init__ instead. When I initialize a BaseScalar, since a __new__ method isn't defined, that means the __new__ of superclass (Symbol) will be called. But, that's what's happening right now as well. Symbol.__new__ is called and it is cached. Therefore, the problem pers