int(a), b = divmod(x, y)
steve at lurking.demon.co.uk
Sat Jul 28 00:18:42 CEST 2001
On Wed, 25 Jul 2001 18:00:50 -0700, "Ken Seehof"
<kens at sightreader.com> wrote:
>This is not the same as a = int(5.2) and it would seem really wierd to
>me if it were. Then again, from a C++ point of view, any syntax that
>is currently illegal is a natural candidate for a new syntax feature :-).
>But python is not C++, so I'm afraid you'll have to settle for something
>less terse and more clear.
>a,b = divmod(x,y)
>a = int(a)
I don't know why the first output in the tuple isn't an int anyway.
After all, it *is* a member of the set of integers even if it is
currently represented using a float.
A quick example...
So why doesn't this return...
If the 2 is used anywhere a float is needed it will be cast to float
implicitly anyway once PEP238 goes through.
More information about the Python-list