[Bf-committers] Re: [Bf-blender-cvs] CVS commit: blender/source/blender/src interface.c

Martin Poirier theeth at yahoo.com
Mon Dec 4 15:00:34 CET 2006


--- Toni Alatalo <antont at kyperjokki.fi> wrote:

> Martin Poirier kirjoitti:
> >   Word of warning: The normal Python operator
> logic applies, so if you type in 1 / 3, you'll get 0
> and not 0.333. There's no going around that.
> >   
> 
> could we make the new/future style python division
> mode default there? 
> it makes the / operator a float op, and if you want
> int division you do //
> 
> In [1]: from __future__ import division
> 
> In [2]: 3 / 2
> Out[2]: 1.5
> 
> In [3]: 3 // 2
> Out[3]: 1
> 
> i think that is what makes sense for people and
> especially little 
> scripting in buttons - i guess is kept the old way
> in Py 2 only for bw 
> compat reasons and that Py 3000 will default to
> that. i dont know how to 
> initialize that context in c for the numbuts but
> probably it is 
> straightforward enough..

That would be a solution, but two things:

- We would have to use a new interpretor context (or
whatever those are called). Numbuts python expressions
currently reuse the same context as PyHooks (that
means imported module and the like). Not that big a
deal.

- I have no idea how to do the "from __future__ import
foo" trick from a C extension. It's alright if it
works like a normal module import, otherwise I'll have
to dig.

Martin


 
____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.


More information about the Bf-committers mailing list