Aliases ? No Aliases ? From Graph.predecessors to neighbors_in

3 views
Skip to first unread message

Nathann Cohen

unread,
Oct 8, 2009, 12:44:57 PM10/8/09
to Sage devel
Hello everybody !!!

Following http://groups.google.com/group/sage-devel/browse_thread/thread/bfeb9b1828a04350/10681dbb1f189b2f, I created a patch to change predecessors/successors to neighbors_in and neighbors_out.

It is available there : http://trac.sagemath.org/sage_trac/ticket/7157

Robert Miller thought it would be hard to just change these functions as some people may already have script using the old ones, which they would have to change if this patch was to be merged.

Our question is then :
* do we change them anyway ?
* Do we keep the old ones as copies ?
* Is there a good pythonic way to deprecate functions, and is this what we should do ?

Nathann

Jason Grout

unread,
Oct 8, 2009, 8:43:32 PM10/8/09
to sage-...@googlegroups.com

Do not just delete the functions. At least deprecate the functions
(there are lots of examples in the sage code of how to do this; just
search for "deprecation").

I'm okay with the functions sticking around and being aliases, since
they are such fundamental functions and are valid terminology. I'm also
okay with deprecating them if that's what everyone else thinks is best.

Jason

--
Jason Grout

Tom Boothby

unread,
Oct 8, 2009, 10:03:29 PM10/8/09
to sage-...@googlegroups.com
+1 to deprecation

Nicolas M. Thiery

unread,
Oct 9, 2009, 10:11:20 AM10/9/09
to sage-...@googlegroups.com

+1 for keeping them. I definitely see the point of limiting aliases,
but depending on the context I naturally want to use one or the
other of the two naming conventions.

Btw: what's the convention used in networkx?

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" <nth...@users.sf.net>
http://Nicolas.Thiery.name/

Robert Bradshaw

unread,
Oct 9, 2009, 1:25:06 PM10/9/09
to sage-...@googlegroups.com
On Oct 9, 2009, at 7:11 AM, Nicolas M. Thiery wrote:

> On Thu, Oct 08, 2009 at 07:03:29PM -0700, Tom Boothby wrote:
>> +1 to deprecation
>>

I think this is a case where aliases are very natural--they primary
advantage of neighbors_in/out seems to be tab completion, not
mathematical convention.

- Robert

Nathann Cohen

unread,
Oct 9, 2009, 2:36:00 PM10/9/09
to sage-devel
hmmm.... In everything I read, there are just mentions of out-
neighbors and in-neighbors. I can give you a hundred references using
these names, and I would be much more alarmed to give you one
reference using predecessors and successors...

Especially when for edges, you can type out<tab> and in<tab> to know
the corresponding functions..

Nathann

On Oct 9, 7:25 pm, Robert Bradshaw <rober...@math.washington.edu>
wrote:

Nicolas M. Thiery

unread,
Oct 10, 2009, 2:56:04 AM10/10/09
to sage-...@googlegroups.com
On Fri, Oct 09, 2009 at 11:36:00AM -0700, Nathann Cohen wrote:
>
> hmmm.... In everything I read, there are just mentions of out-
> neighbors and in-neighbors. I can give you a hundred references using
> these names,

Yup.

> and I would be much more alarmed to give you one reference using
> predecessors and successors...

Those are natural and are I have seen them used a lot whenever the
graph is acyclic and so more or less models a poset.

That's why I vote for both.

> Especially when for edges, you can type out<tab> and in<tab> to know
> the corresponding functions..

Which I feel puts the balance back for using the
English-correct version in-neighbours rather than neighbours-in.

By the way, I'd love to see g.*neighb*? work in the notebook.

Reply all
Reply to author
Forward
0 new messages