Re[2]: why is print a function

Lenard Lindstrom <[email protected]> Mon, 26 Jul 2004 19:29:03 -0700 (Pacific Daylight Time)
Newsgroups gmane.comp.lang.prothon.user
Message-ID <Mahogany-0.66.0-4294505119-20040726-201230.00@pop3.norton.antivirus>
On Mon, 26 Jul 2004 14:08:53 -0700 Mark Hahn <[email protected]> wrote:

> Martin Christensen wrote:
> 
> >>>>>> "Mark" == Mark Hahn <[email protected]> writes:
> >Mark> I have some vague idea that the only keywords should be 
> >ones that 
> >Mark> have code blocks, but if that is true should raise, assert, etc. 
> >Mark> be functions also?
> >
> >That would certainly make them easier to override. That's the 
> >only argument I can think of off the top of my head that 
> >hasn't to do with aesthetics.
> 
> Good point!  That may be the only reason.  You could override it and then
> call the original when you want to from the overriding version.  This would
> apply to the other keywords also.
> 
> def print(*args, **kwargs):
>     blah blah blah
>     Object.print(*args, **kwargs)
> 
> 
> I was thinking it might be so you could use it in a generator or something
> but that seemed silly.  That would be encouraging bad coding style.
> 
It also lets print be used as a callback.

Lenard Lindstrom
<[email protected]>