Annoying octal notation
Derek Martin
code at pizzashack.org
Mon Aug 24 09:56:48 EDT 2009
On Sun, Aug 23, 2009 at 01:13:32PM +0000, Matthew Woodcraft wrote:
> Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
> > About the only place one commonly sees leading zeros on decimal
> > numbers, in my experience, is zero-filled COBOL data decks (and since
> > classic COBOL stores in BCD anyway... binary (usage is
> > computational/comp-1) was a later add-on to the data specification model
> > as I recall...)
>
> A more common case is dates.
I suppose this is true, but I can't remember the last time I
hard-coded a date in a program, or worked on someone else's code with
hard-coded dates. I'm fairly certain I've never done it, and if I
had, I obviously would not have used leading zeros. I think
hard-coding dates is more uncommon than using octal. ;-) [It
unquestionably is, for me personally.] I tend to also discount this
example, because when we write dates with leading zeros, usually it's
in some variation of the form 08/09/2009, which, containing slashes,
is a string, not a number, and can not be used as a date literal in
any language I know. We do it for reasons of format, which again
implies that it has more the characteristics of a string than of a
number. To use such a thing in any programming language I can think
of would require translation from a string.
> I've seen people trip over this writing things like
>
> xxx = [
> date(2009, 10, 12),
> date(2009, 12, 26),
> date(2010, 02, 09),
> ]
I've never seen anyone do this (no doubt because it would be an
error), but as I said, I don't think I've ever seen hard-coded dates
in any programs I've worked on. I've never encountered anyone having
problems with octals who was not a total noob at programming. The
changing of this syntax seems like much ado about nothing to me, and
as such is annoying, consider that I use it very often.
--
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20090824/9e1f1836/attachment-0001.sig>
More information about the Python-list
mailing list