?Why is 0e-6 invalid?

Pearu Peterson pearu at cens.ioc.ee
Fri Dec 22 02:37:31 EST 2000


On Thu, 21 Dec 2000, D-Man wrote:

> AFIAK scientific notation is [1-9]e-?[0-9]+
> (a 1 thru 9 followed by e followed by optional negative sign followed
> by any sequence of 0 thru 9)

Scientific notation in Python is a bit more involved:

[+-]?((\d+[.]\d*|[.]\d+|[1-9]+)[eE][+-]?\d+ # may not be a complete pattern

that allows to represent number `0' also.

Though, I don't understand why 0e-6 is invalid in Python, indeed.

Pearu




More information about the Python-list mailing list