Scott David Daniels wrote:
Tim Roberts wrote:
My favorite notation for this comes from Ada, which allows arbitrary
bases
from 2 to 16, and allows for underscores within numeric literals:
x23_bin : constant := 2#0001_0111#;
x23_oct : constant := 8#27#;
x23_dec : constant := 10#23#;
x2
Tim Roberts wrote:
My favorite notation for this comes from Ada, which allows arbitrary bases
from 2 to 16, and allows for underscores within numeric literals:
x23_bin : constant := 2#0001_0111#;
x23_oct : constant := 8#27#;
x23_dec : constant := 10#23#;
x23_hex : constant := 16#17#;
En Fri, 26 Oct 2007 23:28:31 -0300, Carl Banks <[EMAIL PROTECTED]>
escribi�:
> FYI: The $ sign is used to denote currency in many countries; as a
> rule of thumb countties that call their currency "dollars" or "pesos"
> use the $. So Mexico, Canada, Australia, much of Latin America, much
> of t
"Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
>"Paul Hankin" wrote:
>
>> Even clearer is not to allow octal literals :) Is there *any* use for
>> them?
>
>I tend to agree with this point of view - but I fear it will set up a howl
>of protest amongst the Brits who cut their teeth on 24 bit ICT/IC
MRAB <[EMAIL PROTECTED]> wrote:
>On Oct 27, 12:12 am, Ben Finney <[EMAIL PROTECTED]>
>wrote:
>> Matimus <[EMAIL PROTECTED]> writes:
>> > The trailing L [for 'long' literals] is going away in Python 3.0.
>>
>> Yes. On the other hand, we are gaining '0b' for binary literals,
>> to go along with
"Paul Hankin" wrote:
> Even clearer is not to allow octal literals :) Is there *any* use for
> them?
I tend to agree with this point of view - but I fear it will set up a howl
of protest amongst the Brits who cut their teeth on 24 bit ICT/ICL
equipment...
- Hendrik
--
http://mail.python.org
On 2007-10-27, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Sat, 27 Oct 2007 13:28:02 -0500, Tim Chase wrote:
>
Even clearer is not to allow octal literals :) Is there *any* use for
them?
>>>
>>> The mode argument to os.chmod.
>>
>> You mean instead of
>>
>> import this
>
Marc 'BlackJack' Rintsch wrote:
> On Sat, 27 Oct 2007 13:28:02 -0500, Tim Chase wrote:
>
>
Even clearer is not to allow octal literals :) Is there *any* use for
them?
>>> The mode argument to os.chmod.
>>>
>> You mean instead of
>>
>> import this
>> os.chmod(fi
On Sat, 27 Oct 2007 13:28:02 -0500, Tim Chase wrote:
>>> Even clearer is not to allow octal literals :) Is there *any* use for
>>> them?
>>
>> The mode argument to os.chmod.
>
> You mean instead of
>
> import this
> os.chmod(filename, os.R_OK | os.W_OK | os.X_OK)
>
> which explicitly (rath
>> Even clearer is not to allow octal literals :) Is there *any* use for
>> them?
>
> The mode argument to os.chmod.
You mean instead of
import this
os.chmod(filename, os.R_OK | os.W_OK | os.X_OK)
which explicitly (rather than implicitly) spells it out?
-tkc
--
http://mail.python.org/m
On Oct 27, 10:27 am, Paul Hankin <[EMAIL PROTECTED]> wrote:
> On Oct 27, 3:09 pm, MRAB <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Oct 27, 12:12 am, Ben Finney <[EMAIL PROTECTED]>
> > wrote:> Matimus <[EMAIL PROTECTED]> writes:
> > > > The trailing L [for 'long' literals] is going away in Python 3.0.
>
> Even clearer is not to allow octal literals :) Is there *any* use for
> them?
+1
I find that anything I have even the remotest inkling of using
octal for can be done just as easily with hex.
-tkc
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 27, 3:09 pm, MRAB <[EMAIL PROTECTED]> wrote:
> On Oct 27, 12:12 am, Ben Finney <[EMAIL PROTECTED]>
> wrote:> Matimus <[EMAIL PROTECTED]> writes:
> > > The trailing L [for 'long' literals] is going away in Python 3.0.
>
> > Yes. On the other hand, we are gaining '0b' for binary literals,
On Oct 27, 12:12 am, Ben Finney <[EMAIL PROTECTED]>
wrote:
> Matimus <[EMAIL PROTECTED]> writes:
> > The trailing L [for 'long' literals] is going away in Python 3.0.
>
> Yes. On the other hand, we are gaining '0b' for binary literals,
> to go along with '0o' for octal and '0x' for hexa
On Oct 26, 1:54 am, Lennart Benschop <[EMAIL PROTECTED]> wrote:
> My proposal:
> - Any decimal constant suffixed with the letter "D" or "d" will be
> interpreted as a literal of the Decimal type. This also goes for
> decimal constants with exponential notation.
There's nothing new here that ha
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
> assert 0b1 is 0x1
> That this doesn't raise `AssertionError` is an implementation detail.
> It's not guaranteed the two objects are really the same.
I think Ben is getting at 0b1 and 0x1 being the same type, while the
proposed 0d1 is a d
On Fri, 26 Oct 2007 19:29:47 -0400, J. Cliff Dyer wrote:
> Ben Finney wrote:
>> So, the original poster might get further by proposing an '0dNNN.NNN'
>> syntax for 'decimal.Decimal' literals.
> It would rather be remarkably inconsistent and confusing.
>
> Python 3.0a1 (py3k:57844, Aug 31 2007,
"Shane Geiger" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
a buggy hack (copying your top post style)
>>> D(123456789.123456789)
Decimal("123456789.123")
Or what there an unwritten :-)?
| D = lambda x: decimal.Decimal(str(x))
|
| >> D(3.2)
| Decimal("3.2")
--
http://mail.
On Oct 26, 7:17 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote:
> Matimus wrote:
> >> - Traling characters at the end of a literal are already used (the L
> >> for long).
>
> > The trailing L is going away in Python 3.0. For your consideration may
> > I suggest a '$' prefix. Though, I'm not sure I
Ben Finney wrote:
> Matimus <[EMAIL PROTECTED]> writes:
>
>
>> The trailing L [for 'long' literals] is going away in Python 3.0.
>>
>
> Yes. On the other hand, we are gaining '0b' for binary literals,
> to go along with '0o' for octal and '0x' for hexadecimal.
>
> So, the origin
Matimus wrote:
>> - Traling characters at the end of a literal are already used (the L
>> for long).
>>
>
> The trailing L is going away in Python 3.0. For your consideration may
> I suggest a '$' prefix. Though, I'm not sure I even support the idea
> of a decimal literal, and I'm not even s
Matimus <[EMAIL PROTECTED]> writes:
> The trailing L [for 'long' literals] is going away in Python 3.0.
Yes. On the other hand, we are gaining '0b' for binary literals,
to go along with '0o' for octal and '0x' for hexadecimal.
So, the original poster might get further by proposing an
> - Traling characters at the end of a literal are already used (the L
> for long).
The trailing L is going away in Python 3.0. For your consideration may
I suggest a '$' prefix. Though, I'm not sure I even support the idea
of a decimal literal, and I'm not even sure if I support the idea of
usi
D = lambda x: decimal.Decimal(str(x))
>> D(3.2)
Decimal("3.2")
Steven D'Aprano wrote:
> On Fri, 26 Oct 2007 19:19:46 +1000, Ben Finney wrote:
>
>
>>> Of course we can intruduce a single character function name as an alias
>>> for the Decimal type constructor, but even then we have to use bo
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> On Fri, 26 Oct 2007 19:19:46 +1000, Ben Finney wrote:
> > Nor should we. A function or type name should be short but
> > explicit, and 'Decimal' is about as short as I'd want.
>
> You don't like str, int, float, list, set, dict, or bool?
They'd all m
On Fri, 26 Oct 2007 19:19:46 +1000, Ben Finney wrote:
>> Of course we can intruduce a single character function name as an alias
>> for the Decimal type constructor, but even then we have to use both
>> parentheses and quotes for each and every decimal constant. We cannot
>> make it shorter than D
Lennart Benschop <[EMAIL PROTECTED]> writes:
> Python has had the Decimal data type for some time now.
Since version 2.4 http://www.python.org/dev/peps/pep-0327>.
> Unfortunately it is not very easy to access the Decimal data
> type. To obtain the decimal number 12.34 one has to do something
> l
Python has had the Decimal data type for some time now. The Decimal data
type is ideal for financial calculations. Using this data type would be
more intuitive to computer novices than float as its rounding behaviour
matches more closely what humans expect. More to the point: 0.1 and 0.01
are exact
28 matches
Mail list logo