Re: [sage-devel] dealing name clashes between spkgs

2010-02-15 Thread William Stein
On Mon, Feb 15, 2010 at 8:25 PM, Robert Bradshaw
 wrote:
> On Feb 15, 2010, at 7:52 PM, Dima Pasechnik wrote:
>
>> How  does one deal with name clashes?
>> E.g. a package (say, cvxopt) has its own "matrix" type,
>> so importing all of it into Sage without appropriate name substitution
>> makes a mess.
>>
>> Are there any guidelines one should follow?

I like the one at the bottom here:
--
sage: import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
...
Namespaces are one honking great idea -- let's do more of those!
--

Because of namespaces:

sage: import cvxopt
sage: cvxopt.matrix

cvxopt.matrix can happily coexist with sage matrices, numpy matrices,
maxima matrices, etc.

William

>
> The global namespace is already huge, and once something goes in it's hugely
> backwards incompatible to take it out. Typically we wouldn't import any of
> cvxopt directly into the global namespace, let alone all of it. The user can
> do "import cvxopt" themselves, as well as any functionality that uses/wraps
> it.
>
> As well as naming conflicts, another consideration is the widely different
> conventions and styles other packages use, while we try to provide a
> consistent interface.
>
> - Robert
>
> --
> To post to this group, send an email to sage-devel@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] dealing name clashes between spkgs

2010-02-15 Thread Robert Bradshaw

On Feb 15, 2010, at 7:52 PM, Dima Pasechnik wrote:


How  does one deal with name clashes?
E.g. a package (say, cvxopt) has its own "matrix" type,
so importing all of it into Sage without appropriate name substitution
makes a mess.

Are there any guidelines one should follow?


The global namespace is already huge, and once something goes in it's  
hugely backwards incompatible to take it out. Typically we wouldn't  
import any of cvxopt directly into the global namespace, let alone all  
of it. The user can do "import cvxopt" themselves, as well as any  
functionality that uses/wraps it.


As well as naming conflicts, another consideration is the widely  
different conventions and styles other packages use, while we try to  
provide a consistent interface.


- Robert

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org