[Tutor] interactive naming of pointers

chris Hynes cjhynes36 at hotmail.com
Thu Jul 16 16:38:36 CEST 2009

Yeah, I'm not sure if I'm explaining myself well or maybe I'm just trying to make the code too interactive.

in my code I would type something like:


so the pointer called "x" is created by the programmer, but within the code. What if I wanted to prompt my keyboard user to type in a word, like "Chris" and then the program would create:


Whatever code could make this happen I could loop through it several times, create various array names, and when the operator was done, they would have several arrays created with names of their choosing. When I'm in ipython mode, I would have to type Chris=zeros((3,3)), then Bob=zeros((3,3)) and then Kent=zero((3,3)), three separate statements (and gosh what if I wanted more than just these three?). I want my user to create names for their pointers instead of it already being in the code.

> I'm not sure you have really thought this through. The user typed
> "Chris", and that value is stored in 'name'. It might just as well
> have been "Bob" or "Kent". So you can't really say
>   print Chris
> you need something like
>   print the_thing_called(name)
> which you might as well spell as
>   print values[name]
> Kent

Windows Live™ SkyDrive™: Get 25 GB of free online storage.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090716/22bdb15f/attachment.htm>

More information about the Tutor mailing list