@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18



Comments:

<0> print "Loopz0r: ", Loopz0r
<0> print "NumChars: ", NumChars
<0> print "Loopz0r < NumChars: ", Loopz0r < NumChars
<0> RETURN:
<1> Hello, Nomed.
<0> Loopz0r: 5
<0> NumChars: 5
<0> Loopz0r < NumChars: True
<2> i'm having a strange problem using f = open and f.close
<0> RETURN: -> Output
<0> nomed: f.close() ?
<1> 5 < '5' #==> True
<2> i open the file i replace some string and then when i run it .. i get "file busy" error ..
<2> any suggestions =
<2> ?
<1> ?>pasteit@nomed



<0> Pythy: so you're suggesting that one of them is a string?
<0> i'm gonna check that out, because you might be damn right :p
<1> hylk0r: print repr(x)
<2> Pythy, ^
<1> Nomed: ?
<0> Pythy: You were right, sorry for my noobity :p
<2> i can't type today :/
<2> ^ == ?
<1> nomed: see the directions PM'ed to you by the bot.
<3> Does Python support extended REs (as in Perl) that allow inclusion of whitespace, comments, etc?
<1> re.VERBOSE
<3> ah - http://diveintopython.org/regular_expressions/verbose.html
<2> Pythy, http://phpfi.com/110575
<2> line 20-33
<1> "paste a *minimal* (12 lines or so max), *completely self-contained* program"
<2> cause the issue
<2> Pythy, i can't
<2> it depepnds on a complex stuff
<2> you'll need pbuilder debian and so on
<2> mainly if i don't use lines 10-36 it works
<2> and i don't get the "file busy" issue
<1> f.close --> f.close()
<2> if i use that code ... no way
<1> (in line 29)
<2> ohhh god
<2> i checked it several times ...
<2> Pythy, thanks
<4> how to know that which thread has started n which has stopped
<4> how to schedule threads in python
<1> nomed: (No need to build `newlist', BTW---you could f.write() each line as you iterate.)
<4> pls help
<2> Pythy, yep
<2> that's what i was doing ...
<2> then i got that error ..
<2> and started to test different ways :)
<1> nomed: Gotcha. (Reasonable.)
<2> i'll go back to that approach :)
<1> nomed: "lines = f.readlines()" --> lines = list(f)
<4> can anyone help
<5> abhinav: don't ask to ask, just ask :)
<1> isAlive( ) Return whether the thread is alive. Roughly, a thread is alive from the moment the start() method returns until its run() method terminates.
<1> abhinav: Why are you using threads?
<6> if I have two lists A and B, is there a standard way to add all elements of B to A that are not already in A? (other than for item in B: if item not in A: A.append(item))
<7> use sets.
<6> hm. ok.
<8> which python ide
<1> ?>ides@the_good
<9> which of the web frameworks have a large community
<1> gzl: a = [1]; b = [2,3,2] # consider the case where `b' has more than one occurrence of a value not in `a'.
<6> that can't happen here, but point taken.
<10> How do you determine if an object exists, I've tried isinstance() but it's not quite doing this.
<1> thinkflat: Why aren't you sure?
<10> Pythy: please?
<1> Why doesn't it always exists?
<11> hi
<10> Pythy: because it's a feature not always used by clients
<1> x = None; ... if x is None: ....
<10> Pythy: I'm looking for a way to determine if a client has instantiated a particular object
<11> can i do same operations on sets (with same methods) like i do on lists?
<10> isinstance(self.doesthi***ist, SomeCl***) doesn't work when self.doesthi***ist was never instantiated
<1> `object' or cl***?



<7> keep a global counter which increments when the cl*** is instantiated.
<10> Pythy: instance of a cl*** (which happens to be an subcl***?"
<10> sysfault: hmm, there's an idea
<10> how about a simple example, say a variable.
<1> "self.doesthi***ist" > `self' is guaranteed to exist, & you goal is to test: if hasattr(self, 'does_this_exist')
<12> roj_, certain operations, yes
<10> you can'd do: if not z is None: print "fobar"
<10> Pythy: self will always exist... lemme try that
<11> Greatred, ok thx
<7> thinkflat: http://deadbeefbabe.org/paste/149
<11> cu all
<1> thinkflat: But give some thought to a more-uniform approach: Always have that attribute; initializing it to `None' if it isn't pointing to some other instance.
<10> Pythy: one sec
<10> Pythy: awesome, that worked perfectly (not that it's what I should be doing :)
<10> Pythy: how do you mean, to always have that attribute
<1> in your .__init__(): self.other_thingy = None
<12> thinkflat, he means set an attribute to None, or to something. but never leave it uninitialised
<10> Pythy: With my current usage, self.foobar is an instance of another cl*** (optionally instantiated)
<10> Greatred: gotcha, so set self.foobar = None
<12> yip
<10> Greatred: and if later the client wants to set it to an object, so be it.
<10> gotchas.
<12> then it's simply: if self.foobar is not None: ...
<1> Yep.
<10> Greatred: yea, that makes sense.
<10> Is there a rule of thumb as to the maximum number of instance variables that should exist? Lint seems to think it's < 15 or something if I recall
<10> I'm <= 20 right now
<1> no limit.
<12> for good coding practise?
<4> pythy i hv used threads for multitaskin but tell me how to schedule them
<10> Greatred: exactly...
<1> abhinav: What are you trying to accomplish?
<10> Greatred: I know I "can" stuff tons in there, but not sure if it's wise to do so
<12> well it's your own judgement really. but if it's getting that high you might consider grouping attributes into other cl*** instances - if that is sensible
<10> Greatred: gotcha... is the decision one of organization, not performance?
<12> for example, if you've got x,y and z variables, then you might combine them with another "Position" cl***
<4> pythy i m implementing a crawler
<10> Greatred: ah, makes sense.
<12> thinkflat, well again, it's about your own judgement, and what youre requirements are
<12> your*
<10> Greatred: sure :)
<12> computer scientist lecturers will break it down so much that sometimes you get no more than 2 or 3 variables per cl***. sometimes it's impractical to have less than 10
<1> abhinav: Why not use an off-the-shelf one? You don't need threads for that, nor would you want to use threads there.
<6> I have this Python file with inconsistent tab sizes (so sometimes it's 2 spaces, sometimes it's 4). is there any way to automatically fix it all?
<10> Greatred: yea, I've also heard speakers who say a cl*** should never have more than 5 methods or something :)
<12> often there is a tradeoff between code readability and performance. but 95% of the time you'd be better off writing it readable, as the cost in performance can't justify the stress of maintaining it
<10> Greatred: agree
<1> "inconsistent tab sizes (so sometimes it's 2 spaces, sometimes it's 4)" > And how do you know when it should be what?
<13> Greatred: agreed, despite what Paul Graham says
<1> What did PG say?
<12> the rule of thumb is to keep things that are the same in the same cl***, or the same cl*** heirarchy
<13> Pythy: hire smart enough people that it's not an issue for them to understand the tricks
<10> Greatred: yea, and when need be... more cowbell
<12> if a bunch of instance variables are strongly related, group 'em
<13> Pythy: at least that's how I read it
<1> pjz: URL? What was the exact quote?
<13> Pythy: oh, it's not an exact quote, it's more of a general philosphy. let me find the paper.
<10> Thanks for the tip Pythy, I'll use it for now and consider a more organized approach :)
<10> Thanks for the advice Greatred
<12> never be afraid to refactor. unless the deadline is in 2 days time :D
<1> Greatred: Q: And when is it not? (A: When it is in 1 day's time.)
<4> no i want to do it with multithreading pls tell me how to schedule them
<1> ?>threading@abhinav
<14> ?>treading@ratm_
<14> ?>threading@ratm_
<1> ratm_: (The bot PM'ed it to you the first time.)
<14> yeh.. i see :)
<15> hi
<16> hi! i just added an argument to a function that i start with thread.start_new_thread(funk, (x)) and now python says that the second arg must be a tuple. weird? i mean, it is a tuple, no? and it workes fine when the function does not take any args and i start it using an empty tuple. any suggestions?
<1> (x,)
<16> ah yes that works, thanks!
<0> there is a join functie right? Because I can't find it :p
<0> *function


Name:

Comments:

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






Return to #python
or
Go to some related logs:

phpmyadmin user host table
install pymqi
blood_dog dp
gentoo error 80
linux kill a hung process
#linux
file system of ubuntu
#math
#mysql
error inserting ndiswrapper invalid argument



Home  |  disclaimer  |  contact  |  submit quotes