#apache #archlinux #asterisk #centos #debian #gentoo #haskell #kde #kubuntu #lisp #math #mysql #perl #python #ruby-lang #rubyonrails #suse #ubuntu #vim #wikipedia 0 1 2 3 4 5 6 7 8 9 10 11 12 13
Top Prev 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 Next
#python
<pythonboy> >>> g = [[None]*3]*3
<pythonboy> >>> g
<pythonboy> [[None, None, None], [None, None, None], [None, None, None]]
<pythonboy> >>> g[0][0] = 1
<pythonboy> >>> g
<pythonboy> [[1, None, None], [1, None, None], [1, None, None]]
<pythonboy> ???
<pythonboy> can someone help me ?
<pablo_> can i compile a python app to binary on linux?
<VladDrac> you're referencing the same list 3 times
<VladDrac> you're basically doing: a = [None, None, None], g = [a,a,a]
<pythonboy> ah ok ..
<pythonboy> how do i make a NxN matrix ?
<Juhaz> [[None]*3 for x in range(3)]
<pjd> pythonboy: you might want to look at numpy
<pjd> it has proper, fast matrices
<ehird> hm,
<ehird> does '1' > '2' work?
<ehird> i.e. > comparison, numerically, but with string input
<Habbie> you could ask python the same question
<Habbie> in less time than typing all that
<ehird> good point..
<Juhaz> no.
<Habbie> Juhaz, what?
<ehird> Juhaz: Yes It Does.
<Juhaz> doesn't work
<pablo_> pjd: it cant be carried to binary right?
<ehird> yes it does
<ehird> it most definately works
<ehird> >>> '1' > '2'
<ehird> False
<ehird> >>> '2' > '1'
<ehird> True
<Habbie> ehird, i don't think Juhaz responded to us
<ehird> oops
<Juhaz> for that example, yes
<Juhaz> but it's not numeric comparison
<pjd> ehird: it compares by string value, not numerically
<pythonboy> thx Juhaz
<ehird> it seems to work with decimals and everything too though, so i don't see why it doesn't "work"
<Juhaz> >>> '100' > '2'
<Juhaz> False
<ehird> ugh
<ehird> ok, better fix htat
<pjd> ehird: think of string sorting; that's how it compares
<ehird> (version number comparison :P)
<evilx_> 100 > 2 = true , but '100' > '2' = false
<koollman> ehird: 1.2.3 ? ;)
<ehird> koollman: won't happen :)
<Habbie> ehird, is 1.10 bigger or smaller than 1.2?
Previous Page Next Page