[reportlab-users] HexColor()

Lalo Martins reportlab-users@reportlab.com
Tue, 18 Feb 2003 19:03:32 -0300


On Tue, Feb 18, 2003 at 05:50:07PM -0300, Lalo Martins wrote:
> 
> > >            w = l/4
> > 
> > Unless you use "from __future__ import division" this will mean
> > that w == 0 since len returns an int. int/int => int.
> 
> Yes.  This pretty much renders the whole thing unusable :-P my code uses
> "from __future__ import division" - I must have forgot to paste it.

No, I was wrong here.  I realy intended this to be integer division and it
will *not* return 0, unless l < 4 (which is invalid):

>>> 4 / 4
1
>>> 5 / 4
1
>>> 6 / 4
1
>>> 7 / 4
1
>>> 8 / 4
2

This is exactly the intended behaviour, so the last posted source code stands.

[]s,
                                               |alo
                                               +----
--
            Those who trade freedom for security
               lose both and deserve neither.
--
http://www.laranja.org/                mailto:lalo@laranja.org
         pgp key: http://www.laranja.org/pessoal/pgp

Eu jogo RPG! (I play RPG)         http://www.eujogorpg.com.br/
GNU: never give up freedom                 http://www.gnu.org/