@# 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



Comments:

<0> yes, some sort of bug with MySQLdb I would say.
<0> where exactly could it be returning these stale results FROM even? I don't understand... if I haven't run that particular query before, it can't return cached results
<1> imho it's just a matter of separation level
<0> anyway, I must get back to work.
<0> thank you for the help... I wouldn't have thought of trying commit if you hadn't mentioned it Zalamander
<1> BluR, can you type 'set transaction isolation level serializable' in the mysql monitor, and check the result?
<0> Query OK, 0 rows affected (0.00 sec)
<1> then, do the same test. run ror without commit() and see if it's reflected in the db
<0> "run ror without commit()"
<0> I wouldn't know how
<1> you said that you SELECT in python, INSERT in ror (without db.commit()), SELECT again in python....
<1> pls repeat the steps if you don't mind...
<2> Are you even using mysql tables with transaction support?
<1> oh well, i think i'm not understanding your problem...my English ****s..
<0> yes erwin
<0> kenboo I already made the changes with db.commit() in the right places, would be a h***le to undo



<0> I will try it later when I have some free time :)
<3> Hi, so that the pound sign starts a line-comment. Is there a block comment syntax?
<1> BluR, ok
<1> tnks, no...
<2> BluR: You can just enable auto-commit on the connection if you want.
<3> kenboo: is there a rationale for that?
<3> Python seems to have a lot of modern features. I never though block comments were a bad idea.
<4> I have what looks like an odd problem; I'm ***igning values to a list of lists (initialised in the main program) from an XML file in a SAX function, and the values are a mixture of "wall" and "gr***". Examining them as I ***ign them, it works as expected, but when I check the array back in the main function, everything is "gr***". I don't think it's a scoping error, since the only time "gr***" could even enter the array is if the ***ignment
<4> arly are); I was thinking maybe something I'm doing wrong with the SAX module? Anyone seen behaviour like this before?
<2> tnks: Really? What does this do in C? /* callsomfun(); /* call it now */ */
<5> tnks ''' comment \n more comments '''
<3> Erwin: nested block comments can be handled better than C handles them.
<1> uh ''' for comment!
<5> hehe
<1> i never thought of that..
<6> How'd you go about reading a binary file into a buffer and printing its hex values in Python? It complains that %x needs an int.
<5> comments are really just docs strings no?
<2> kingspawn: If you have a string, you can use ord() to get to the integer value
<1> redir, heh ya ya..
<3> kenboo: yeah... I guess it was already there with the document string... that /is/ a useful idea.
<2> redir: Comments are comments. They are not visible in the program.
<2> redir: Doc strings are the first string immediately after the start of a module, cl*** or function
<3> nice... thanks.
<1> rkd, does 'copy' module help?
<4> kenboo: Sorry, kind of new to Python, you'll have to explain.
<6> Erwin: Hm, I am sort of looking for the same thing as C, just going printf("%x\n", buffer[i])
<2> the """ ... """ is not really a docstring specific syntax; it's just a multi-line string
<2> kingspawn: print "%x" % ord(buffer[i])
<2> Or maybe you want print buffer[:16].encode("hex")
<2> Or http://www.andreasen.org/misc/util.py, hexdump function
<6> Erwin: Ah! Right on! Thanks alot.
<4> kenboo: AFAICS, the use would be copying it into a variable from outside the function, but that's basically already done.
<2> rkd: Maybe you are doing something like ***igning to a cl*** variable from multiple instances, or ***igning to some mutable default argument or something else.
<2> rkd: Or maybe you have a list of lists, but you have a copy of the same list in there rather than different lists. For example, you did [] * 10 to create that list.
<2> err, make it [[ ]] * 10
<4> Erwin: Ah.
<4> Erwin: Now that would explain it.
<4> Thanks.
<2> [ [] ] * 10 creates a list with 10 identical references to the same empty list, so appending to one of them appends to all of them
<2> [ [] for x in range(10)] would use a list comprehension to create 10 different lists
<4> Erwin: I'll remember that.
<7> can someone tell me a font where every char has an equal width... im building a console
<8> how do you test a string with regexp in python?
<8> i.e. if (str contains "dcc se nd")
<8> ??
<7> AfterDeath, you could try splitting the string: if containg_value in str.split():
<6> Look into the re module.
<9> Mizipzor: Courier, Courier New, Andale Mono, Bitstream Vera Sans Mono, Lucida Sans Typewriter,Luxi Mono,Nimbus Mono L
<1> umm i always load re module, and p=re.compile(regex) then p.find blah
<7> ChrisLong, thanks :P
<6> Or if it's very simple, you could do if "dcc se nd" in thestring: ...
<8> ok
<8> yeah
<2> regexp, shmegexps
<8> in the code, send wont have a space in it, i'm setting him up to detect the dcc se nd exploit
<8> him being my bot manpages
<10> Anyone can link me to more documentation about extending Python?
<1> http://docs.python.org/api/api.html
<11> Does anyone have CPython 1.5.2 for PocketPC/ARM architecture?
<1> ?
<1> or just write a module..(extending as in what?)



<10> kenboo: well, one question, can I have global C variables in a C cl***?
<1> yuriks, sorry it's beyond of my knowledge..
<10> =//
<11> OK, I think I already got it.
<2> yuriks: Your C code is not a cl*** from C's point of view. It's just C code.
<2> yuriks: For example all the methods are functions that take a PYObject* as the first argument, which you have to cast to your C type.
<10> Erwin: hmm, but, uh, Python views it as a cl***, right?
<12> Can any of the gurus here tell me if the while loop in http://rafb.net/paste/results/P36XD252.html can be simplified?
<10> bahatpc:
<2> bahatpc: Sure, use random.randrange(0,4) to get a number from 0..3
<10> for x in range(1000)
<10> Erwin: Python views it as a cl***?
<12> my bad: I meant to simplify the if...else part that increments the appropriate item in the dictionary
<12> as I test for x > value: dict[value] += 1
<12> I have a feeling the whole if...elif..else tree could be replaced by one or two lines
<2> dict[int(num * 4) / 4.0 ] += 1
<13> floor, not int
<12> Erwin: looks good, thanks :)
<13> oh, sorry
<2> well, int(float) should be the same as math.floor AFAICS
<2> Except returning an int, of course.
<13> it is, except ... yeah
<12> int, floor - doesn't really matter, your statement in general helped me enough
<10> Erwin: ???
<2> yuriks: Your Python-level code will see it as a cl***, provided that you have written an extension type, not just a plain C module. Python interpreter itself is written in C. No cl***es ther
<2> yuriks: So I don't really know what your question is. Your global variable in a C module will be a C global variable. There'll only be one of them.
<10> hmmm
<14> Two question: how can I return to exit a for iteration but stay within in the function? And do I need to explicitly return out of a try/except statement to prevent the rest of the function from executing?
<10> ah, so, if I make it an extension type, can I have per cl*** C variables?
<2> yuriks: Per cl*** or per instance?
<10> instance*
<13> [OmegentooX]: break
<2> yuriks: If you make it a C extension then you decide what goes into your C struct that is your type.
<14> break, thanks
<2> yuriks: And there's one instance of that struct for each instance you make.
<10> hmm, ok, thanks
<13> [OmegentooX]: and yes
<14> Thanks
<13> unless there's an uncaught exception, of course
<14> try: spam() except: eggs() should execute eggs() for any exception raised by spam(), right?
<10> Python exceptions are nifty
<10> Java exceptions are horrible
<13> [OmegentooX]: yes even someone pressing ctrl-c
<10> hehe
<15> hello
<16> im using Dev-C++, how do i make sure im linking the python libraries properly?
<10> themime: use distutils
<16> which are?
<10> Which IS =)
<16> utils = plural = are, correct?
<16> haha, eitherway, what is it?
<10> well, yeah, but I take it at a single entity
<10> Anyway, Python manual
<16> would diveintopython have it?
<16> thats the one i used to learn it a while back
<10> dunno
<10> the manual has it
<15> i have a question (i'm not a regular python programmer [actually i never wrote anything with python], i'm just trying to quick-fix a script written by someone else) so here is the question:
<15> i just commented out a "for" loop... can i replace it by something else (say, a fake loop, something like "for i=1 to 1") so i don't have to reindent the whole code that was inside the loop i commented out?
<15> i know it's messy but it's ok for me :)
<17> if 1:
<15> thanx :)
<17> then keep the loop body
<17> or
<17> if True:
<13> nico8481: what text eidtor are you using? it probably has a command to decrease indentation
<15> KWrite
<15> but i'd rather like to keep the original ident "untouched" so i'll use the "if 1:" solution, thanks :)
<18> Can anybody tell me if there is anything more elegant than "if term == term1 or term == term2 or term == term3" etc, would it be better putting the target terms into a list and using "if term in terms_list"? The latter seems to be a bit more expensive..
<13> ves: if term in (tem1, term2, term3):
<18> deltab: oh, brilliant thanks
<14> Does anyone who's fairly well-versed in regex see a better way to match "if line ends with 5 digits", or is this pretty good? .+\d{5,5}$
<2> ves: Not that this does create a 3-element tuple too
<19> Python is slow anyway (not that slow, but slower than C). Creating a tuple won't add a second to your runtime or anything.


Name:

Comments:

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






Return to #python
or
Go to some related logs:

gimp_image_convert_grayscale
#perl
#fedora
cg_annotate xdebug
#perl
ubuntu make-jpkg: command not found
quickpackage gentoo
#xine
skretch xxx
storkme



Home  |  disclaimer  |  contact  |  submit quotes