| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Comments:
<0> tag_bind is something like {'artist': 'a', 'title': 't'} <1> if P then Q, if Q then R, therefore if P then R, isn't that transitivity? <0> i want to get ['a', 'nix', 't', 'blah'] <0> darkgreen: yes <2> can anyone tell me how to get the module object for the current module? The name seems to be available in a method as self.__module__, but I'm not sure how to turn the name into an object. <3> uh, mod = sys.__modules__[self.__module__] <2> ah, thanks <2> hmm, what I'm trying to do is dynamically read all the cl*** objects from a module, so I can register them in a cl*** factory. so now, er, how do I turn the cl*** names from dir(mod) into cl*** objects? <4> ?getattr brendan <5> anyone know if there's something similar to the python cookbook specifically for linux based python programs. <2> yeah, thanks <2> just found it :) <4> also check out ?globals brendan <2> thanks TFK <5> anyone? <3> with the email module,, howe do I set a body?
<6> unix_infidel: there's some things you have to know about posix/linux but most of python is platform-independent, the python reference is a good source of info 'bout the exceptions. I doubt anyone will spend their time for sth like that <7> kbrooks: there's a recipie for it. <3> ah, Jerub, i just went therre, and stupid me :P <8> ironfroggy: I'm around now. <9> Wolfman2000: not again ;-) <8> cybercobra: I think you can calm down. The StandardPlayingDeck is complete. <8> Or at least, complete enough for the purposes that I'm hoping for. <9> Wolfman2000: good to hear it <8> I'm mostly right now trying to figure out the best way to go next......though I wonder... <8> Is there a python equivalent of a Java toString method I could write? <8> I wish to actually put some test code in to see if I can draw a card and get its result. <10> argh... what is toString? <8> toString basically turns any object/int/whathaveyou into a String representation. <7> Leeds: it's the java way of saying __repr__ / __str__ <7> Leeds: it's the only place in java where there's operator overloading iirc. you can add an object and a string together and get a string as a result. <8> What's the difference between __repr__ and __str__ then? <10> Jerub: hmm, thanks... <7> Wolfman2000: repr() is for representing an object, programatically. <11> yeah <12> Jerub: how do you mean, programatically? <10> Cowmoo: if you do print on a file, do you expect to see all the contents of the file, or an abstract thing with the filename, mode, etc. which tells you about the file? <10> that is, a file object <12> Leeds: I know that, but I meant regarding the difference between __repr__ and __str__ <12> so is str() only invoked when you actually call it? <7> nope <7> print foo ; will use __str__ if it exists, otherwise __repr__ <7> print '%s %r' % (foo, foo) ; will call str() and repr() respectively. <12> ah ok, that answers my question <12> cheers Jerub <12> and Leeds <10> repr seems to be used - in ipython, at least - when you just doo "foo" in the interpreter <12> yea <13> Is there a way for a child method to call the parent version of itself? <14> how wrong is it to put "import"s in the middle of a script? I'm not being able to avoid it, since I need to do many checks before that (like dropping privileges before trying to connect to the database, which happens when I import a certain module) <15> nictuku: It's not wrong. <15> nictuku: In such cases I usually define a function to import module at top and call it later. <7> nictuku: don't run code on import. <15> That too. <7> nictuku: especially not database code. you'll screw up the automated testing you're doing. <7> (you're doing automated testing, right?) <14> Jerub, yeah, I'm not being able to do that, though. <14> like, I must define __connection__ as a global in the module <14> https://dev.ubuntubrasil.org/trac/nwu/browser/trunk/nwu-server/nwu_server/db/operation.py <14> "PackageHub()" comes from turbogears <14> I tried to use a function to define __connection__, using "global __connection__", but that didn't work <15> def delayed_imports(): <15> global __connection__ <15> from blah import __connection__ <15> Or something like that. <14> hmm ok, I'll try something like that again. thanks! <16> o.0 <16> wierd code there <15> Too bad things aren't always ideal :( <15> By the way, recently I came across this: <15> http://www.df7cb.de/projects/sdate/ <15> Sep 4647 1993. <15> Metazoans are rising from the deep ocean floor / Your telomeres're rapidly agin' / Please get out of the new niche if you can't form a hand / For the species they are a-changin' <17> Anyone here can help with twisted? <17> resource = EbayBidResource() <17> from twisted.internet import reactor <17> reactor.listenTCP(8000, server.Site(resource))
<17> reactor.run() <17> why doesn't that work :( <18> brian: what error(s) do you get? <17> No such child resource <17> http://bidpouncer.com/ <17> I have a cl*** with functions render_GET and render_POST <17> why won't it work? <19> Wolfman2000: you here? <8> About to head to bed actually. <8> ...we'll have to try another time. <19> well i see you were asking about better string representations. did you do anything with that? <19> thats exactly what i was going to mention actually. i realized that was missing, and its good to have at least for debugging. <19> brian: ask in #twisted.web or #divmod if your question is Nevow-specific. <20> how do i parse incoming data from a socket? <20> do i just keep an infinite loop going that checks socket.recv? <19> well are more sophisticated ways to deal with them, but thats the basic of it. <19> but often you'd not deal directly with it, and instead will delegate the low-level details to some library. <20> as in sophisticated, more efficient? or just complicated <20> what do you mean, delegate to a library? <18> squiggly: it really depends on what you want to do <19> efficient as in productivity and maintainability of your codebase <20> polpak, i want to parse incoming data <20> not particularly lengthy <20> maybe 200 chars total <18> squiggly: do you want to do it asyncronously? will your process be handling multiple clients at once? <20> the server i'm connecting to is asynchronous <18> squiggly: ah, you're writing the client? <19> well ill give me standard response: use twisted. <20> yes polpak <20> twisted what, ironfroggy? <18> squiggly: does the client need to do other things while it waits for data? (update a gui, etc)? <18> squiggly: will it connect to multiple servers at once? <20> eventually, but not as of yet <18> squiggly: use twisted <19> squiggly: its a networking framework (among other things) <20> but yes, it'll output parsed data from the socket to the console / window <19> basically if you are listening on a socket with twisted, the framework would handle all the receiving of the data and p*** it along to you for processing. <17> ugh why am i getting no such resource <20> ironfroggy, that sounds good ;) <19> brian: ugh what resource? <17> ironfroggy: i'mbanned because i accidentally crashed someone's irc client or something <17> ironfroggy: they don't believe me it was an accident <20> copters <17> ironfroggy: the resource instance I'm p***ing to server.Site() <20> g-lined? <17> application = service.Application('web') <17> site = server.Site(EbayBidResource()) <17> sc = service.IServiceCollection(application) <17> i = internet.TCPServer(8000, site) <17> i.setServiceParent(sc) <18> brian: use pastebin <19> fa-lood.. bad! <20> i'm thinking about buying some python books <19> thats just boiler plate. the problem is in your resource. <20> which one do you guys recommend for someone with a background in programming? <21> twisted code is too important to be considered flooding <21> :) <10> squiggly: do you need a book? <17> http://rafb.net/paste/results/Fw31rQ28.html <17> there i pasted it <20> Leeds: yeah <17> tell me why it doesn't work before i cry <10> squiggly: why? <17> guys why doesn't it works <20> reading online documentation makes me sigh <20> i prefer having one on hand anyway, as well as some example code <18> brian: dunno.. I prefer django to twisted web <18> brian: you'll have to wait for ironfroggy <20> from twisted.internet.protocol import protocol <20> isn't that kind of outdated <17> maybe i should just use web.py <17> it's a really small project <17> but i can't use web.py <17> i need async
Return to
#python or Go to some related
logs:
system-config-package command yum leetometer wow #linux madwifi debian dwl-g650+ debian bootsplash 2.6.15.6 wine xgl segmentation fault is hotplugging PCMCIA safe Ubuntu #nvidia explorere Peekaboo bug #gentoo
|
|