overriding built-ins

dan danbmil99 at yahoo.com
Tue Sep 30 00:49:05 EDT 2003


Thanks for the responses, and my apologies for getting the terminology
confused.  What I really should have asked is this:

* Is there any way to create your own statements?
and,
* if so, can they override the names of built-in statements such as
'print'?

To which the answers seem to be, no, and definitely not (with a strong
hint of "why would you ever want to do that"?)



danbmil99 at yahoo.com (dan) wrote in message news:<fbf8d8f2.0309281120.564ec9d5 at posting.google.com>...
> I really have two related questions.
> 
> 1) Is it possible (without recompiling and changing the core Python
> behavior) to write functions that utilize the same syntax as built-in
> functions?  IE, can I create a function that does this:
> 
> >>>printCaps "hello"          #note no parentheses
> HELLO
> 
> 
> 2) Is it possible to do this with the built-in keywords themselves, ie
> override functions such as print?
> 
> thanks in advance -




More information about the Python-list mailing list