Re: re-symboling an object

Mark Hahn <[email protected]> Sat, 31 Jul 2004 09:25:36 -0700
Newsgroups gmane.comp.lang.prothon.user
Organization Hahn Creative Applications
Message-ID <[email protected]>
On Sat, 31 Jul 2004 10:40:12 -0400, [email protected] wrote:

> any comments on having a simple way of re-symboling an object?
> 
> examples;
> 
> #  to simplify reusing code in other languages
> 
> import foreign.library.chien as local.dog with sit as reposez-vous  

I don't understand what that statement does.  Why can't you just do "from
foreign.library.chien import sit as reposez_vous" ?  (Hyphens are not
allowed in a variable name).

> # or to help fit an interface, 
> 
> import file with readline as next_   # to make file an iterator

You can do "from file import readline as File.next_".  That would do what
you want.

> ( of course file is now built-in, which i'm not sure is a good idea, but thats another story.)

You can override File whether it is a built-in or not. Declaring a local
File object will shadow the built-in File.  Being a built-in just means it
is already loaded.