Re: [sage-devel] Confusing documentation in element.pyx

2014-12-17 Thread Samuel Lelievre
Clemens Heuberger wrote:

 Am 2014-12-15 um 12:00 schrieb David Roe: 
  The difference is in how cpdef functions interact with Cython vs Python 
  classes.  If you want to override a cpdef method in a *Python* subclass 
 then you 
  must use def (of course).  But in a *Cython* subclass, you must use 
 cpdef.  If 
  you accidentally use def instead in a Cython class then it doesn't 
 actually 
  override the method in the base class. 
  David 

 thank you; I reworded the documentation to reflect that: 
 http://trac.sagemath.org/ticket/17480 
 The output is also visible at 
 
 https://www.math.aau.at/user/cheuberg/sage/doc/6.5.beta2-2-g225ee88/en/reference/structure/sage/structure/element.html#how-to-define-a-new-element-class
  

 Regards, CH


Hello! Your rewording mentions four relevant functions
but I can only see three listed.

Also, there is a typo: DD NOT for DO NOT.

We will take addition of RingElements as an example; all other
operators and classes are similar. There are four relevant functions.

def RingElement.__add__

cpdef RingElement._add_

For speed, there are also inplace version of the arithmetic commands.
DD NOT call them directly, they may mutate the object and will be called
when and only when it has been determined that the old object will
no longer be accessible from the calling function after this operation.

def RingElement._iadd_


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Confusing documentation in element.pyx

2014-12-17 Thread Clemens Heuberger
Am 2014-12-17 um 10:47 schrieb Samuel Lelievre:
 Hello! Your rewording mentions four relevant functions
 but I can only see three listed.

thank you, I forgot to change that after unifying two descriptions.

Fixed (http://trac.sagemath.org/ticket/17480 ).

 Also, there is a typo: DD NOT for DO NOT.

Fixed.

New output:

https://www.math.aau.at/user/cheuberg/sage/doc/6.5.beta2-4-g2e57cf9/en/reference/structure/sage/structure/element.html

Regards, CH

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Confusing documentation in element.pyx

2014-12-17 Thread Samuel Lelièvre
More thoughts.

0. It's good that you are refreshing this part of the documentation,
if only to update references to Pyrex to references to Cython!

1. Maybe it would be worth pointing to the subtle ways in which these
functions differ in names and in nature:

There are three relevant functions, with related names
(note the add vs iadd, and the single vs double underscores),
one of which has both a Python and a Cython version (note
the def vs cpdef).

and, in the paragraph about _add_, to insist once again
on the presence of the def and cpdef versions.

2. In the sentence

For speed, there are also inplace version of the arithmetic commands.

we want inplace versions (plural).

3. In the sentence

This is the function you should override to inplace implement addition
in a Python subclass of RingElement.

I would change to inplace implement addition to to implement
inplace addition.

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Confusing documentation in element.pyx

2014-12-17 Thread Vincent Delecroix
Hello,

Sorry to disturb. This discussion should go to the relevant ticket...

Vincent

2014-12-17 12:08 UTC+01:00, Samuel Lelièvre samuel.lelie...@gmail.com:
 More thoughts.

 0. It's good that you are refreshing this part of the documentation,
 if only to update references to Pyrex to references to Cython!

 1. Maybe it would be worth pointing to the subtle ways in which these
 functions differ in names and in nature:

 There are three relevant functions, with related names
 (note the add vs iadd, and the single vs double underscores),
 one of which has both a Python and a Cython version (note
 the def vs cpdef).

 and, in the paragraph about _add_, to insist once again
 on the presence of the def and cpdef versions.

 2. In the sentence

 For speed, there are also inplace version of the arithmetic commands.

 we want inplace versions (plural).

 3. In the sentence

 This is the function you should override to inplace implement addition
 in a Python subclass of RingElement.

 I would change to inplace implement addition to to implement
 inplace addition.

 --
 You received this message because you are subscribed to the Google Groups
 sage-devel group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sage-devel+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-devel@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-devel.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Confusing documentation in element.pyx

2014-12-17 Thread Samuel Lelievre
Vincent wrote:

 Sorry to disturb. This discussion should go to the relevant ticket...


You are right. I have now voiced my concerns there:
http://trac.sagemath.org/ticket/17480

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Confusing documentation in element.pyx

2014-12-16 Thread Clemens Heuberger
Am 2014-12-15 um 12:00 schrieb David Roe:
 The difference is in how cpdef functions interact with Cython vs Python
 classes.  If you want to override a cpdef method in a *Python* subclass then 
 you
 must use def (of course).  But in a *Cython* subclass, you must use cpdef.  If
 you accidentally use def instead in a Cython class then it doesn't actually
 override the method in the base class.
 David

thank you; I reworded the documentation to reflect that:
http://trac.sagemath.org/ticket/17480
The output is also visible at

https://www.math.aau.at/user/cheuberg/sage/doc/6.5.beta2-2-g225ee88/en/reference/structure/sage/structure/element.html#how-to-define-a-new-element-class

Regards, CH

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Confusing documentation in element.pyx

2014-12-15 Thread David Roe
The difference is in how cpdef functions interact with Cython vs Python
classes.  If you want to override a cpdef method in a *Python* subclass
then you must use def (of course).  But in a *Cython* subclass, you must
use cpdef.  If you accidentally use def instead in a Cython class then it
doesn't actually override the method in the base class.
David

On Tue, Dec 9, 2014 at 11:38 PM, Clemens Heuberger clemens.heuber...@aau.at
 wrote:


 In


 http://www.sagemath.org/doc/reference/structure/sage/structure/element.html#how-to-define-a-new-element-class
 ,

 I find the descriptions of _add_ very confusing, because it seems to imply
 that
 there are two versions of _add_, one of them as a def and the other as a
 cpdef. As it stands, it reads like a circular argument.

 def RingElement._add_: ... You should override _add_.  The default
 implementation of this function is to call _add_ .

 cpdef RingElement._add_ ... which will happen if no-one has supplied
 implementations of either _add_

 I think that it does not help that Pyrex is still mentioned instead of
 Cython.

 I opened ticket #17480 and, as a starter, pushed a branch correcting
 several
 ReST formatting issues.

 For the above descriptions, I do need help by someone who knows what is
 meant.

 Thanks, CH

 --
 You received this message because you are subscribed to the Google Groups
 sage-devel group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sage-devel+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-devel@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-devel.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Confusing documentation in element.pyx

2014-12-09 Thread Clemens Heuberger

In

http://www.sagemath.org/doc/reference/structure/sage/structure/element.html#how-to-define-a-new-element-class
,

I find the descriptions of _add_ very confusing, because it seems to imply that
there are two versions of _add_, one of them as a def and the other as a
cpdef. As it stands, it reads like a circular argument.

def RingElement._add_: ... You should override _add_.  The default
implementation of this function is to call _add_ .

cpdef RingElement._add_ ... which will happen if no-one has supplied
implementations of either _add_

I think that it does not help that Pyrex is still mentioned instead of Cython.

I opened ticket #17480 and, as a starter, pushed a branch correcting several
ReST formatting issues.

For the above descriptions, I do need help by someone who knows what is meant.

Thanks, CH

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.