Implicit conversion to boolean in if and while statements
rantingrickjohnson at gmail.com
Tue Feb 12 05:24:41 CET 2013
On Monday, February 11, 2013 7:52:24 AM UTC-6, Chris Angelico wrote:
> But my statement wasn't based on my own knowledge of the stdlib, but
> rather on this:
> On Sat, Feb 9, 2013 at 6:58 AM, Rick Johnson wrote:
> > I'm a bit unnerved by the sum function. Summing a
> > sequence only makes sense if the sequence in question
> > contains /only/ numeric types. For that reason i decided
> > to create a special type for holding Numerics.
> Why create a special type if it already exists?
Because at the time i made this statement we were discussing 100% true OOP (you know, the kind of paradigm where object definition identifiers start with a capital letter? *estoeric-wink*), but more importantly because i don't find the current implementation of array and list to be consistent.
> Yep. By the way, how does the help function fit into your wonderfully
> OOP model? What's it a method on?
Well since /all/ objects will have help available it should be defined Object#help and then propagate downwards. But even true OOP languages need a few global functions... *gasp*... oh yes! A few that come to mind include:
globals, locals, vars, compile, eval, exec, input, print, dir
And don't forget, we still have module namespace to deal with!
More information about the Python-list