[Python-Dev] Adding syntax for units of measure

2009-06-23 Thread Tobias C. Rittweiler
Hi! Has anyone added special syntax to allow writing numeric literals with physical units? So you can write 12m + 34cm, and would get 12.34m. My question is how would you modify the BNF the most sensible way to allow for this? The above example is simple, but think of 42 km/h. (For my

Re: [Python-Dev] Adding syntax for units of measure

2009-06-23 Thread Terry Reedy
Tobias C. Rittweiler wrote: Has anyone added special syntax to allow writing numeric literals with physical units? So you can write 12m + 34cm, and would get 12.34m. Python-dev is for concrete discussion of development of the next versions. Questions and speculative discussion should

Re: [Python-Dev] Adding syntax for units of measure

2009-06-23 Thread Christian Heimes
Tobias C. Rittweiler schrieb: Hi! Has anyone added special syntax to allow writing numeric literals with physical units? So you can write 12m + 34cm, and would get 12.34m. My question is how would you modify the BNF the most sensible way to allow for this? The above example is simple, but

Re: [Python-Dev] Adding syntax for units of measure

2009-06-23 Thread Georg Brandl
Tobias C. Rittweiler schrieb: Hi! Has anyone added special syntax to allow writing numeric literals with physical units? So you can write 12m + 34cm, and would get 12.34m. My question is how would you modify the BNF the most sensible way to allow for this? The above example is simple, but

Re: [Python-Dev] Adding syntax for units of measure

2009-06-23 Thread skip
Has anyone added special syntax to allow writing numeric literals with physical units? So you can write 12m + 34cm, and would get 12.34m. ... Georg normally you wouldn't add units to the language itself. ... Georg For the interactive shell, using a wrapper that allows