1 view

Skip to first unread message

May 7, 2009, 10:01:35 AM5/7/09

to sage-devel

Dear Devel,

I am hoping to help the push to 75% by adding some doctests to some of

the plotting primitives. But for some reason, the following always

occurs:

sage: G = some graphics object

sage: G == loads(dumps(G))

False

Nonetheless, no matter how hard I try, I cannot actually find a

difference between G and loads(dumps(G)) when I view both of them,

look at xmin(), options(), etc. Why aren't they ==?

In any case, in plot.py and plot_field.py this is already worked

around by

sage: G = plot(something)

sage: H = loads(dumps(G))

so I'll go with that if there are no objections, but I would much

prefer == if possible. Incidentally, sage -coverage does not complain

about the current H=loads(dumps(G)) test.

Thanks,

- kcrisman

I am hoping to help the push to 75% by adding some doctests to some of

the plotting primitives. But for some reason, the following always

occurs:

sage: G = some graphics object

sage: G == loads(dumps(G))

False

Nonetheless, no matter how hard I try, I cannot actually find a

difference between G and loads(dumps(G)) when I view both of them,

look at xmin(), options(), etc. Why aren't they ==?

In any case, in plot.py and plot_field.py this is already worked

around by

sage: G = plot(something)

sage: H = loads(dumps(G))

so I'll go with that if there are no objections, but I would much

prefer == if possible. Incidentally, sage -coverage does not complain

about the current H=loads(dumps(G)) test.

Thanks,

- kcrisman

May 7, 2009, 12:32:43 PM5/7/09

to sage-...@googlegroups.com

On Thu, May 7, 2009 at 7:01 AM, kcrisman <kcri...@gmail.com> wrote:

> I am hoping to help the push to 75% by adding some doctests to some of

> the plotting primitives. But for some reason, the following always

> occurs:

>

> sage: G = some graphics object

> sage: G == loads(dumps(G))

> False

>

> Nonetheless, no matter how hard I try, I cannot actually find a

> difference between G and loads(dumps(G)) when I view both of them,

> look at xmin(), options(), etc. Why aren't they ==?

> I am hoping to help the push to 75% by adding some doctests to some of

> the plotting primitives. But for some reason, the following always

> occurs:

>

> sage: G = some graphics object

> sage: G == loads(dumps(G))

> False

>

> Nonetheless, no matter how hard I try, I cannot actually find a

> difference between G and loads(dumps(G)) when I view both of them,

> look at xmin(), options(), etc. Why aren't they ==?

Because graphics objects don't implement equality (there are no __eq__

or __cmp__ methods defined), so the default implementation is used,

which is "is" (object identity, pointer equality).

Carl

May 7, 2009, 12:45:11 PM5/7/09

to sage-...@googlegroups.com

Ergo, you should implement __cmp__.

William

May 7, 2009, 1:06:20 PM5/7/09

to sage-devel

> > Because graphics objects don't implement equality (there are no __eq__

> > or __cmp__ methods defined), so the default implementation is used,

> > which is "is" (object identity, pointer equality).

>

> > Carl

>

> Ergo, you should implement __cmp__.

Umm... how would I do that? Or is "you" cwitty? Maybe if one of you
> > or __cmp__ methods defined), so the default implementation is used,

> > which is "is" (object identity, pointer equality).

>

> > Carl

>

> Ergo, you should implement __cmp__.

pointed me to a "good" implementation of __cmp__ for a similar type of

object, that would be helpful.

I don't know that I could do that in time for 4.0, though, so I'll

keep working on the other stuff with current loads(dumps()) behavior,

since it is already in two of the plot files.

Thanks for any other input,

- kcrisman

May 7, 2009, 2:46:13 PM5/7/09

to sage-...@googlegroups.com

On Thu, May 7, 2009 at 10:06 AM, kcrisman <kcri...@gmail.com> wrote:

>

>> > Because graphics objects don't implement equality (there are no __eq__

>> > or __cmp__ methods defined), so the default implementation is used,

>> > which is "is" (object identity, pointer equality).

>>

>> > Carl

>>

>> Ergo, you should implement __cmp__.

>

> Umm... how would I do that? Or is "you" cwitty? Maybe if one of you

> pointed me to a "good" implementation of __cmp__ for a similar type of

> object, that would be helpful.

>

>> > Because graphics objects don't implement equality (there are no __eq__

>> > or __cmp__ methods defined), so the default implementation is used,

>> > which is "is" (object identity, pointer equality).

>>

>> > Carl

>>

>> Ergo, you should implement __cmp__.

>

> Umm... how would I do that? Or is "you" cwitty? Maybe if one of you

> pointed me to a "good" implementation of __cmp__ for a similar type of

> object, that would be helpful.

You = somebody :-)

> I don't know that I could do that in time for 4.0, though, so I'll

> keep working on the other stuff with current loads(dumps()) behavior,

> since it is already in two of the plot files.

Yep, if you don't know how to implement __cmp__, then just don't

implement the loads(dumps(...))) doctests at all.

William

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu