Suggested coding style
Tim Johnson
tim at akwebsoft.com
Sun Sep 25 14:46:14 EDT 2011
* Devin Jeanpierre <jeanpierreda at gmail.com> [110924 19:07]:
> > Padding numbers with leading zeroes is very common. I'm surprised that
> > more languages don't make it a string method.
>
> By making it a string method, instead of a function, we force all
> implementations of strings to implement that method. That sort of
> sucks, and it's a reason not to include it as a method.
Why does it suck? And why do people say 'suck' so much, especially
in technical venues?
:) Just answer the first question, the second is rhetorical. I
think that your answer, regardless of whether I agree with it may
edify me serendipitously.
> It can, after all, be implemented as a function, and in doing so
> (with the appropriate operator overloading) that function could
> work with multiple implementations of strings. Instead any
> implementation of a string must implement that method. That's a
> waste.
I'm not sure what you mean. I've written my own `split' function. I
don't believe that there would be any conflict if you wrote your
own `zfill' function. Or if there would be, I'd want to know before
I hurt myself.
regards
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
More information about the Python-list
mailing list