cmd all commands method?

placid Bulkan at gmail.com
Sun Feb 18 22:08:45 EST 2007


On Feb 18, 8:59 pm, "Michele Simionato" <michele.simion... at gmail.com>
wrote:
> On Feb 18, 10:49 am, "placid" <Bul... at gmail.com> wrote:
>
> > On Feb 18, 7:17 pm, "Michele Simionato" <michele.simion... at gmail.com>
>
> > > Yes, he is talking about the cmd module:http://docs.python.org/dev/lib/Cmd-objects.html.
> > > However that module was never intended as a real interpreter, so
> > > defining variables
> > > as the OP wants would require some work.
>
> > >  Michele Simionato
>
> > How much work does it require ?
>
> Have you ever written an interpreter? It is a nontrivial job.
>
>         Michele Simionato

No i have never written an interpreter and i can just imagine how much
work/effort is needed to write something like that.

If anyone can provide a suggestion to replicate the following Tcl
command in Python, i would greatly appreciate it.

namespace eval foo {
    variable bar 12345
}

what this does is create a namespace foo with the variable bar set to
12345.

http://aspn.activestate.com/ASPN/docs/ActiveTcl/8.4/tcl/TclCmd/variable.htm

The code provided by Peter Otten is a good start for me. Cheers for
that!


Cheers




More information about the Python-list mailing list