Re: Re: re-symboling an object
[email protected] Sat, 31 Jul 2004 14:07:16 -0400
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mark Hahn <[email protected]> wrote: >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). > that imports the "chien" object? but it doesn't rename it. i'd of thought it just imported "sit" and called it "reposez_vous" what i had intended was to import chien, change its name, and any or all of its contents at once. >> # 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. > yes, if file gets imported too. but wouldn't you have to repeat it for every symbol you wanted renaming? >> ( 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. > shaddowing isn't the point if you want a different name, file might mean something different in some language. > Being a built-in just means it is already loaded. does that mean you could stop it being loaded? __________________________________________________________________ Switch to Netscape Internet Service. As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register Netscape. Just the Net You Need. New! Netscape Toolbar for Internet Explorer Search from anywhere on the Web and block those annoying pop-ups. Download now at http://channels.netscape.com/ns/search/install.jsp