#python - Sun 18 Feb 2007 between 16:05 and 16:18

NY Lost Funds



aleffwhere 20 is the cost of something and 50 is the markup
kapacewhat are the modes for open?
gotgenesaleff: This is a common gotcha in Python. Integer division returns only integers.
etwill i be hanged if i use s instead of self?
kapaces = self
padtet: some tools rely on self for generating docs and things, but python doesn't care
Cowmooet: es
yes
gotgenesaleff: use "from __future__ import division" for the behavior you expect
or else convert either the 50 or the 100 to a floating point number (e.g., 50.0/100)
aleffgotgenes: oh yes I got it
marienzet: if anyone who already knows python will end up reading or editing your code, then yes :P
aleffsomething like >>> float(20) / (float(1)-(float(10)/float(100)))
it works
heh
gotgenesaleff: the 50/100 gives 0, and 1 - 0 is 1, and 20 / 1 is 20
marienzjust type 20.0 instead of float(20) if you're using literals anyway.
gotgenesor just use the future division
kapacewhat other modes can i use with open(a,"rb").read()
aleffgotgenes: and how do I disable division after importing it?
because it looks like importing division changes the default behaviour of any division
guido_gkapace: help(file)
kapacek
gotgenesaleff: That I don't know. I'm hesitant to say you can't. It does change the behavior of all division to be true division.
aleffhehe
marienzaleff: // will always use "integer" division.
aleffthat's nice
gotgenesgood point marienz
aleffhrm
true
gotgeneskapace: http://docs.python.org/lib/built-in-funcs.html
aleffnow I don't know what's the best way
kapacethanks gotgenes.. got it
i dont get it..
this is supposed to be a clear image
http://localhost/python/test2.py
gotgeneskapace: localhost is only for your computer, i.e., you're the only one who can access that URL
kapaceoops lol
http://24.81.254.112/python/test2.py
and image src

Page: 4 11 18 25 32 39 

IrcArchive

NY Lost Funds