Chaco and Templating?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Chaco and Templating?

Brennan Williams
Came across the following....

https://svn.enthought.com/enthought/wiki/TemplatesAndNumericContext

DId this go any further?

Brennan


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Chaco and Templating?

bryce hendrix-2
On 4/15/2010 7:11 PM, Brennan Williams wrote:
> Came across the following....
>
> https://svn.enthought.com/enthought/wiki/TemplatesAndNumericContext
>
> DId this go any further?
>    

Not really, Dave Morrill left the company a few months after the initial
demo. I'll hunt around for the demo though.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Traits List weird behavior

Giraudon Cyril
In reply to this post by Brennan Williams
Hello,

I try to use Traits List and I have a problem.
Consider the following classes :

class Child(HasTraits):
    name = Str

class ParentList_1_(HasTraits):
    children = List(Child)

class ParentList_2_(HasTraits):
    children = List("Child")

and the client code :

p = ParentList_1_()
c = Child(name="c")
p.children.append(c)
print c in p.children
-> True

p = ParentList_2_()
c = Child(name="c")
p.children.append(c)
print c in p.children
-> False

I use Traits 3.3.0 with python 2.6 on linux Ubuntu 9.04.

I don't understand this difference. Is it a normal behavior ?

Thanks a lot,

Best regards,

Cyril.



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Traits List weird behavior

Robert Kern
On Fri, Apr 16, 2010 at 11:17 AM, Giraudon Cyril <[hidden email]> wrote:

> Hello,
>
> I try to use Traits List and I have a problem.
> Consider the following classes :
>
> class Child(HasTraits):
>    name = Str
>
> class ParentList_1_(HasTraits):
>    children = List(Child)
>
> class ParentList_2_(HasTraits):
>    children = List("Child")

These are not correct uses of the List trait (or at least, they don't
do what you want them to do). You want List(Instance(Child)) and
List(Instance("Child")) instead.

--
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
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Traits List weird behavior

Giraudon Cyril
Le 16/04/2010 18:22, Robert Kern a écrit :

> On Fri, Apr 16, 2010 at 11:17 AM, Giraudon Cyril <[hidden email]> wrote:
>  
>> Hello,
>>
>> I try to use Traits List and I have a problem.
>> Consider the following classes :
>>
>> class Child(HasTraits):
>>    name = Str
>>
>> class ParentList_1_(HasTraits):
>>    children = List(Child)
>>
>> class ParentList_2_(HasTraits):
>>    children = List("Child")
>>    
> These are not correct uses of the List trait (or at least, they don't
> do what you want them to do). You want List(Instance(Child)) and
> List(Instance("Child")) instead.
>
>  
Oh sorry for this question...

Thank you

Cyril.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev