@# 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> SYS.exit(1)?
<0> basically, I want to catch all errors in the thread that go uncaught, log an error, and then exit the thread
<1> BluR, isn't the thread exited when the code execution stops?
<2> BluR: raise the exception
<0> Hmm.. oh I see, nevermind... I wasn't closing the socket, but the thread WAS ending, because as you say, code execution stops
<0> thanks :)
<3> anyone good with regular expressions? I'm trying to figure out how to find words.. I'll work out the specifics of words later, that don't appear between a < and a >, ie not in an html tag
<0> how does python p*** around values by default?
<0> reference? value? reference by value?
<2> no, usually it just packs a cone and keeps it to itself.
<4> Reference.
<2> BluR: or, you could read this incredibly accurate and comprehensive document about python's objects: http://effbot.org/zone/python-objects.htm
<0> i.e. is it safe to make a getter for a member variable and not worry about someone manipulating it outside the cl***?
<0> thanks jerome
<0> er, Jerub
<2> BluR: anything else anyone tells you will be convenient lies.



<0> :)
<0> neat.
<4> Reference is an incredibly convenient lie.
<0> so okay, that makes sense. but how do I safely return, lets say a list, without worrying about what the caller does with it
<5> BLuR: if you're going to do a setter/getter pair, why not make the member variable public?
<0> I don't want a setter, just a getter
<4> Return a tuple.
<0> interesting.
<0> why is that?
<0> Oh, because it is immutable?
<0> awesome, return tuple(list) is exatly what I need. thanks ignacio
<6> Endust: Given "foo bar <baz>zot</baz>" you want to end up with what in what kind of variable?
<7> is import os os.environ["REMOTE_ADDR"] correct for python 2.4?
<3> well I'd like to end up with a list containing ['foo','bar']
<6> So not only skipping the tag names but contents of a tag as well?
<3> oh wait, no, just skipping the tags, so zot would be included
<3> I figure I could just replace every occurance of <.*> with nothing then run through it again to find the keywords. would that be the best way?
<6> Naw. I think you can get it in one with the re module.
<6> You prolly wanna use re.split()
<3> thats what I was hoping for. I can't figure out what to write it as though. [^<].*\w+[^>] was my first guess
<6> Actually, I'd try to make a regex that is "either words in angles or whitespace" and use that to split the line.
<3> ah yea. split(<re to find tags>,string)
<3> i didn't think of that. thanks
<6> Exactly. Happy to help.
<8> morning people
<8> im used to program c# and i am looking for something that works like c#'s events in python. my first thought would be to use a function as an object
<8> but maybe there is some standard way of doing this?
<8> another question. what is a good python IDE for windows?
<0> is there a way to get the traceback into a string rather than just print it to stderr?
<9> gvim
<8> godling: i dont feel very comfortable with vim... not tried gvim tho
<10> kebabskal: emacs.
<10> kebabskal: briefly explain C#'s events?
<2> gvim is just the same as vim, with better mouse support
<9> and lasers
<9> well, next version
<11> next version has some cool stuff in it
<12> Okay, does anyone know where I can get a windows binary for pygresql?
<10> "Due to extremely high demand around the Daylight Saving Time change, the usual animated clock has been temporarily disabled. "
<10> -- time.gov
<8> davidmccabe: ok, ill look it up. concerning events. Event e; e += Function(sender, args). then you can do e(); to run all registered functions.
<10> kebabskal: ah.
<9> see, it's an indication that DST ****s.
<10> kebabskal: you could write a cl*** that keeps a string->(list of functions) dictionary. have methods to register and invoke functions under names.
<10> or something.
<11> godling: you did see that Bram has gone to work at Google, right? as part of their attempt to hire all the cool free software developers...
<10> kebabskal: it's so easy that there's nothing standard.
<13> kebabskal: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410686
<9> LeedsHK: I hadn't heard.
<14> tuple question: say i have a function a() that is simply return ((1,2),(3,4)). how could i get the function that calls it to reconstruct it with additional tuples, i.e. ((1,2),(3,4),(5,6)). a(), (5,6) yields (((1,2),(3,4)),(5,6))
<9> LeedsHK: when did that happen?
<10> aaronz: f() + (5,6)
<10> er,
<10> a() + (...)
<15> t = ((1,2),(3,4)); t = ( t , ) + ( (5,6) , ); t #==> (((1, 2), (3, 4)), (5, 6))
<14> pythy: i want to avoid that extra internal parenthesis
<15> t = ((1,2),(3,4)); t += ( (5,6) , ); t #==> ((1, 2), (3, 4), (5, 6))
<9> LeedsHK: I don't see anything about it on his website
<14> that did it.. great!
<14> thanks!
<15> aaronz: Use a list instead, if possible.



<14> im working within the reactor framework
<14> which uses tuples
<14> err
<14> twisted
<14> reactor is the pattern ;)
<14> thanks for your help
<15> sure.
<11> godling: sorry, called away by work... he announced it a week or two back
<11> godling: http://groups.yahoo.com/group/vimannounce/message/152
<9> LeedsHK: thanks
<11> I've just installed 7.0c - it's got tabs! :-)
<9> right on
<9> LeedsHK: Google is getting big.
<11> yup
<8> davidmccabe wchun: thanks! i think i get it!
<9> LeedsHK: I wouldn't mind working for them, though. ;)
<15> #?re ?os
<16> maybe he commented out that line on purpose
<15> I'm playing with streamlining the bot-command syntax
<15> `?os' will target yourself; `?os Schmendrick' to have the response PM'ed to Schemendrick.
<17> ?os Davey
<17> :) Had to check.
<17> Pythy: Are you using twisted?
<15> No, just the sockets-module.
<4> The @ was actually a good idea.
<18> see isn't that more fun?
<15> Ignacio: It will still accept both formats. (Initially, I was more concerned about limiting false-positives than about saving a keystroke or two, but, in deference to some who thought that syntax overly-complicated, I'll give this a try).
<19> morning
<20> morning
<21> ehm, anyone else having problems with Sourceforge cvs?
<22> how could I change this recursive list: ['john', 'has', ['coffee', ['python'], 'language', 'cheese']]
<22> to something like that: ['john has', ['coffee', ['python'], 'language cheese']]
<1> It's not recursive o_O
<22> TFK: i meant, each element is a list or a string, where a list is a list or a string :)
<1> How did you end up with this mess?
<19> that is a mess for sure :)
<22> TFK: ok, a real example :)
<22> ['S', ['NP', ['NP', 'the', 'Usipetes'], 'and', ['NP', 'the', 'Tenchteri']], ['VP', 'came', ['PP', 'to', ['NP', 'the', 'Rhine']]]]
<22> NP should refer to 'the Usipetes', for example
<19> what the hell is that
<23> natural language parsing.
<22> Yhg1s: that's right
<23> mecolin: it's still a mess. the best solution would for the parser not to spit out that mess :)
<22> actually, it is output of a parser
<23> but you can process it using 'isinstance'.
<24> I have a question about inner cl***es here: http://pastebin.com/637283
<24> question is on line 11
<4> Parent.PARENT_VALUE
<24> ignacio: isn't there a "special word" for poiting to the parent cl*** from an inner cl***?
<23> HowardTheCoward: note that the names are misleading; there's no relation between Parent and Cl***.
<25> does anybody have an idea how i can split a string by ',' but ignore the ones that are inside quoted strings? (ignore "123,0000")
<23> HowardTheCoward: it's not even an 'inner cl***', as it's created in a function, not inside the cl***. But even if it were 'cl*** Parent: [..] cl*** Child:' there would be no way for the Child to refer to the Parent other than by the global name.
<24> Yhg1s: Cl*** is an inner cl*** (which means for me that it is declared inside the body of the PArent cl***)
<23> foxpaul: sounds like you want to use the csv module.
<24> s/Cl***/Child/
<26> :>
<23> HowardTheCoward: but it's not. it's defined in a method of the cl***.
<23> HowardTheCoward: and, in any case, 'inner cl***es' aren't special to Python.
<24> Yhg1s: is there a difference between defining an inner cl*** inside the cl*** and inside a method of that cl*** ?
<23> HowardTheCoward: no.
<23> HowardTheCoward: as I said, in neither case can you refer to the parent in any way other than through the global name.
<24> Yhg1s: what if I don't know the name of the parent cl*** ?
<23> HowardTheCoward: then you're out of luck. write it differently.
<27> hi
<27> is there a way to get a list/array where the indices are strings ?
<24> Yhg1s: i mean there might be a cl*** AnotherParent(Parent), so I don't know from inside of Child if I'm inside Parent or AnotherParent. what to do then?
<23> HowardTheCoward: then you're out of luck. write it differently.
<24> Magicdead: that's dictionary
<23> HowardTheCoward: using inner cl***es like that, to extract information from outer cl***es, is folly. Methods are used to extract information from cl***es. If you want another cl*** (inner or outer, doesn't matter) to extract information from a cl***, have it call specific methods.
<24> Yhg1s: by differently you mean I shall avoid writing that inner cl*** and just put it on the same level with its parents ?
<23> HowardTheCoward: so, in your case, 'c.print_value()' would be replaced by 'c.print_value(self)', and Child.print_value would have a second argument that it would use to extract information from.
<27> mhhm ok cause i'm used to php and there an array can either habe integer indices or string indices... well then, read dictionary elemnt manpage


Name:

Comments:

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






Return to #python
or
Go to some related logs:

Rackable sucks
freenode afterdeath
#debian
antiderivative of xe^-x^2
#css
#suse
#sql
#debian
#osdev
#perl



Home  |  disclaimer  |  contact  |  submit quotes