Hi Dennis
Sure, I get it. I do most of my work in Delphi, which is, shall we
say, not lax about floating-point types. Thinking about this more, I
realise my initial interest was in looking at the // operator as
something new, whereas I now see it probably just wraps math.floor();
obviously then
Christoph
I understand the explanation regarding the underlying math.floor()
call. Were I using this functionality in my code,
int(a//b)* some_list
would not be something I consider a big deal. However, I see what
you're saying: The multiplcation by list can only work with an int, and
you hav
Hi Fredrik
Fair enough; I wasn't precise. Upon further reflection, I actually
meant floor division, via the // operator. In the following snippet:
>>> 4/2
2
>>> 4//2
2
>>> 4.0/2.0
2.0
>>> 4.0//2
2.0
>>> 4.0//2.0
2.0
We know the last two operations can only return what are effectively
integer n
Caleb Hattingh wrote:
> 4.0//2 doesn't return an integer, but the equality against an integer
> still holds. I agree that integer division should return an integer,
> because using the operator at all means you expect one.
There are actually two conflicting expectations here: You're right, the
Caleb Hattingh wrote:
> I agree that integer division should return an integer, because
> using the operator at all means you expect one.
so what is
x / y
? an integer division ? something else ?
--
http://mail.python.org/mailman/listinfo/python-list
Hi Christoph
On my linux py-2.4.1:
>>> 4.0//2 # Integer division, but still returns a float.
2.0
>>> 4.0//2 == 2
True
>>>
4.0//2 doesn't return an integer, but the equality against an integer
still holds. I agree that integer division should return an integer,
because using the operator at all
Andrew Koenig wrote:
> Christoph Zwerschke wrote:
>
>> Anyway this would be an argument only against the variant of typecasting a
>> float with a fractional part. But what about the other variant which
>> raises an error if there is a fractional part, but works if the float is
>> actually an ex
"Christoph Zwerschke" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Anyway this would be an argument only against the variant of typecasting a
> float with a fractional part. But what about the other variant which
> raises an error if there is a fractional part, but works if the
Dan Sommers wrote:
> Christoph Zwerschke wrote:
>> I was wondering whether this should be allowed, i.e. multiplication of
>> a sequence with a float. There could be either an implicit typecast to
>> int (i.e. rounding) ...
>
> Explicit is better than implicit.
I already knew using the word "impli
On Fri, 24 Mar 2006 00:35:44 +0100,
Christoph Zwerschke <[EMAIL PROTECTED]> wrote:
> Currently, if you write 3*'*', you will get '***', but if you write
> 3.0*'*', you will get an error (can't multiply sequence by non-int).
> I was wondering whether this should be allowed, i.e. multiplication of
10 matches
Mail list logo