@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet


Comments:

<0> whats the best way to do a 2d array in python
<0> ?
<1> a list of lists
<0> so probably cant do a numbers = [rows][cols]
<1> well that doesn't mean what you think in Python, no
<0> well if i'm gonna read in the number of rows and the number of columns how would i do it



<2> what always confuses me about this stuff is which thing is rows and which is columns
<2> is it a list of rows or a list of columns?
<2> there's no reason to pick one or the other, but everyone else seems to have some convention that they never tell me about
<1> that really depends on your convention
<1> yeah
<2> ([0] * cols) * rows ?
<2> no
<2> that won't work
<1> [[0 for _ in rows] for _ in cols]
<3> Is there any way to figure out what end-of-line character is used by the operating system a script is running on?
<3> (ie \r\n for windows, \r for mac, and \n for *nix)
<4> Yes, but I'm not quite sure where I found it. But it's there.
<4> Maybe in the platform module.
<3> os.linesep
<3> thank you
<5> anyone have any comments regarding SQLObject vs SQLAlchemy wrt stability, ease of use, and abstraction design?
<6> ok.. looking for the easy way out here (too tired to google a lot) :[ while attempting to copy list-elements of type int to another list, i discover (i think) that it copies references to the ints instead of the value.. how can i deepcopy ints easily ?
<7> import copy, copy.deepcopy
<6> tried that.. got a "no such attribute" exception - apparently i would need to implement an interface and such.. isn't there a simpler way of getting the value of something - without doing that much work?
<7> sorry, copy.copy should do the job if you just have a list of ints
<7> a = copy.copy(b)
<6> hmm
<6> i'll try again.. tomorrow =/



<7> what's the problem?
<6> the problem with "now" is lack of energy and tiredness. the problem with the copying is "for l in List: temp.append(l)" causes 60*60 ints (60 nodes gets made which each should have 60 ints - instead they get 3600 ints to share)
<7> um, what is it that's supposed to happen?
<6> the scope of temp is within a method "deepCopy(self,List)", which simply states "temp = []" then the above code, and "return temp"
<6> it's supposed to make a duplicate of whatever is in "list"
<6> the value of that, not the reference of whatever is in there
<7> how about just ditch that and use copy.copy or copy.deepcopy
<6> i tried that, it told me to implement that friggin interface :p
<7> perhaps try pasting your code..
<6> so i was hoping to spare myself of doing that
<7> a = copy.deepcopy(b) #a is now a copy of b
<6> well.. the method actually copies tuples as well - but those should be immutable (and thus return copies anyhow)
<7> yes
<6> a = copy.deepcopy(b) <- "AttributeError: 'function' object has no attribute 'copy'"
<6> i'll implement the interface tomorrow
<8> >>> import copy
<8> >>> a = [1, 2, 3, 4]
<8> >>> a
<8> [1, 2, 3, 4]
<8> >>> b = copy.deepcopy(a)
<8> >>> b
<8> [1, 2, 3, 4]
<8> heh, didn't mean to paste it like that
<8> but it works fo rme
<6> weird
<9> hi, http://www.rafb.net/paste/results/bHjQ3h47.html this code is very very very slow on packages which have many files ***ociated with them, what can I do to speed it up?
<2> anyone know of a library I can use to do a dns lookup without blocking?


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

#beginner
#politics
waht is a vespa?
#worldcup
#beginner
alica21
#computers
#firebird
#stocks
azaheb



Home  |  disclaimer  |  contact  |  submit quotes