MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: namespaces

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121545] Re: namespaces
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Mon, 19 Sep 2011 07:05:27 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201109180813.EAA06414@smc.vnet.net>

The simplest is probably to wrap the call to Needs in Block, like this:

Block[{$ContextPath = $ContextPath}, Needs["Combinatorica`"]]

The net effect is that the value of $ContextPath is not modified globally while
Combinatorica` loads all right. You can then use the full names for its
functions
as you suggested.

Regards,
Leonid


On Sun, Sep 18, 2011 at 12:13 PM, Alan <alan.isaac at gmail.com> wrote:

> Newbie question (by example):
> How can I access KSubsets (which I believe is only in Combinatorica)
> without hiding the kernel's graph functions?  (I.e., I would like to be able
> access the Combinatorica functions *only* when I specify e.g.
> Combinatorica`KSubsets, so that  if e.g. I just use the short name Graph
> this refers to System`Graph.
>
> So I don't want to say e.g.
> Needs["Combinatorica`"]
> because then I cannot just use Graph to refer to System`Graph.
>
> Ideally, I'd like an equivalent to a name import from a Python package
> (e.g., ``from mypackage import myfunction``).
>
> Short of that, I thought about reordering the $ContextPath, but I'm not
> sure this is a good idea (or how to do it correctly).
>
> Hope that's clear enough.
>
> Thanks,
> Alan Isaac
>
>



  • References:
  • Prev by Date: Re: (x - 1) or (-1 + x)
  • Next by Date: Re: How create new style sheet- Mathematica 8
  • Previous by thread: Re: namespaces
  • Next by thread: 2 parameter bifurcation diagrams