| 00:00 | peleg | jimi_c, so how do I do the same trick with a few variables? |
| 00:01 | jimi_c | peleg: print "blah %s %d %f" % (my_string, my_int, my_float) |
| 00:01 | KragenSitaker | name: have you looked into the Secure Remote Password protocol? |
| 00:01 | peleg | jimi_c, oh, didn't think of the parens |
| thanks | ||
| 00:01 | jimi_c | no problem, the % place holders work just like printf from C |
| so you can do things like %0.2f | ||
| 00:02 | KragenSitaker | except that you can use %s for everything unless you are doing number formatting things like %0.2f or %08d |
| 00:02 | jimi_c | yes |
| 00:02 | abstrakt | jimi_c, wtf are you talking about? |
| 00:03 | abstrakt | sorry i don't know what cheetah is |
| 00:03 | jimi_c | that hasn't always been the case though, has it? i thought back in the day if you did %s and pass in an int you'd get a type error |
| abstrakt: i thought i saw you mention cheetah above, disregard it | ||
| cheetah is a templating engine for python | ||
| 00:04 | KragenSitaker | jimi_c: could be; I don't have old versions of Python handy |
| 00:04 | jimi_c | yeah, i'm talking 5+ years ago, 2.1 days |
| 00:04 | name | KragenSitaker: http://www.bitbucket.org/segfaulthunter/pypentago/src/tip/src/pypentago/crypto.py that's what i got |
| 00:04 | jimi_c | or it could just have been Zope, it had a lot of weird things like that about it |
| 00:05 | name | KragenSitaker: i guess that's not that secure |
| 00:06 | KragenSitaker | looks |
| 00:09 | KragenSitaker | name: it looks like that's intended for a situation where the server doesn't keep the password file encrypted, since it uses the plaintext password to generate the challenge |
| 00:10 | name | KragenSitaker: forget the challenge and response thing |
| KragenSitaker: i only added it as a possibility. but it's not that good. just forget it ;) | ||
| 00:10 | KragenSitaker | name: SRP allows the server to not know the plaintext password, and still to perform replay-proof challenge-response authentication that doesn't reveal the password to eavesdroppers |
| 00:11 | name | KragenSitaker: that indeed sounds interesting. any python implementation? i found the C one |
| 00:11 | dmsuperman | Is there a way to use try...except where it'll catch all exceptions? |
| 00:11 | peleg | for some reason "in" checks if a specific value exists among a dictionary's keys. How can one check if a value exists among a dictionary's values? |
| 00:11 | dmsuperman | I want to execute a block of code if no exceptions are raised, and I'm not even sure the type of exception this module raises |
| 00:11 | name | try: except Exception:? |
| 00:11 | dmsuperman | name: Ah, good idea :) |
| 00:11 | name | peleg: foo in d.keys() |
| aeh values | ||
| 00:11 | KragenSitaker | dmsuperman: try: except: |
| 00:12 | KragenSitaker | name: not sure |
| 00:12 | peleg | name, oh, thanks |
| 00:12 | name | KragenSitaker: eh! at least exception |
| we don't want keyboardinterrupt, do we? | ||
| 00:12 | KragenSitaker | name: no, you don't need that |
| name: oh, ok | ||
| 00:12 | name | KragenSitaker: i don't need what? |
| 00:12 | KragenSitaker | name: oh of course. there is a Python implementation of SRP in Passpet |
| 00:13 | dmsuperman | You guys are awesome. Putting up with all my nooby little questions. You've made learning a new language a lot easier, thanks :) |
| 00:13 | KragenSitaker | I was saying you don't need Exception, but perhaps KeyboardInterrupt is a reason not to just except: |
| 00:13 | name | KragenSitaker: thank you |
| KragenSitaker: indeed it is | ||
| 00:13 | KragenSitaker | at least the server side |
| 00:13 | name | where the hell is the src? :-) |
| that page is horrible :S | ||
| 00:14 | peleg | name, I get "TypeError: argument of type 'builtin_function_or_method' is not iterable" |
| 00:14 | name | peleg: values()! |
| 00:14 | nooomem | anyone: best way to compress text in python. |
| 00:14 | peleg | oh |
| :-) | ||
| 00:14 | KragenSitaker | oh hmm. looks like we haven't released the source... |
| 00:15 | name | KragenSitaker: you develop it? |
| sorry for telling your page horrible, but it is ^^ no download link :S | ||
| ah. i see 'Passpet is an extension for Firefox 1.5. It will be available for download here after alpha-testing is completed. If you would like to test Passpet and help contribute your feedback, please contact Ka-Ping Yee at the e-mail address below. Thanks! ' | ||
| 00:17 | name | anyway. sounds like an interesting concept indeed |
| 00:18 | KragenSitaker | name: me and Ping |
| yeah, there ought to be a download link; sounds like a loose end to tie up | ||
| I think Ping did about 2/3 of the work | ||
| 00:19 | KragenSitaker | including both client and server SRP implementations |
| 00:19 | name | KragenSitaker: and FF 1.5 is a bit outdated ^^ |
| 00:19 | PolyAway | why doesn't unicodedata have methods for returning the script of a character, i.e. Cyrl, Arab, Hebr, etc? |
| 00:20 | KragenSitaker | name: yeah, but not maintaining software is a different category of sin from never releasing it in the first place! |
| 00:20 | name | KragenSitaker: now you got both :) |
| 00:21 | KragenSitaker | I imagine porting it to FF2 and 3 is actually not going to be that much work |
| 00:21 | name | i'm just writing unit tests for the server. that's funny ;-) |
| 00:25 | name | KragenSitaker: seems hard to implement ;) |
| 00:27 | name | KragenSitaker: hmm SRP is patented? |
| 00:33 | Heltskay | Anyone knows a site that contains py exercises ? prefferably non-oop :) |
| 00:34 | nosklo | Heltskay, http://projecteuler.net/ |
| 00:34 | nosklo | evil grins |
| 00:34 | Heltskay | pythonchallange is too difficult |
| For now. | ||
| 00:34 | nosklo | Heltskay, this one is more straightforward |
| 00:35 | nosklo | Heltskay, guessing the question is not part of the challenge, at least |
| 00:36 | Heltskay | Thank you |
| 00:39 | KragenSitaker | name: yeah, there's a patent; I am not sure what its current legal status is |
| 00:39 | peleg | I am trying to play a little with epydoc. I have one .py file in ~/Python, and I am trying to document it; but I get the error "Directory '/home/peleg/Python/' is not a package". How can I make a file -- or a group of files -- a package? |
| 00:42 | peleg | forget about my question :-) |
| 00:43 | KragenSitaker | name: IIRC the patent is free to use under some circumstances |
| 00:44 | Gr0m | hello |
| how can I do script that after 10 sec show me "stop!"? | ||
| 00:46 | plundra | Gr0m: from time import sleep ; sleep(10); print "STOP", but it doesn't really make sense to do it in python to me :-P |
| 00:47 | GothAlice | Is there a package available to assist in the creation of callbacks (with decorator-style hooks)? |
| 00:47 | Gr0m | but thats blocking method. Do you know how to make something like that but nonblocking for UI app? |
| 00:48 | KragenSitaker | Gr0m: GUI frameworks usually have a way to invoke some callback after some period of time |
| Gr0m: but it differs from one to the next | ||
| 01:09 | Defined | hi everyone |
| has anyone here ever used SRP in python? | ||
| 01:10 | Vornotron | what is SRP? |
| 01:10 | abstrakt | is there a debugger available for python? |
| right now i'm just using the die/exit/echo technique | ||
| well | ||
| print/echo whatever | ||
| 01:10 | cratylus | pdb |
| 01:10 | TheX1le | abstrakt: pdb |
| 01:10 | abstrakt | ok cool |
| 01:10 | TheX1le | import pdb |
| pdb.set_trace() | ||
| 01:11 | Defined | Vornotron: Secure Remote Password |
| 01:11 | TheX1le | its awsome read up on it |
| 01:11 | Vornotron | http://docs.python.org/library/pdb.html <--- |
| 01:11 | Vornotron | has not, then |
| 01:11 | PolyAway | http://effbot.org/pyfaq/is-there-a-source-code-level-debugger-with-breakpoints-single-stepping-etc.htm |
| 01:12 | PolyAway | P0lygl0t |
| 01:12 | P0lygl0t | abstrakt: http://effbot.org/pyfaq/is-there-a-source-code-level-debugger-with-breakpoints-single-stepping-etc.htm |
| 01:12 | TheX1le | abstrakt: just be aware... pdb does NOT work with psyco... |
| 01:12 | P0lygl0t | why doesn't unicodedata have methods for returning the script of a character, i.e. Cyrl, Arab, Hebr, etc? |
| 01:12 | abstrakt | i don't know what psyco is |
| 01:12 | TheX1le | if your using psyco it will most likely skip your breakpoints |
| 01:12 | abstrakt | but good to know |
| i'm using ActivePython 2.5 on windows if that makes a difference | ||
| 01:12 | TheX1le | abstrakt: its a JIT just in time compiler a way of speeding up code |
| 01:12 | scorchsaber_ | That's a lame warning. |
| 01:12 | Vornotron | (psyco: Python just-in-time compiler. Makes your scripts /scream/) |
| 01:12 | scorchsaber_ | Just turn off Psyco and you're good. Seriously. |
| 01:13 | TheX1le | yeah i comment it out when im debugging |
| 01:13 | abstrakt | k |
| 01:13 | TFKyle | Vornotron: depends on the code of course :) |
| 01:13 | scorchsaber_ | That's not at all anything bad about either psyco or pdb. It's not even worth mentioning, imho-- all testing should be done without psyco, and the documentation for it itself says so. |
| That includes debugging. | ||
| 01:14 | Vornotron | TFKyle: true |
| 01:14 | TFKyle | scorchsaber_: except maybe performance testing (though you might want to do it both with and without psyco to see how it degrades) |
| 01:14 | scorchsaber_ | And, yes, heavily depends on the code. I've been slowed down by psyco before. |
| 01:14 | abstrakt | ok what are the string matching and replacing functions respectively? |
| where do i find docs on using them | ||
| 01:14 | scorchsaber_ | abstrakt: They're methods. Look at the documentation for str. |
| 01:15 | cratylus | what's a way to map a dictionaries keys to attributes of an object like d['somekey'] maps to self.someattribute (not to it's value) ? |
| 01:15 | abstrakt | scorchsaber_, k and the documentation for str would be where? that's a bit vague to me, sorry |
| 01:15 | scorchsaber_ | Heck, googling for "string methods" always seems to have the docs for it as the first or second result. Java's docs compete closely. |
| 01:15 | Luyt | cratylus: a __getattr__ method |
| 01:15 | scorchsaber_ | abstrakt: Just google it. |
| 01:16 | linux_user400354 | how can i check if a list contains a string? help(list) doesnt show any contains method. |
| 01:17 | Luyt | if "word" in lst: print "found" |
| 01:18 | abstrakt | if string.replace is deprecated then what should i use |
| c'mon is it that hard to just tell me what i should actually use? | ||
| 01:18 | scorchsaber_ | linux_user400354: Methods supporting containing stuff have a method that overloads the 'in' comparison. |
| 01:18 | abstrakt | i don't see what i want on http://docs.python.org/library/string.html |
| 01:18 | scorchsaber_ | abstrakt: I already told you. The str methods. |
| 01:18 | lepassive | linux_user400354, you can use 'word' in ''join(the_list) |
| 01:18 | scorchsaber_ | abstrakt: Not string functions, str method. |
| 01:19 | scorchsaber_ | abstrakt: str is the object. You use the methods on it. How much clearer can it get? |
| 01:19 | P0lygl0t | abstrakt: str.find() |
| 01:19 | abstrakt | scorchsaber_, you might have told me but the point is me understanding... |
| P0lygl0t, thank you! | ||
| damn, was that so hard? | ||
| 01:19 | scorchsaber_ | abstrakt: If you don't understand what a method is, or what str is, you're lost. |
| 01:19 | P0lygl0t | for replace, I guess you may have to have a look at Regular Expressions |
| 01:19 | scorchsaber_ | abstrakt: No. Nor was googling it. |
| 01:20 | scorchsaber_ | P0lygl0t: No, you don't. str has a method for that, too, if you don't need to use regular expressions, but just replace literal values. |
| 01:20 | P0lygl0t | abstrakt: beware, when it's not found it returns -1 |
| 01:20 | Luyt | No need to join the list into a big string. Just 'lst=['aap','noot','mies']; print 'noot' in lst' works |
| 01:20 | kosh | yourstring.replace(foo, bar) |
| 01:20 | abstrakt | scorchsaber_, k well i guess in your terms i'm lost because you assume i know what you mean when you say 'str' |
| 01:20 | kosh | abstrakt: the tutorial would be a good thing for you to do |
| 01:21 | Luyt | type('hello') is a str |
| 01:21 | abstrakt | kosh, yeah but it's pointless when i can just read the code without it and then lookup what i need to as it arises |
| 01:21 | scorchsaber_ | abstrakt: The string object. "text" is a str object. |
| 01:21 | P0lygl0t | Luyt: where are you from? (just curious) |
| 01:21 | scorchsaber_ | abstrakt: The problem is that you don't even know how to look it up. |
| 01:21 | abstrakt | scorchsaber_, yeah and you do 'text'.replace() and stuff if you like |
| i get that | ||
| 01:21 | scorchsaber_ | abstrakt: I directed you to do so. |
| 01:21 | Luyt | Groningen, the Netherlands. |
| 01:21 | abstrakt | i didn't know that 'str' specifically referenced that phenomenon of the language sorry |
| 01:21 | kosh | abstrakt: that is a bad method for learning to program |
| 01:21 | cratylus | Luyt , __getattr__() returns the value right? i needed a mapping to the actual attribute |
| 01:21 | abstrakt | kosh, i'm not learning to program |
| 01:22 | kosh | abstrakt: what are you trying to learn then? |
| 01:22 | scorchsaber_ | abstrakt: You should, then. |
| 01:22 | abstrakt | kosh, i already know how to program very well, my goal is to edit this program so it works and i'm almost there |
| 01:22 | peleg | Are you using doxygen, epydoc, or something else? |
| 01:22 | Luyt | cratylus: I supposed you had a dict of key/values inside an object and wanted to make them accesible by dot notation. |
| 01:22 | abstrakt | scorchsaber_, you shouldn't make so many assumptions |
| 01:22 | scorchsaber_ | You don't, however, know how to program in Python-- at least not proficiently. That's a problem. |
| 01:23 | scorchsaber_ | abstrakt: Feel free to correct me when appropriate. |
| 01:23 | KragenSitaker | scorchsaber_: hey, about memory size |
| 01:23 | abstrakt | scorchsaber_, my problem wasn't that i didn't know how to look it up, my problem was that i asked very clearly and very specifically for a link to specific documentation so that i didn't have to guess how to look it up |
| which P0lygl0t gave me | ||
| thanks | ||
| 01:23 | scorchsaber_ | notices that he's turning into a mean person. :( |
| 01:23 | abstrakt | anyway |
| 01:23 | cratylus | Luyt almost correct. i have an object and wanted to have a dictionary that has different keys map those keys to the same attributes of my object (so when self.bla changes somedictionary['blee']'s value changes |
| 01:23 | KragenSitaker | scorchsaber_: this server supports up to 256GB: http://www.sun.com/servers/netra/x4450/specs.xml#anchor2 |
| 01:23 | sunru | how would i create self properties on the fly? inherit dict? |
| 01:23 | abstrakt | back to the hack |
| 01:23 | scorchsaber_ | abstrakt: He didn't give you documentation, he gave you a code snippet that serves as a crutch. |
| 01:24 | scorchsaber_ | KragenSitaker: Aiiieee. |
| 01:24 | KragenSitaker | scorchsaber_: this server supports up to 512GB: http://www.sun.com/servers/coolthreads/t5440/specs.xml#anchor2 |
| 01:24 | abstrakt | scorchsaber_, leave your elitism elsewhere man, you're preaching to the choir |
| scorchsaber_, i ain't a newb | ||
| 01:24 | scorchsaber_ | sunru: Override __getattribute__ , if I understand you right. |
| abstrakt: Yes, you are. | ||
| 01:24 | abstrakt | haha |
| 01:24 | scorchsaber_ | At least at Python. |
| 01:24 | abstrakt | ok whatever |
| 01:24 | KragenSitaker | scorchsaber_: this server supports 1.18TB: http://www.sun.com/servers/highend/sunfire_e25k/specs.xml#anchor1 |
| 01:24 | scorchsaber_ | That's not a bad thing, but it's no use denying it. |
| 01:24 | abstrakt | scorchsaber_, fine newb to python |
| scorchsaber_, i meant newb in general | ||
| 01:24 | scorchsaber_ | KragenSitaker: Argh, aiiee, aaaaaa! I need those machines. |
| 01:24 | KragenSitaker | scorchsaber_: this server supports up to 2TB: http://www.sun.com/servers/highend/m9000/specs.xml |
| 01:24 | scorchsaber_ | Oh jeez. |
| 01:24 | abstrakt | scorchsaber_, i ask smart questions, i look for smart answers |
| 01:25 | KragenSitaker | (of RAM) |
| 01:25 | abstrakt | scorchsaber_, honestly for most of the questions i ask "it's in the manual" is just as dumb of the answer as the questions that elicited the catb-smart-questions FAQ |
| 01:25 | sunru | scorchsaber_: or i could inherit dict? and for k in kw: self[k] = kw[k] ? |
| 01:25 | Luyt | cratylus: I'm unable to make a mental picture of what exactly you want, sorry. But have a look at __setattr__ and __getattr__ anyway ;-) |
| 01:25 | abstrakt | i know there's a manual, i know there's google, but i know that *you* guys know better than anyone where to find the specific bits of info i end up needing from time to time |
| 01:25 | KragenSitaker | sunru: you don't need to inherit dict to create self properties on the fly |
| 01:26 | scorchsaber_ | abstrakt: I told you the exact google query I'd use to give you an URL. I don't believe you bothered using it. Also, I don't care. |
| 01:26 | abstrakt | k cool |
| back to the hack | ||
| 01:26 | scorchsaber_ | sunru: There's really not many good reasons to inherit dict. |
| 01:26 | KragenSitaker | sunru: first see if you can use a dict for your problem: self.f[k] = v |
| 01:26 | sunru | KragenSitaker: so something like self[k] = kw[k] would work? |
| 01:26 | kosh | abstrakt: you have to understand that many people here get sick and tired of people asking simple questions over and over when doing the tutorial would take them about 2 hours at most and then they would know the answer |
| 01:26 | abstrakt | kosh, i do understand that |
| 01:26 | KragenSitaker | sunru: second, if that doesn't work, you can use setattr(self, k, v) |
| 01:26 | abstrakt | sorry but i don't wanna take those 2 hours |
| and i'm not gonna | ||
| 01:26 | KragenSitaker | abstrakt: dude, you've been in this chat for longer than that! |
| 01:27 | abstrakt | so if yall don't wanna help me when i ask a question cool, but don't bugger me about it, they're usually legit questions |
| 01:27 | sunru | i want to use <obj>.<key> to access it |
| 01:27 | abstrakt | meh |
| 01:27 | scorchsaber_ | abstrakt: I did help you. |
| 01:27 | KirkMcDonald | abstrakt: The built-in types are documented in the library reference: http://docs.python.org/library/index.html |
| 01:27 | abstrakt | scorchsaber_, yeah |
| 01:27 | TFKyle | abstrakt: just because we know stuff doesn't mean you have to ask the channel even the simplest of questions, easy enough to find some things on your own |
| 01:27 | sunru | not <obj>.f[key] |
| 01:27 | scorchsaber_ | sunru: Yes, just override __getattribute__ |
| 01:27 | AndrewBC | abstrakt, if you can't be bothered to help yourself, why should we be bothered to help you? |
| 01:27 | KragenSitaker | sunru: generally that's not a great idea, but if that's really the right thing, setattr is what you want |
| 01:27 | KirkMcDonald | Dang, people, why are you jumping all over this guy? |
| 01:27 | scorchsaber_ | ^ also a good point |
| 01:27 | habnabit | KirkMcDonald, he's a php programmer! |
| 01:27 | kosh | abstrakt: you have been helped but you know so little that it is hard to help you? why should be go to huge efforts to help you when you won't put in effort either? |
| 01:27 | abstrakt | ok i guess i'm an asshole for wanting fast answers, i'll code by myself thanks for all the great community support guys, i'll remember it in the future, peace |
| 01:27 | habnabit | KirkMcDonald, *by choice*! |
| 01:28 | scorchsaber_ | KirkMcDonald: Pent up hatred of all mankind. |
| 01:28 | KragenSitaker | or, yeah, override __getattr__ or __getattribute__ |
| 01:28 | sunru | KragenSitaker: well its a custom Relational Mapped object (Simple orm) |
| 01:28 | scorchsaber_ | sunru: It may be possible that I misunderstood you. |
| 01:28 | kosh | KirkMcDonald: he deserves it for his attitute, helping him was not working |
| 01:28 | scorchsaber_ | reads up for the original question |
| 01:28 | KragenSitaker | sunru: aha |
| 01:28 | habnabit | sunru, is there a reason that you're not using an existing ORM instead of writing your own? |
| 01:28 | KragenSitaker | sunru: have you checked out SQLObject and SQLAlchemy? |
| 01:29 | kosh | KirkMcDonald: he had to be given the same answer many times and made simpler every time because he doesn't know even the most basics and would not do the tutorial despite spending more time then the tutorial takes asking basic questions |
| 01:29 | cratylus | Luyt, i think you may be right that those two methods are the way to do it. to clarify what i wanted, it was that a key of a dictionary to have it's value cahnge when the value of an attribute of some object does. (that is for them to be pointing at the same bit of memory) |
| 01:29 | AndrewBC | I don't think he deserves to be flamed or anything. It'd be better to just ignore it if you feel as I do |
| 01:29 | Luyt | cratylus: I hope you have good reasons for such side effects ;-) |
| 01:30 | sunru | i could inherit a dict with the custom hooks i need. |
| then self[k] = kw[k] would work correct? | ||
| 01:30 | G_work | quick question, what is the best place to replace the first instance of a particular character with a different character? |
| 01:30 | KragenSitaker | sunru: inheriting from a dict is not a good idea |
| 01:30 | kosh | AndrewBC: I don't think he was flamed, it was just pointed out that he was making his own problems worse and how it could be solved |
| 01:30 | sunru | ugh, yes sorry |
| 01:30 | habnabit | G_work, str.replace |
| 01:30 | scorchsaber_ | sunru: Or you could override __getitem__ and __setitem__ for the dict-like interface. |
| 01:30 | KragenSitaker | sunru: easier just to override __setattr__ or __getattribute__ |
| 01:30 | scorchsaber_ | sunru: Then you store a dict as an attribute, and use it. |
| 01:30 | KragenSitaker | oops |
| 01:30 | Luyt | wouldn't that replace all characters? |
| 01:30 | G_work | habnabit: I thought that normally did all |
| 01:30 | sunru | scorchsaber_: right thanks |
| 01:30 | AndrewBC | kosh, fair enough |
| 01:31 | KragenSitaker | I meant __getitem__ and __setitem__, sorry |
| 01:31 | cratylus | Luyt, good reason? naa, this is an ugly parsing mapping |
| 01:31 | habnabit | G_work, well, you're in luck! If you read the documentation you'll find yourself wrong. |
| 01:31 | sunru | sorry guys, anyhow i want to access the items via dot notation as well. (seems to be the rage and i like the idea) |
| 01:31 | G_work | habnabit: actually, nevermind, str.replace would do it for me |
| 01:31 | scorchsaber_ | That's alright, I thought he was talking about attributes before as well. |
| 01:31 | kosh | AndrewBC: I pointed out he should do the tutorial after so many basic questions and he was the one that was hostile towards that |
| 01:31 | KragenSitaker | sunru: for dot notation you need __getattr__ or __getattribute__ |
| 01:31 | G_work | will cheat a little |
| 01:31 | Luyt | sunru: implement __getattr__ (or __getattribute__) in your class. See http://pyref.infogami.com/__getattribute__ |
| 01:31 | sunru | KragenSitaker: ok, no need for the property function? |
| 01:31 | scorchsaber_ | sunru: Okay, override __getattribute__ and __setattr__ and __getitem__ and __setitem__ to use a common set/get method when appropriate. |
| 01:32 | kosh | AndrewBC: it gets very annoying when people expect us to help them with every little bump but the won't spend any time themselves learning |
| 01:32 | sunru | ok thanks guys. |
| scorchsaber_, Luyt, etc: thanks, | ||
| 01:32 | scorchsaber_ | sunru: It gets a bit messy with __getattribute__, though, so be careful. |
| 01:32 | AndrewBC | kosh, preaching to the choir :P |
| 01:32 | KragenSitaker | sunru: the property function might be helpful, depending on how you end up doing it |
| 01:32 | Luyt | "I'm a spoonfeedkiddie and I want everything handed to me on a silver platter" |
| 01:32 | habnabit | Luyt, well, he *is* a php programmer. |
| 01:33 | AndrewBC | Not all PHP Programmers are bad. :) |
| 01:33 | Luyt | I $program $a $lot $in $php $too ;-( |
| 01:33 | scorchsaber_ | I take it he left the channel, then. |
| 01:33 | KragenSitaker | well, you can do a lot of stuff in PHP without ever spending two hours working through a tutorial |
| 01:33 | sunru | as for sql<insert orm trademark>, no. |
| yes and his ears are burning. | ||
| 01:33 | kosh | KragenSitaker: yeah I have had to replace some of that crap and the damage it caused |
| 01:33 | Evanlec | so i use a web interface to access the customer databse that i use at work, I'm wanting for more functionality however, would it be possible to use python URL libs to pass data into the search form on the site, and then parse the resulting output? |
| 01:34 | Luyt | Evanlec: You can do a POST request to a form URL with data in it, yes. |
| 01:34 | scorchsaber_ | Evanlec: Yes, but you don't think in terms of "forms" for it-- forms are just one way of looking at POST/GET etc. requests, and you'd be using those directly. |
| 01:34 | KragenSitaker | kosh: yeah, when it keeps working they don't call you for help :) |
| 01:34 | Evanlec | oh i see |
| 01:34 | KragenSitaker | kosh: so there's a selection bias |
| 01:34 | Evanlec | now would that work for a secure site? |
| 01:34 | scorchsaber_ | Evanlec: If you do want to think of it in terms of forms, you need another layer of abstraction-- see the Mechanize module, for instance. |
| 01:34 | TFKyle | KragenSitaker: typically when you don't know the language very well you end up creating fairly ugly code though |
| 01:34 | AndrewBC | KragenSitaker, ironically, a good portion of it will be inefficient, insecure, or just plain broken. |
| 01:34 | scorchsaber_ | Evanlec: Sure. I believe Python does have SSL stuff. |
| 01:34 | KragenSitaker | Evanlec: or ClientForm |
| 01:35 | KragenSitaker | TFKyle: yes |
| TFKyle: which is better than not solving the problem at all | ||
| 01:35 | Evanlec | scorchsaber_: well, i'm okay with thinking of it in terms of POST/GET |
| 01:35 | kosh | newbies don't make well working apps in any system |
| 01:35 | scorchsaber_ | In my experience with programming when you don't relaly know the language-- it's just not fun, makes you hate the language. Blech. |
| 01:35 | KragenSitaker | AndrewBC: I don't think you need to be ironic; seriously, a good portion of it will be inefficient, insecure, or just plain broken |
| 01:35 | scorchsaber_ | OTOH, sometimes languages are easy to use that way. |
| 01:36 | sunru | kosh: yes I've left a trail of terror behind me. |
| 01:36 | KragenSitaker | AndrewBC: and then they call kosh and pay him $150 an hour to fix it |
| 01:36 | scorchsaber_ | I did have a good deal of fun writing PixelBender shaders without ever doing any sort of tutorial. The logic behind the language was self-evident. |
| 01:36 | Luyt | Evanlec: The urllib.urlencode() will build a POST data block from a dict, which you can use to send along with a urllib2.urlopen() call |
| 01:36 | kosh | KragenSitaker: replace not fix |
| 01:36 | KragenSitaker | or replace |
| maybe they call someone else to fix it | ||
| 01:36 | AndrewBC | KragenSitaker, the irony comes in with that being a serious detriment to the original inferred point. That "doing things" means "doing good things" |
| 01:36 | Evanlec | Luyt: alright cool, so thats where i should start |
| 01:37 | KragenSitaker | AndrewBC: most things people do are good in some ways and bad in other ways |
| 01:37 | Luyt | Thats how I once wrote a script to do some form submitting and navigation on an interactive site |
| 01:37 | kosh | KragenSitaker: also they pay me more then that per hour |
| 01:37 | scorchsaber_ | also did that |
| 01:37 | KragenSitaker | kosh: no insult intended, was just a guess |
| 01:37 | AndrewBC | except for when you're living in post-modernism philosophy hell, where bad is good and good is bad. |
| 01:37 | Evanlec | Luyt: cool, yea ive been looking at this pastbinit script, and it looks pretty simple |
| 01:37 | scorchsaber_ | I wrote a bot for a forum shortly before the site shut down. Fat big waste of time. :( |
| 01:37 | AndrewBC | or is it post-modernism philosophy heaven? |
| 01:37 | kosh | KragenSitaker: actually it ends up being cheaper to pay me more then that per hour then what average programmers charge |
| 01:38 | AndrewBC | I don't know anymore. |
| 01:38 | KragenSitaker | AndrewBC: for example, my hot water heater pilot light keeps blowing out when the winds come up due to bad design |
| AndrewBC: which is bad | ||
| 01:38 | scorchsaber_ | AndrewBC: You must think beyond good and evil. |
| 01:38 | sunru | AndrewBC: yeh don't waste your time with that stuff. |
| 01:38 | AndrewBC | scorchsaber_, right and wrong? :D |
| 01:38 | KragenSitaker | kosh: average programmers aren't good enough to get paid or it :) |
| AndrewBC: because then I don't have hot water | ||
| 01:38 | AndrewBC | sunru, Oh I'm not. The only time I waste on it is for making what I think are humorous anecdotes. |
| 01:38 | scorchsaber_ | AndrewBC: Dammit, I'm referencing Nietzsche |
| 01:38 | KragenSitaker | AndrewBC: on the other hand, building, buying, and installing the hot water heater was good, even though its design is flawed |
| 01:38 | sunru | AndrewBC: people like to have a crack at doing the "right thing" and screw up badly!? :) |
| 01:38 | Evanlec | Luyt: and where might i want to look for parsing the output of the post request ? im thinking the output would be coming in html? |
| 01:39 | AndrewBC | scorchsaber_, heh |
| 01:39 | KragenSitaker | AndrewBC: some friends had their hot water heater catch on fire due to even worse design |
| 01:39 | Luyt | BeautifulSoup is a good HTML parser/scraper |
| 01:39 | scorchsaber_ | Evanlec: If it is, you can use BeautifulSoup to get data from it. |
| 01:39 | Evanlec | okay |
| 01:39 | Luyt | Everybody loves the Soup |
| 01:39 | Evanlec | would it be coming in html tho? |
| 01:39 | AndrewBC | KragenSitaker, the question is which situation in your analogy is PHP? :) |
| 01:39 | Luyt | Depends on the site ;-) |
| 01:39 | Evanlec | or would it just spit back the data values |
| 01:39 | KragenSitaker | some people like lxml instead of BeautifulSoup |
| 01:39 | scorchsaber_ | KragenSitaker: A /water/ heater catching on fire? hahaha. |
| 01:39 | kosh | KragenSitaker: with experience I have found out that we usually come in well under our competitors cost and a tiny fraction of the time, it is pretty interesting |
| 01:40 | AndrewBC | sunru, nothing wrong with that |
| 01:40 | Luyt | Evanlec: Just do the post request and see what the webserver sends back |
| 01:40 | KragenSitaker | AndrewBC: oh, I've seen PHP scripts that were pure evil, and I've seen some that were great |
| 01:40 | scorchsaber_ | I've only seen impure evil. |
| 01:40 | KragenSitaker | kosh: yeah, that's not surprising if you (plural) know what you're doing |
| 01:40 | Evanlec | Luyt: alright, where would the output go to, or how would i see that? |
| 01:40 | scorchsaber_ | Kind of the average of your extremes. |
| 01:40 | Luyt | well, urllib2.urlopen() return a file-like object, and you use readlines() on that |
| 01:41 | Evanlec | ah k |
| 01:41 | KragenSitaker | scorchsaber_: so practicality beats purity, even when it comes to evil? |
| 01:41 | scorchsaber_ | er, read() |
| 01:41 | AndrewBC | KragenSitaker, I can't help but have a personal bias in these kinds of things, as I started with PHP, did the academic C++ thing, and then Python (very abstract path of my learning, but it's close enough) |
| 01:41 | scorchsaber_ | KragenSitaker: Like being pure good, being pure evil is very impractical. |
| 01:41 | Evanlec | Luyt: thanks for pointing me in the right direction |
| 01:41 | Luyt | No problem. Call again if you discover that you have to send cookies along |
| 01:42 | selam | hi all |
| 01:42 | Evanlec | Luyt: cookies, oh no :( |
| 01:42 | scorchsaber_ | Hello dyslexic witch down. |
| er, town. | ||
| Damn, do typos ruin jokes. | ||
| 01:42 | TFKyle | being pure neutral is hard though (sorry, bad joke) |
| 01:42 | KragenSitaker | haha |
| 01:42 | Evanlec | Luyt: you wouldnt have a copy of that script you wrote for navigating that site for me to look at would u? |
| 01:42 | sunru | hmm might use slots as well. |
| 01:42 | scorchsaber_ | TFKyle: Argh, neutral neutral was the crappiest character alignment choice I ever made. |
| 01:42 | AndrewBC | scorchsaber_, it's okay. You don't have to say anything funny for me to laugh at you. :) |
| 01:42 | scorchsaber_ | It's impossible. |
| 01:42 | sunru | does __dict__ come with the new style class? |
| 01:42 | Luyt | Evanlec: Yes, but I have to obfuscate some passwords in it, moment. |
| 01:42 | TFKyle | indeed |
| 01:43 | KragenSitaker | sunru: old and new both |
| 01:43 | Evanlec | Luyt: np, tx |
| 01:43 | sunru | KragenSitaker: some classes don't have it though. |
| i might use slots though | ||
| 01:44 | KragenSitaker | yes, some classes don't have it |
| don't use slots unless it turns out you need it | ||
| i.e. your memory consumption is outrageous without it | ||
| 01:45 | Luyt | Evanlec: http://rafb.net/p/JkMPkt61.html and it could need some improvement, but it's at least something to start with |
| 01:46 | sunru | KragenSitaker: yes, i like to have a bit of control there. __slots__ seem like a more serious object attribute system (if I have that right or not) |
| 01:47 | KragenSitaker | sunru: I don't think it speeds up attribute access as much as you would think |
| 01:47 | scorchsaber_ | Shouldn't worry about speed unless you need to anyway. |
| 01:50 | Evanlec | Luyt: thanks |
| 01:51 | Luyt | LiveHTTPHeaders is a good firefox plugin to see what happens behind the scenes |
| 01:53 | KragenSitaker | sunru: see http://gist.github.com/38493 |
| 01:54 | KragenSitaker | that ought to spend pretty much all of its time doing attribute access |
| it takes about 25% less time on the 'slotty' test than the 'unslotty' one | ||
| 01:54 | Evanlec | Luyt: ah cool |
| 01:55 | Luyt | 0.26 vs 0.20 on my machine |
| 01:55 | KragenSitaker | so for you it's 23% less, Luyt |
| 01:56 | KragenSitaker | it does about three attribute accesses per integer addition |
| I guess I don't know for sure that the integer addition is insignificant... | ||
| 01:57 | sunru | KragenSitaker: how is slotty getting the values for its attributes? (1) |
| 01:57 | KragenSitaker | sunru: from the __init__ it inherits from unslotty |
| 01:57 | sunru | oh sorry |
| 01:57 | KragenSitaker | anyway, the point is that __slots__ saves a bit on speed, but it mostly saves on memory usage |
| (this was in 2.5 fwiw) | ||
| 01:58 | KragenSitaker | it doesn't bring Python close to the level of Smalltalk |
| 01:58 | sunru | 25% is pretty good then. |
| 01:59 | KragenSitaker | and you can kind of see why in that example --- when Python compiles a method, it can't reduce self.somename to a fetch from some offset in a vector |
| since the way Smalltalk or C++ does | ||
| it still has to do the name lookup | ||
| 02:00 | KragenSitaker | at run-tie |
| 02:01 | abstrakt | hey look at that it works |
| 02:01 | KragenSitaker | yay abstrakt |
| 02:01 | abstrakt | not much thanks to yall |
| 02:01 | KragenSitaker | abstrakt: btw do you know about AB Strakt? |
| hey, they tried to help you for hours | ||
| 02:01 | Heltskay | How can I subtract a list of nums from another to get the common numbers in both lists? |
| 02:02 | abstrakt | KragenSitaker, wtf? lol i asked like two to three actual simple questions |
| tried to help me... hehe, yeah ok | ||
| otherwise is was just a borderline flame war cuz i'm a PHP guy | ||
| 02:02 | KragenSitaker | programming languages are not tribes. |
| 02:02 | Heltskay | Ex: l1 = [1,2,3], l2 = [2,3,4] , should generate l3 = [3] |
| 02:02 | sunru | its just syntax ;P |
| 02:02 | Luyt | Heltskay: set.intersection |
| 02:02 | KragenSitaker | Heltskay: you mean l3 = [2, 3]? |
| 02:03 | abstrakt | KragenSitaker, no but the channels for programming languages are often governed by tribes |
| 02:03 | Heltskay | Yes KragenSitaker, sorry... |
| 02:03 | abstrakt | in fact invariably so :P |
| 02:03 | Heltskay | I forgot about the 2 :) |
| 02:03 | KragenSitaker | list(set(l1) & set(l2)) |
| 02:03 | Heltskay | Thank you |
| 02:03 | KragenSitaker | although that might give you [3, 2] |
| 02:03 | sunru | farts and destroys a couple of universes. |
| 02:03 | sunru | oops |
| 02:04 | Luyt | set([1,2,3]) & set([2,3,4]) => set([2, 3]) |
| 02:04 | Heltskay | Well, the order is not really important ... |
| 02:05 | scorchsaber_ | abstrakt: Don't come here to gloat. |
| 02:05 | Heltskay | thanks Luyt :) |
| 02:05 | scorchsaber_ | abstrakt: Please. |
| 02:05 | sunru | does __slots__ have any methods? |
| 02:05 | abstrakt | scorchsaber_, just did |
| 02:05 | scorchsaber_ | abstrakt: Exactly, and it's not a nice thing to do. It doesn't help you, it doesn't help us. |
| 02:06 | abstrakt | scorchsaber_, you didn't help me much |
| scorchsaber_, but that's ok | ||
| i can and did help myself | ||
| ttyl maybe | ||
| 02:06 | scorchsaber_ | Heltskay: If you don't care about the order, you should probably just use the sets to begin with. |
| 02:06 | sunru | hehe |
| 02:06 | scorchsaber_ | wishes he had op powers right now. |
| 02:06 | sunru | how wude |
| 02:07 | scorchsaber_ | should have done the ":T" smiley face like habnabit |
| 02:07 | KragenSitaker | sunru: __slots__ is somtehing you set to a sequence; I don't know if it has to be a list or if it can be any kind of sequence |
| 02:07 | sunru | ok |
| 02:08 | Heltskay | Ok |
| 02:08 | scorchsaber_ | More likely a tuple, if it was required to be something. Tuples are nifty, and seem to be used a lot for that kind of thing. |
| 02:08 | sunru | __slots__ = mydict.keys() orsomething. |
| 02:08 | scorchsaber_ | er, some specific type. |
| 02:09 | sunru | just installed ipython for the first time. |
| nice little secret you have there ;) | ||
| 02:09 | verte | ipython is icky |
| ipython != python | ||
| 02:09 | scorchsaber_ | remembers talking to somebody that mistook ipython syntax for python syntax. |
| 02:09 | scorchsaber_ | I didn't take any of the |
| 02:09 | Luyt | It does interface to the .Net stuff nicely, tho |
| 02:10 | scorchsaber_ | "ipython != python" arguments seriously until then. |
| 02:11 | verte | Luyt, you're thinking of ironpython. that's a different thing. |
| 02:11 | Luyt | Erm... confused indeed, nvm ;-) |
| 02:11 | sunru | heh ipython |
| 02:11 | verte | ipython is an interactive shell |
| 02:11 | Defined | If im using a function from a dll that puts data into a buff variable, in C++ the buff variable just be a char, what must it be in python? when i try make it an array i get: ArgumentError: argument 2: <type 'exceptions.TypeError'>: Don't know how to convert parameter 2 |
| 02:11 | sunru | its no big deal |
| 02:11 | Luyt | I saw a nice google video on ipython a while ago... lemme see... |
| 02:11 | learneralways | i have a small doubt -- need help |
| 02:11 | sunru | although, it would make a better bash :P |
| 02:11 | Heltskay | Doesn't seem to be working with a lot of numbers in a list |
| list 1000 | ||
| 02:11 | learneralways | class Person(object): |
| instancesCount = 0 | ||
| def __init__(self, title=""): | ||
| Person.instancesCount += 1 | ||
| self.id = "tempst" | ||
| def testprint(self): | ||
| print "blah blah" | ||
| def __getattribute__(self, name): | ||
| 02:11 | scorchsaber_ | Nah, I like sh. Sh just needs a better superset than bash. |
| 02:11 | learneralways | print "in get attribute" |
| 02:11 | verte | Pasting > 3 lines? Use http://paste.pocoo.org/ |
| 02:11 | scorchsaber_ | learneralways: Use a pastebin please. |
| 02:11 | learneralways | a = Person() |
| 02:11 | Defined | learneralways: PASTEBIN |
| 02:11 | learneralways | a.testprint() |
| print a.id | ||
| i wrote this | ||
| 02:11 | Luyt | Ah yes, http://video.google.com/videoplay?docid=2025411588241625522 |
| 02:12 | learneralways | k |
| sorry | ||
| new to irc | ||
| 02:12 | scorchsaber_ | Defined: Don't bother, he pasted, and can't stop it after that. Dumb IRC clients are dumb. |
| 02:12 | learneralways | :D |
| 02:12 | Defined | yeah i know, but for future scorchsaber_ :) |
| 02:12 | Luyt | learneralways: If you're new to something, first watch quietly how others use it |
| 02:12 | learneralways | i am gettig this error |
| TypeError: 'NoneType' object is not callable | ||
| any hint? | ||
| 02:13 | Defined | does anyone know the answer to my question? :p |
| 02:13 | verte | learneralways, __getattribute__ returns nothing. |
| 02:14 | learneralways | __getattribute__ is called when attribute is accessed |
| 02:14 | scorchsaber_ | learneralways: your __getattribute__ doesn't return, and so returns None. |
| 02:14 | learneralways | what about method call? |
| 02:14 | scorchsaber_ | learneralways: Methods are also attributes. |
| 02:14 | verte | a method is an attribute that is callable. |
| 02:14 | learneralways | oh |
| 02:14 | verte | you want __getattr__ |
| 02:14 | learneralways | actually i want to trap all method calls |
| 02:14 | scorchsaber_ | learneralways: You always have to be careful with overriding __getattribute__ it's done for almost everything, which is hard to think about. |
| 02:15 | learneralways | to update a counter that some method is active |
| and cecrease that coutenr when it returns | ||
| 02:15 | Heltskay | KragenSitaker: Any ideea why it isn't working with a lot of numbers in a list? |
| 02:15 | verte | learneralways, then use a decorator. |
| 02:15 | scorchsaber_ | learneralways: I'd recommend using decorators instead of __getattribute__, if possible. |
| 02:15 | Heltskay | Can I upload my code somewhere so you could have a better vision? |
| 02:15 | jerojasro | hi all. is there any keyword/builtin called "some"? |
| 02:15 | scorchsaber_ | It can be done with __getattribute__ instead, but it's really nasty. |
| 02:15 | learneralways | sure |
| wait.. | ||
| 02:15 | jerojasro | like some(a_list...) |
| 02:15 | scorchsaber_ | jerojasro: Nope. |
| 02:16 | verte | perhaps you want filter() |
| 02:16 | scorchsaber_ | jerojasro: Do you mean sum()? |
| 02:16 | jerojasro | no |
| 02:16 | scorchsaber_ | Just checking. What should some() do? |
| 02:16 | jerojasro | I finished reading this |
| http://norvig.com/sudoku.html | ||
| see at the end, in the definition of the "search" function | ||
| 02:17 | jerojasro | he uses a function called "some", which I don't find being defined previously |
| 02:17 | learneralways | http://pastebin.com/m7ea2f01a |
| scorchsaber, http://pastebin.com/m7ea2f01a | ||
| contains the code | ||
| 02:18 | jerojasro | aww, don't listen to me, I found the definition |
| 02:18 | Heltskay | Here it is: http://paste.pocoo.org/show/96222/ can anyone have a look please? |
| 02:18 | jerojasro | http://norvig.com/sudo.py |
| 02:18 | scorchsaber_ | jerojasro: Alright, that's settled. |
| 02:18 | Heltskay | and I added all multiples of 5 too |
| 02:18 | jerojasro | I'm sorry all |
| 02:19 | Defined | If im using a function from a dll that puts data into a buff variable, in C++ the buff variable just be a char, what must it be in python? when i try make it an array i get: ArgumentError: argument 2: <type 'exceptions.TypeError'>: Don't know how to convert parameter 2 |
| 02:19 | scorchsaber_ | learneralways: Right. I believe we said all that needed to be said, unless you want to talk some more. |
| jerojasro: Don't be sorry. :D | ||
| 02:19 | learneralways | ok, i will get back to u later |
| 02:19 | verte | Heltskay, earn about modulo arithmetic and the % operator. |
| 02:19 | learneralways | thanks for input |
| 02:19 | AxleLonghorn | under http://docs.python.org/tutorial/errors.html#handling-exceptions , does "except Exception as inst:" through a syntax error because I have python 2.5.2? |
| *throw | ||
| 02:19 | jerojasro | Heltskay: why not to use the mod operator |
| ? | ||
| 02:19 | scorchsaber_ | AxleLonghorn: Yeah, that's new syntax. |
| 02:19 | verte | Defined, how do you have this DLL? in ctypes? |
| 02:19 | peleg | epydoc is really nice; though, it has one *major* problem -- it splits the javadoc's "@param a integer The base" to two lines: @type a integer \\ @param a The Base. This is super-frustrating... Do you have a recommendation of another python documetation engine? |
| 02:19 | scorchsaber_ | AxleLonghorn: I'm not sure if it can be enavled in 2.5-- it can in 2.6 |
| 02:20 | scorchsaber_ | enabled* |
| 02:20 | Defined | verte: yeah, windll.LoadLibrary |
| 02:20 | Heltskay | jerojasro: Maybe because I don't know about it yet heh, but anyways can you tell me why its not generating what it should? |
| 02:20 | verte | Defined, well you need to use a ctypes char. |
| 02:20 | Defined | ah alright, ill try that thanks |
| 02:21 | verte | c_char_p |
| 02:21 | Defined | ok |
| 02:21 | AxleLonghorn | scorchsaber_: thanks, it threw me for a loop that something in the tutorial didn't work |
| 02:21 | jerojasro | Heltskay: float division won't give you the result you need, as it isn't exact |
| 02:21 | Heltskay | jerojasro: http://paste.pocoo.org/show/96224/ |
| 02:22 | Heltskay | I used set between l1 and l2 |
| But as you can see there its incorrect | ||
| 02:22 | XazZ | evening |
| can someone give me a quick hint why I get this message: http://nopaste.ch/7e0391081631a08.html | ||
| 02:22 | Heltskay | 15 is divisible for 3 and 5 also and its not listed there |
| 02:22 | XazZ | I know you're no psp support channel - but that python error should be known to some python devs |
| 02:23 | khaije1 | wow... lolcode is an actual language? i thought it was a joke |
| 02:24 | khaije1 | well i guess it still sort of is... |
| 02:24 | kosh | thing can be real and a joke at the same time |
| look at vb | ||
| 02:24 | verte | XazZ, someone has named a module 'select', which is the name of a module in the standard library. |
| 02:24 | Heltskay | jerojasro?:) |
| 02:25 | verte | Heltskay, learn to use % to calculate congruence instead of testing a / b == int(a / b) |
| 02:25 | jerojasro | Heltskay: here. yes, listen to verte |
| 02:25 | verte | you'd usually test a % b == 0 |
| 02:25 | Heltskay | Its better you say? |
| 02:25 | verte | it works. and you don't need floats. |
| 02:25 | Heltskay | Dunno, i always find the hardest and worse choises :/ |
| 02:25 | jerojasro | a % b gives you the remainder of the integer division of a / b |
| 02:25 | XazZ | verte: oooooh |
| 02:25 | Heltskay | Thanks for the suggestion i'll go do it |
| 02:25 | XazZ | verte: that might be the answer :) |
| 02:26 | XazZ | verte: thanks :D |
| 02:26 | Defined | i really wish this dll had documentation, im working purely on trial and error which is extemely time consuming |
| 02:26 | verte | no worries! |
| 02:26 | jerojasro | Heltskay: well, if you don't know about it you'll hardly use it |
| 02:26 | Heltskay | Btw, your saying that the problem is actually the a/b == int(a/b) thing? |
| 02:26 | jerojasro | I had the same issue on my first programming course |
| Heltskay: yup | ||
| 02:26 | Heltskay | I know about it, modulus operator, i just forgot about it |
| 02:27 | verte | Defined, surely there's documentation for the dynamic loader on nt internals or msdn? |
| 02:27 | Heltskay | modulus = modulo. :) |
| 02:27 | verte | or whats that one the wine devs use? |
| 02:28 | learneralways | i need to trap all method calls in a class to update a counter which is increased when a method is called and decreased when method returns, with each method having it own counter. problem with decorator is needs to be explicitly specified before each method. i want a solution which automatically does so. i was thinking about metaclass but i m not sure if it can be used. |
| any ideas? | ||
| 02:28 | Defined | verte: maybe, but not on the actual DLL's functions |
| 02:28 | verte | Heltskay, checking floats for equality rarely works because of the imprecision |
| 02:28 | learneralways | scorchsaber? |
| 02:29 | verte | learneralways, sure, you can use a metaclass. but why? |
| 02:29 | XazZ | verte: you were so right - thanks (problem solved - /me happy :)) |
| 02:29 | kosh | later freaks |
| 02:29 | verte | nice |
| 02:29 | kosh | turns on the soul sucker and walks out |
| 02:30 | learneralways | metaclass-how should i do it? |
| :( | ||
| 02:30 | Defined | verte: do you know if theres a ctypes char array? |
| 02:30 | learneralways | is metaclass best way to go? |
| 02:30 | verte | on __init__, walk the class dict, and wrap each callable that doesn't start with _ with your decorator. |
| 02:30 | Defined | verte: because i think it needs to be a char array |
| 02:30 | Luyt | learneralways: Are you implementing some kind of locking mechanism? |
| 02:31 | learneralways | yup |
| i will have to | ||
| 02:31 | verte | learneralways, there are several monitor implementations |
| 02:31 | Luyt | There exist maybe smarter solutions |
| 02:31 | learneralways | verte: not clear to me what u said |
| google keywords? | ||
| 02:32 | verte | Defined, MS C does no runtime type checking. a char array and a pointer to a char are the same thing at that point. |
| 02:32 | learneralways | for search |
| 02:33 | sergeykish | sergeykish_ |
| 02:36 | learneralways | i need to trap all method calls in a class to update a counter which is increased when a method is called and decreased when method returns, with each method having it own counter. problem with decorator is needs to be explicitly specified before each method. i want a solution which automatically does so. i was thinking about using metaclass. any help with metaclass? i would really really thankful ! a small code snippet would really help |
| 02:37 | Luyt | Sounds like you're inventing your own locking mechanism, where existing solutions might exist. |
| 02:37 | cratylus | Luyt, i mapped from the dictionary back to the object's atribute instead of the other way. i think it avoids side effects like you recommended. thanks for the pointer |
| 02:37 | learneralways | i am not inventing locking mechanism but i need such counter |
| 02:37 | scorchsaber_ | learneralways: The metaclass could automatically apply the decorator to each method, I think, in the __new__ method of it. You'd check whether an element in its dict was a method, and if so, apply the decorator. |
| 02:38 | learneralways | to check if any method call is in progress |
| 02:38 | Luyt | a semaphore to prevent re-entry |
| 02:38 | scorchsaber_ | The only use I could think of it was to look at recursion. Then again, I'm no threading kind of guy. |
| 02:39 | verte | learneralways, there are existing monitor implementations. for example, python-safethread, or the multiprocess module. |
| 02:39 | Luyt | and maybe this sounds familiar? http://www.python.org/doc/2.5.2/lib/semaphore-objects.html |
| 02:39 | learneralways | actually the higher goals is to be make changes in class if it is not active |
| 02:40 | learneralways | like adding/deleting methods |
| so i need to lock the class from further calls | ||
| 02:40 | Luyt | Hmmm, interesting |
| 02:40 | KragenSitaker | Heltskay: sorry, I wasn't paying attention |
| 02:40 | learneralways | and only after update it should resume |
| 02:40 | Luyt | A class which mutates during runtime |
| 02:41 | learneralways | basically-dynamic software evolution |
| 02:41 | verte | for key, value in classdict.iteritems(): if callable(value) and not key.startswith('_'): classdict[key] = my_decorator(value) |
| 02:41 | Luyt | Maybe the State pattern is useful? Or are the states not known in advance? |
| 02:41 | KragenSitaker | I like ipython |
| 02:41 | Heltskay | Its ok |
| KragenSitaker, what do you think?:) the other guys suggested that i should use % | ||
| 02:41 | sunru | KragenSitaker: I best IDE i've used was turbopascal about 20 years ago :/ |
| 02:41 | verte | KragenSitaker, how long have you been using it? |
| 02:41 | learneralways | verte: thanks for direction |
| 02:42 | KragenSitaker | sunru: yeah, TP was pretty nice |
| 02:42 | Luyt | Turbopascal was blinding fast |
| 02:42 | scorchsaber_ | The only upgrade I would ever do for Python's REPL would be to use a different shell. Windows' shell is crap, hard to deal with, etc. |
| 02:42 | Luyt | You pressed F5 and the program compiled in 1 second |
| 02:42 | sunru | ipython is well needed. |
| 02:42 | KragenSitaker | sunru: you know you can download old versions |
| Heltskay: what's the problem? | ||
| 02:42 | sunru | KragenSitaker: i still got the borland box i think. |
| or did mum throw it away :( | ||
| 02:42 | KragenSitaker | sunru: unfortunately they still don't generate 32-bit ELF executables for Linux |
| 02:42 | Luyt | I was a big fan of Turbo C. |
| Still use Borland C++ Builder on a daily basis | ||
| 02:43 | Heltskay | KragenSitaker: The list that returns is not correct |
| It misses some numbers | ||
| a sec | ||
| 02:43 | KragenSitaker | Heltskay: the list what returns? |
| 02:44 | KragenSitaker | sunru: I bind F5 to 'recompile in Emacs |
| 02:44 | learneralways | verte, how will i call that code |
| before moethod call? | ||
| 02:44 | KragenSitaker | sunru: and do you know about C-M-x in Emacs python-mode? |
| 02:44 | verte | learneralways, in the metaclass __init__. |
| 02:44 | sunru | KragenSitaker: i think i'll stay in ipython for a whie to come. |
| 02:44 | sunru | uses vim |
| 02:44 | Heltskay | l1 are all numbers divisible by 3, l2 are all divisible by 5, (from 1 to 1000), l3 suppose to be the common numbers, I used set for that |
| 02:44 | learneralways | but in metaclass _init- it will called only once |
| 02:44 | verte | learneralways, as you can see, it decorates callables that don't begin with _ |
| 02:44 | Luyt | Sunru: http://video.google.com/videoplay?docid=2025411588241625522 |
| 02:44 | KragenSitaker | sunru: I don't know if there's an equivalent to C-M-x in vim |
| 02:44 | learneralways | when class is created |
| 02:45 | verte | learneralways, the function the decorator returns will be called each time. |
| 02:46 | learneralways | ok, now i got ur idea |
| let me try and get back 2 u | ||
| 02:46 | KragenSitaker | Heltskay: so you're saying that (set(n for n in range(1, 1001) if n % 3 == 0) & set(n for n in range(1, 1001) if n % 5 == 0)) - set(n for n in range(1, 1001) if n % 3 == 0 and n % 5 == 0) is nonempty? |
| 02:46 | itsmonktastic | Lmao, that is project euler problem 1, isn't it! |
| 02:47 | Heltskay | heh |
| 02:47 | KragenSitaker | because it's empty for me |
| 02:47 | KirkMcDonald | KragenSitaker: Why the generator expressions and not just set(range(1, 1001)) ? |
| 02:47 | odinsbane | How can I 'reimport' a module. Its for development only. |
| 02:47 | itsmonktastic | Heltskay: Is it? |
| 02:47 | KragenSitaker | KirkMcDonald: that would include numbers such as 2 |
| 02:47 | scorchsaber_ | KirkMcDonald: The if statements that are within the genexps. |
| 02:47 | KragenSitaker | odinsbane: reload(os) |
| 02:47 | KirkMcDonald | Oh, ues. |
| yes* | ||
| I can read, really! | ||
| 02:48 | KragenSitaker | the code isn't particularly well formatted :) |
| 02:48 | Luyt | Heltskay: Fifteens? http://rafb.net/p/p6PN5E33.html |
| 02:48 | scorchsaber_ | I've made worse mistakes. Like that one time, with the lambda, and the "short circuiting" operator... |
| 02:48 | Heltskay | sets? |
| Aah | ||
| Thank you, Luyt. | ||
| 02:49 | itsmonktastic | Heltskay: If that really is your solution to problem1, I can tell you that is the worst way of doing it. >.< |
| 02:49 | verte | well, that's the idea. |
| 02:49 | KragenSitaker | itsmonktastic: once he solves the problem he will get access to the discussions of different ways of solving it, no? |
| 02:49 | Heltskay | itsmonktastic: Luyt's solution or the one I posted on the pastebin? |
| 02:49 | itsmonktastic | True. I'll leave it. I just wish people would think a little first. :p |
| 02:50 | itsmonktastic | Heltskay: Any solution using trial division, I didn't read the pastes. |
| 02:50 | Luyt | Not everybody is mathematically inclined |
| 02:50 | KragenSitaker | hey, it is rare that the first solution one comes up with is the best one |
| 02:50 | Heltskay | Heh |
| 02:50 | itsmonktastic | Fair point. :) |
| 02:50 | Heltskay | Yeah, I don't know whats up with that, I always pick up the worse solutions, maybe its a curse or smthing |
| 02:51 | scorchsaber_ | Some solutions are entirely non-intuitive. Still can't figure out how to do prime integer factorization without trial, on a level that I actually comprehend. |
| 02:51 | itsmonktastic | Nah it's ok. |
| 02:51 | scorchsaber_ | Then again, I haven't tried to figure it out in ages. |
| 02:51 | sunru | my math teacher was an alcoholic and passed everyone. |
| 02:51 | itsmonktastic | I'm clearly diverting the topic. Apologies. |
| 02:51 | sunru | because of him I suffer at understand the world. |
| 02:51 | scorchsaber_ | itsmonktastic: We probably don't care. |
| 02:51 | sunru | i had a bad english teacher as well. |
| 02:51 | Defined | verte: uhm, i guess im doing something else wrong then because its not outputting any real data into the buffer |
| 02:52 | Luyt | I learned myself English and maths |
| 02:52 | scorchsaber_ | taught* |
| 02:52 | Luyt | taught* |
| ;-) | ||
| 02:52 | scorchsaber_ | snickers evilly |
| 02:52 | sunru | haha |
| back to school 4U | ||
| 02:52 | KragenSitaker | scorchsaber_: enumerating the multiples of some number can be done by multiplication rather than division |
| 02:52 | Luyt | I'd rather stay glued to Wikipedia all day |
| 02:52 | scorchsaber_ | He's already at school. Every second of every day of every week. Eww. |
| 02:52 | sunru | they need your money Luyt |
| 02:53 | sunru | implants subliminals. |
| 02:53 | KragenSitaker | scorchsaber_: I don't understand the nicer factorization algorithms either |
| 02:53 | scorchsaber_ | KragenSitaker: Yes, but there's some weird solutions that narrow down the time significantly. I believe they rely on mathematical theorems that I should prove first. |
| 02:53 | itsmonktastic | I don't understand the prime sieve at all. |
| 02:53 | scorchsaber_ | The ones that don't actually solve for all input are the weird ones. |
| 02:53 | KragenSitaker | itsmonktastic: the sieve of eratosthenes, or oneo f the other sieves? |
| when I factorize numbers in my head I enumerate primes and check for divisibility | ||
| 02:54 | itsmonktastic | Yeah, eratosthenes, I guess. |
| My method just involved checking for prime divisibility up to route n. | ||
| 02:54 | Taggnostr | I wrote a program to factorize numbers in prime factors |
| 02:54 | KragenSitaker | for factors other than 2 or 5, you can divide by 10 without affecting divisibility by your trial factor |
| 02:54 | Taggnostr | it factorized 1234567890123456789012345678901234567890 in ~3 seconds |
| 02:55 | KragenSitaker | Taggnostr: impressive! |
| what is the result? | ||
| so you add or subtract a multiple of your trial factor to get to a multiple of 10, then divide by 10 | ||
| 02:55 | Taggnostr | 2 × 3² × 5 × 73 × 101 × 137 × 3541 × 3607 × 3803 × 27961 × 1676321 × 5964848081 |
| but I've noticed that sometimes is not accurate with big numbers, I don't know why | ||
| 02:56 | KragenSitaker | Taggnostr: that doesn't look like a terribly hard factorization |
| 02:56 | Taggnostr | that is, if you try to multiply them you get something slightly different |
| 02:56 | verte | but a fairly typical one. |
| 02:56 | KragenSitaker | since you only have to try primes up to 77232 |
| 02:56 | verte | 1676321? |
| 02:56 | Taggnostr | yep, it may be far slower if you have big primes |
| 02:56 | KragenSitaker | did you use a cleverer algorithm than just trial divison by all primes? |
| 02:57 | Taggnostr | it's just bruteforce division |
| 02:57 | Luyt | http://mathworld.wolfram.com/PrimeFactorizationAlgorithms.html |
| 02:57 | Defined | verte: the value of the c_char_p is 'None' |
| 02:57 | Taggnostr | odd numbers between 0 and sqrt(n) |
| 02:57 | KragenSitaker | so to factor, say, 13780 in my head |
| I can drop out 2 and 5 right away to get to 1378 | ||
| 02:58 | KragenSitaker | there's another factor of 2, and I get 688 |
| and another, to 344 | ||
| 02:58 | itsmonktastic | 689 |
| 02:58 | Defined | verte: can i set a size for the c_char_p? |
| 02:58 | KragenSitaker | oops, right, thanks |
| 02:58 | Taggnostr | 2² × 5 × 13 × 53 |
| 02:58 | itsmonktastic | Sorry, it's interesting, carry on :p |
| 02:59 | KragenSitaker | so at that point it's not divisible by 2 or 5; I can see by the digit sum that it's not divisible by 3 |
| so to see if it's divisible by 7, I subtract 49 to get 640 | ||
| which is 10*64, and 64 is not divisible by 7 | ||
| 02:59 | itsmonktastic | Mm. |
| 03:00 | KragenSitaker | the digit-sum method for mod-11 says 689 % 11 = 6 + 9 - 8 = 7 |
| so it's not divisible by 11 either | ||
| 03:00 | sunru | why 49? |
| 03:00 | KragenSitaker | for 13, I subtract 3×13 = 39 to get 650, which is 65×10 |
| 03:00 | verte | Defined, sizes aren't carried around by the C VM at runtime. how are you checking the value of the buffer? |
| 03:00 | KragenSitaker | because 49 gets us to a multiple of 10 |
| 03:01 | verte | Defined, are you setting the c_char_p before sending it to the function? |
| 03:01 | KragenSitaker | 65 is 5×13 |
| so 689 is divisible by 13 | ||
| 03:01 | verte | Defined, oh! |
| 03:01 | itsmonktastic | Which takes us to 8, which is 2^3. Cool. |
| 03:01 | verte | Defined, use create_string_buffer! |
| 03:01 | Taggnostr | 8? |
| 03:02 | itsmonktastic | Oh, sorry, I suck. |
| 03:02 | KragenSitaker | and specifically it's (50 + 3) × 13 |
| 03:02 | itsmonktastic | Yeah. |
| 03:02 | Taggnostr | and 53 is prime |
| 03:02 | KragenSitaker | right |
| 03:02 | Defined | verte: ill try that |
| 03:02 | KragenSitaker | you only have to try primes up to 8 to know that 53 is prime if you aren't friends with 53 already |
| 03:03 | Taggnostr | I just use my program :P |
| 03:03 | KragenSitaker | yeah, your program doesn't need 5 minutes to factor a 5-digit number :) |
| I usually use the factor(1) program from BSD | ||
| 03:04 | Taggnostr | I still have to see why the result is not always accurate |
| 03:04 | KragenSitaker | yeah, I wonder what the problem is |
| does it print out the answer in the nice Unicode form that you have above? | ||
| 03:05 | KragenSitaker | Luyt: thanks for the mathworld link |
| 03:05 | Taggnostr | yes |
| that one is correct though | ||
| 03:05 | itsmonktastic | q |
| 03:05 | Luyt | np. http://www.math.umbc.edu/~campbell/Computers/Python/numbthy.html#Packages has a nice numbthy.py module with Pollard factorisation. 1234567890123456789012345678901234567890 is instantly factored in [2, 3, 3, 5, 73L, 101L, 137L, 3541L, 3607L, 3803L, 27961L, 1676321L, 5964848081L] |
| 03:05 | Xamusk | is there some inverse function to vars() ? one that takes a dict and make those attributes of an object? |
| 03:06 | KragenSitaker | heh, beerandcondoms.com |
| 03:06 | Xamusk | math junkies should take a look at sagemath.org |
| 03:06 | scorchsaber_ | Xamusk: I don't know what cars() is, and it sounds evil. What kind of object do you want, though? |
| 03:07 | KragenSitaker | Xamusk: you could set __dict__ to your dict |
| 03:07 | jhesketh | Hi. I have a list like [[1,2,3],[5,6,3]] and I need to change that to [1,2,3,5,6,3] as efficiently as possible |
| 03:07 | KragenSitaker | yeah, cars are totally evil |
| 03:07 | scorchsaber_ | Xamusk: You could easily write such a function yourself. |
| 03:07 | habnabit | KragenSitaker, eeeeugh, don't do that. |
| Xamusk, nothing builtin. | ||
| 03:07 | jhesketh | (preferably in one line) |
| 03:07 | KragenSitaker | Xamusk: as habnabit is pointing out, this is a good way to get yourself into trouble by making your program incomprehensible |
| 03:07 | scorchsaber_ | Nothing /nice/ built in, but there are callables that take dicts and return objects. They're not the same sort of thing, though. |
| 03:07 | habnabit | jhesketh, [x for subL in L for x in subL] |
| 03:07 | Defined | verte: that looks better, the dll's function still isnt setting the values, but the char variable looks better now |
| 03:08 | Taggnostr | sum(L, [])? |
| 03:08 | KragenSitaker | jhesketh: will itertools.chain work for you? |
| 03:08 | habnabit | Taggnostr, no. |
| Taggnostr, don't do that. | ||
| 03:08 | KragenSitaker | yes, sum works too, but it might be expensive |
| O(N²) | ||
| 03:08 | Xamusk | KragenSitaker, I just wanted to do some sort of enum with 3 less characters each time I use it |
| 03:08 | habnabit | Taggnostr, sum is for *sums*. Y'know, repeated addition of numbers. |
| 03:09 | jhesketh | habnabit: thanks |
| 03:09 | scorchsaber_ | KragenSitaker: Eh? It should be O(n) |
| A nasty O(n), but O(n). | ||
| 03:09 | KragenSitaker | scorchsaber_: reallylonglist + shortlist is O(len(reallylonglist) + len(shortlist)) |
| 03:09 | habnabit | scorchsaber_, no, it's O(n^2). |
| 03:09 | Luyt | Xamusk: __dict__.update, see |
| class V: | ||
| pass | ||
| V.age=23 | ||
| V.name="Jan" | ||
| print vars(V) | ||
| D={"telephone": "020-18723", "weight": 80} | ||
| 03:09 | habnabit | scorchsaber_, it's L1 + L2 + L3 + L4... |
| 03:10 | Luyt | V.__dict__.update(D) |
| 03:10 | KragenSitaker | reallylonglist will grow from addition to addition inside of sum |
| 03:10 | Luyt | print V.telephone |
| print V.weight | ||
| OOps | ||
| 03:10 | habnabit | Luyt, don't paste to the channel. |
| 03:10 | Luyt | Wrong key, sorry. |
| 03:10 | habnabit | Luyt, also, __dict__.update is wrong too. |
| 03:10 | Taggnostr | ok |
| 03:10 | KragenSitaker | I don't think sum() is that nasty |
| 03:10 | Luyt | Is it? |
| 03:10 | scorchsaber_ | habnabit: Oh, whoops. I'm thinking of the wrong operation. |
| And KragenSitaker ^ | ||
| 03:10 | habnabit | Luyt, yep. You want setattr. |
| 03:10 | scorchsaber_ | Was not thinking of appends. |
| 03:11 | verte | you could reduce operator.iadd ;) |
| 03:11 | Luyt | Well, my stab is in http://rafb.net/p/Gf8BTL18.html |
| 03:11 | habnabit | verte, bleeeh. |
| 03:11 | KragenSitaker | setattr is more orthogonal; __dict__ is a way to muck around with object internals |
| 03:11 | verte | or list.append. |
| 03:11 | KragenSitaker | haha |
| 03:11 | verte | extend, rather. |
| 03:11 | habnabit | KragenSitaker, yes, so playing with __dict__ totally avoids properties. |
| 03:11 | KragenSitaker | I don't think extend returns self |
| 03:11 | habnabit | KragenSitaker, that's usually the Wrong Thing. |
| Luyt, ^ | ||
| 03:12 | KragenSitaker | habnabit: yes, and won't work with __slots__, etc. |
| 03:12 | scorchsaber_ | None of them are decent. |
| 03:12 | habnabit | KragenSitaker, that too. |
| 03:12 | Luyt | omg I also forgot to instantiate the class |
| 03:12 | verte | well, there's no point reducing extend, it's true |
| 03:13 | KragenSitaker | I like your indecent operator.iadd idea :) |
| 03:13 | habnabit | reduce(lambda L, subL: L.extend(subL) or L, L) |
| reduce(lambda L, subL: L.extend(subL) or L, L, []) even. | ||
| 03:13 | verte | for L in lists: mylist.extend(L) |
| 03:13 | perlsyntax | Is there any bug in python 2.6.0? |
| 03:13 | KragenSitaker | perlsyntax: probably hundreds |
| 03:13 | habnabit | perlsyntax, read the changelog for 2.6.1. |
| 03:14 | perlsyntax | no italking about 2.6.0 |
| 03:14 | habnabit | perlsyntax, well, the changelog for 2.6.1 would presumably show changes since 2.6.0. |
| 03:14 | KragenSitaker | habnabit: do you prefer your lambda to operator.iadd? I think .extend() in a loop is probably the best way to write flatten |
| 03:14 | scorchsaber_ | perlsyntax: Yes. 2.6.1 has bugfixes, and thus documents them. |
| 03:14 | habnabit | perlsyntax, such as, bugs. |
| 03:15 | KragenSitaker | habnabit: rather than using redue |
| ce | ||
| 03:15 | perlsyntax | i see |
| 03:15 | habnabit | KragenSitaker, I'd rather use repeated extends, or a list comprehension. |
| 03:15 | KragenSitaker | or you could write list(itertools.chain(L)) |
| 03:15 | habnabit | KragenSitaker, but I love writing nasty one-expression things. |
| 03:15 | verte | [x for x in L for x in x] |
| 03:15 | habnabit | KragenSitaker, that's itertools.chain(*L) |
| 03:15 | scorchsaber_ | verte: That looks disgusting. |
| 03:15 | KragenSitaker | oh right, thanks |
| 03:15 | verte | it is. |
| 03:16 | KragenSitaker | that is terrible, verte |
| 03:16 | habnabit | scorchsaber_, it even works if the original list was called x. |
| [L for L in L for L in L] | ||
| 03:16 | KragenSitaker | hahaha |
| 03:16 | verte | except that it clobbers the name in some versions of python. |
| 03:16 | scorchsaber_ | yaaaargh. |
| 03:16 | habnabit | list(L for L in L for L in L) |
| 03:16 | verte | :) |
| 03:17 | KragenSitaker | habnabit: you should organize an IOPCC |
| 03:17 | habnabit | I really should. |
| 03:17 | scorchsaber_ | If that means anything related to his hobby, no, he shouldn't. |
| Grr. | ||
| 03:17 | verte | I blame out omlette-oriented friend for that one. |
| 03:17 | KragenSitaker | scorchsaber_: you know about the IOCCC? it is fantastic |
| 03:17 | scorchsaber_ | KragenSitaker: Never heard of it. |
| 03:17 | sunru | can ipython browse eggs? |
| 03:18 | KragenSitaker | scorchsaber_: you have to learn C before you can appreciate it |
| 03:18 | verte | there was an obfuscated python contest. maybe at MIT? |
| 03:18 | habnabit | I should give a lightning talk about python obsfucation at PyCon. |
| 03:18 | verte | are you going? |
| 03:18 | habnabit | Thinking about it. |
| 03:18 | scorchsaber_ | habnabit: Dress as a woman for it. It's a visual metaphor. |
| 03:19 | KragenSitaker | ? |
| 03:19 | habnabit | scorchsaber_, I don't get it. |
| 03:19 | scorchsaber_ | habnabit: :( |
| Obfuscation <-> disguise . Not to mention you're turning something reasonably attractive to dead ugly. | ||
| 03:19 | sunru | is there a talk on wsgi anywhere? |
| 03:19 | habnabit | Oh, hahahah. |
| 03:19 | KragenSitaker | oh |
| 03:20 | scorchsaber_ | At least, I assume you're reasonably attractive. |
| As long as you're not over 800 lbs, you're good. | ||
| 03:20 | KragenSitaker | scorchsaber_: are you trying to get him to show us his tits? |
| 03:20 | scorchsaber_ | uhhhh |
| 03:20 | habnabit | I have a video of me on youtube. |
| 03:20 | sunru | are you talking about wsgi? |
| 03:21 | verte | no? |
| oh. ha. | ||
| 03:21 | sunru | :) |
| 03:21 | Luyt | http://video.google.com/videoplay?docid=-872784530622495809 ? |
| 03:22 | sunru | might have seen that. |
| 03:22 | QwertyManiac | QwertyM |
| 03:22 | scorchsaber_ | I wish I could consider giving a talk at a convention. I'd have nothing to talk about, though. Damn you, habnabit. |
| 03:22 | sunru | the really dodgy audio? |
| 03:23 | sunru | ahh yeh the dodgy audio one. |
| 03:23 | habnabit | scorchsaber_, A* optimization? |
| 03:23 | KragenSitaker | scorchsaber_: don't sell yourself short. There are surely things you know that are interesting and that not everybody else knows yet! |
| 03:23 | scorchsaber_ | habnabit: I'd have nothing to say above the obvious-- there are people that have worked on it for years. I just read what they did and applied it to my code. |
| 03:23 | sunru | whos behind paste? |
| 03:23 | KragenSitaker | paste? |
| 03:24 | sunru | theres a really good python talk... |
| 03:24 | scorchsaber_ | KragenSitaker: Oh, "not everybody". I could do that. maybe talk about, oh, Python. :P |
| 03:24 | verte | KragenSitaker, it's a webserver, among other things. |
| 03:24 | KragenSitaker | scorchsaber_: that would totally work at a Bar Camp |
| verte: oh, ok :) | ||
| 03:24 | scorchsaber_ | KragenSitaker: It'd work in a lot of places, and I'd do it. |
| 03:25 | KragenSitaker | A* is a pretty interesting possibility too |
| I was just looking at A* for spell-correction last week | ||
| 03:26 | sunru | http://video.google.com/videoplay?docid=7760178035196894549 |
| 03:26 | KragenSitaker | (the objective: find the shortest path of edits from the misspelled word to anything in the dictionary) |
| 03:26 | sunru | covers alot. |
| 03:27 | pranny|afk | pranny |
| 03:27 | Luyt | I've seen that Wouters lecture before, it's worth watching ;-) |
| 03:27 | sunru | yeh |
| 03:27 | Luyt | As are Alex Martelli's ones |
| 03:27 | scorchsaber_ | KragenSitaker: Interesting. The difficult part is in actually constructing the graph, and doing it well and speedily (rather than A* itself). |
| 03:27 | sunru | alot to talk about |
| keep talking. | ||
| 03:27 | verte | is that the 'advanced python' one? |
| 03:27 | sprinky | Good evening, I was wondering which book you guys recommended for somebody who wants to learn Python. Could you please give me some recommendations? |
| 03:28 | verte | (that wasn't very advanced.) |
| 03:28 | sunru | looks its irc with moderation and your the only one with v+ |
| 03:28 | Luyt | sprinky: What's your background? |
| 03:28 | sunru | have have 60mins. |
| 03:28 | sprinky | Luyt: I'm a relatively inexperienced programmer, although I have been slowly learning C. |
| 03:28 | Belxjander | I know the sort of talk I would give at a convention and Id prolly get things thrown at me or a quiet audience going ..."huh?" |
| 03:28 | scorchsaber_ | KragenSitaker: Plus I'm not sure whether A* would be possible, rather than Dijkstra's algorithm. The latter would also have the benefit of being able to generate the graph on the fly, rather than work out heuristics involving a full graph to the words. |
| 03:28 | sunru | Belxjander: cool |
| 03:28 | scorchsaber_ | But... hey! |
| 03:28 | sunru | can i be security. |
| 03:29 | sunru | dressed like a stormtrooper |
| 03:29 | Luyt | If you really want a book, 'Learning Python' (Lutz et.al) will do |
| 03:29 | sunru | infact we'llg et a bunch of geeks dressed up as star warz bounty hunters etc. |
| 03:29 | Belxjander | sunru: certainly... if you dont mind my being quiet and being able to literally SAY passwords in front of the crowd and still have them get them wrong :) |
| 03:29 | sprinky | Thanks very much Luyt |
| 03:29 | scorchsaber_ | KragenSitaker: What's your current plan, if any? |
| 03:30 | Belxjander | Luyt: any copy of that online somewhere? |
| 03:30 | Luyt | Not that I know of |
| 03:30 | Belxjander | if I go to the store where I am.,.. I will kinda get a language problem... |
| 03:30 | Belxjander | is in Japan and all the local comp books are Japanese but I cant read enough to understand the text around the examples quiet yet |
| 03:30 | sunru | Belxjander: lisp? |
| 03:30 | KragenSitaker | scorchsaber_: depth-first search with early pruning |
| scorchsaber_: with an edit count limit | ||
| 03:31 | sunru | guri |
| 03:31 | KragenSitaker | scorchsaber_: doing edits from left to right in the word |
| 03:31 | Belxjander | sunru: pick a language... give me a day to hunt through documentation and make a cheat sheet and I"ll start writing a complete Application the next day if you really want |
| 03:31 | scorchsaber_ | KragenSitaker: Looks good. |
| 03:31 | verte | Belxjander, INTERCAL |
| 03:31 | Belxjander | verte: something I havent touched preferably for best effect... |
| 03:32 | KragenSitaker | scorchsaber_: with early pruning to see if the currently produced prefix is a prefix of any word in the dictionary |
| 03:32 | verte | 0_o |
| 03:32 | Belxjander | prolly best if I can actually do the whole thing live and show how alike most languages actually are |
| 03:32 | scorchsaber_ | KragenSitaker: Using a prefix trie? |
| 03:32 | KragenSitaker | scorchsaber_: no, just a dict of prefixes :) |
| 03:32 | sunru | got that wrong |
| 03:32 | KragenSitaker | Belxjander: you should show some languages that aren't so alike too |
| 03:33 | KragenSitaker | Belxjander: maybe Prolog, J, Excel, Erlang |
| 03:33 | Belxjander | verte: Ive done Application Writing in languages Ive only just met or been given the compiler to after about 20-40mins of reading docs to writing a fully debugged Windows Application... |
| 03:33 | KragenSitaker | Forth |
| SNOBOL | ||
| 03:33 | Belxjander | KragenSitaker: well I learnt C first, basic I played with and pretty much ignore until I have to deal with it... |
| 03:33 | KragenSitaker | Belxjander: because it's the languages that aren't so alike that are really educational |
| 03:34 | KragenSitaker | C and Basic are pretty similar |
| 03:34 | Belxjander | pascal Ive done an Overview, Modula +2+3+Oberon ... forth I havent seen yet... |
| 03:34 | verte | Belxjander, what have you written in INTERCAL? |
| 03:34 | Belxjander | Ive written an Installer using Lisp |
| modified a perl program with no prior knowing of perl... | ||
| 03:34 | KragenSitaker | Pascal and C are almost identical |
| INTERCAL is just silly | ||
| 03:34 | Belxjander | KragenSitaker: most algorythmic languages allow for some algorythms to be done regardless of the underlying language |
| 03:35 | KragenSitaker | Belxjander: you know about the Church-Turing thesis? |
| 03:35 | Belxjander | KragenSitaker: whats that ? |
| 03:35 | Belxjander | is entirely self-taught... |
| 03:35 | KragenSitaker | it's a broader version of the statement you just uttered |
| 03:35 | Belxjander | with regards most programming anyway |
| 03:36 | Belxjander | I have found a couple of quirks in assembler I had a little trouble dealing with at first... |
| 03:36 | KragenSitaker | yeah, assembly languages are pretty different from Lisp or Perl |
| C is kind of in between | ||
| 03:36 | Belxjander | and that was actually the original pre-protected-mode segment:offset memory addressing for the x86 architecture... |
| 03:36 | learneralways | need small help with decorators |
| 03:37 | Belxjander | KragenSitaker: well it took me about 2hours to get familiar with M68K Assembler |
| 03:37 | KragenSitaker | yeah, 68k is pretty nice that way |
| 03:37 | learneralways | need small help with decorators |
| 03:37 | KragenSitaker | Prolog, J, Excel, Erlang, Forth, and SNOBOL are all more different from each other and from the cluster of languages that you know than any of the languages you know are from one another |
| 03:37 | learneralways | http://pastebin.com/m2381a3da |
| 03:37 | pranny | pranny|afk |
| 03:37 | scorchsaber_ | 'ey, Haskell should be there. Maybe. |
| 03:37 | Belxjander | prolog...I remember reading about that back in high-school... something like 10-16 years ago |
| 03:38 | learneralways | getting error NameError: name 'f' is not defined |
| 03:38 | KragenSitaker | oh, yeahy, Haskell, sorry |
| 03:38 | papna | I say we give him a day with the J documentation. He might be able to start writing his own documentation the next day, but my bet is he commits suicide a few hours in. |
| 03:39 | wahben | Hi all, do I have to define a variable as "global" if I want to pass parameters to a class constructor called when defining an extended class? Example: class bob(people(data)): how can I get the program to read "data"? |
| 03:39 | verte | haskell is somewhat similar to ML |
| 03:39 | KirkMcDonald | learneralways: A decorator is a function. It takes a function as an argument, and it returns a function. |
| 03:39 | Belxjander | papna: where is it ? |
| 03:39 | KragenSitaker | learneralways: what is "f" supposed to be? |
| learneralways: also your code doesn't have any decorators in it | ||
| 03:39 | verte | wahben, have you read a tutorial? |
| 03:40 | learneralways | it is just the method called |
| 03:40 | Belxjander | papna: I havent mentioned my reading speed quite yet for a reason... |
| 03:40 | wahben | verte, yes, but im experimenting now.. |
| 03:40 | learneralways | here-it is testprint |
| 03:40 | verte | wahben, the constructor does not go in the inheritance list. |
| 03:40 | wahben | verte, thanks! |
| that answers.. | ||
| 03:40 | papna | Belxjander, I assume someone as resourceful as you can find it. It's not as bad as I joked, but at first glance, it looks like it is. |
| 03:41 | papna | Belxjander, http://www.jsoftware.com/ |
| 03:42 | zimmermanc | python have anything like this ? |
| http://github.com/aslakhellesoy/cucumber/wikis | ||
| 03:45 | KragenSitaker | learneralways: the way you are using 'f', it is what decoratorforall is trying to inherit from |
| 03:45 | verte | hahaha: "CLC-INTERCAL implements many of its own data structures, such as 'classes and lectures', by making the basic data types store more information rather than adding new types." |
| 03:45 | zimmermanc | i'm guessing not :D :( |
| 03:46 | learneralways | i need small helpl with passing arguments to decorators. a 10 line code is here |
| http://pastebin.com/d1ebd8ec3 | ||
| 'function' object has no attribute 'f' | ||
| KragenSitaker: see the new code | ||
| 03:46 | KragenSitaker | zimmermanc: not that I know of |
| 03:47 | learneralways | i need to call that wrapper for every method call |
| 03:47 | KirkMcDonald | learneralways: 'decorator for all' should be a function, not a class. |
| Er, without the spaces. | ||
| 03:47 | learneralways | but i have used as class also |
| 03:48 | learneralways | for example see this |
| 03:48 | KirkMcDonald | Yes, you can use a method as a decorator. |
| Any callable object will work. | ||
| 03:48 | learneralways | http://pastebin.com/m1be096fc |
| 03:48 | KragenSitaker | learneralways: staticmethod means that the 'self' argument isn't actually an instance of decoratorforall |
| iirc it's the first explicit argument you pass | ||
| 03:48 | KirkMcDonald | But in this case, all you require is a function. |
| 03:49 | KirkMcDonald | Or, rather, two functions, one inside the other. |
| 03:49 | learneralways | KragenSitaker: then how should i do it |
| i need to call that wrapper before every method call | ||
| 03:50 | phoe6 | I am trying to visualize how the tuple assignments work. For e.g. a,b = b, a swaps the values. What is actually happening under the hood. Any pointers to docs? |
| 03:51 | KragenSitaker | phoe6: use dis.dis to find out |
| 03:51 | phoe6 | dis.dis? |
| 03:52 | KragenSitaker | yeah, the dis function in the dis module |
| 03:52 | scorchsaber_ | phoe6: It's a nifty tool. |
| 03:53 | GoldyOrNugget | hi :) |
| 03:53 | KragenSitaker | phoe6: see http://gist.github.com/38562 |
| 03:53 | phoe6 | yes, just got to know about it. |
| 03:53 | KirkMcDonald | phoe6: dis will disassemble a Python function into bytecode. |
| 03:53 | phoe6 | never used dis in progs. yeah, seldom will we find the need to in programs. |
| 03:53 | airtonarantes | I'm following the example about how to do a browser with python+glade, here is my code:http://paste.pocoo.org/show/96227/ and here is my glade code: http://paste.pocoo.org/show/96228/ ..... my app is returning: SEGMENTATION FAULT and I don't know how to get working. Anyone can help me? |
| 03:53 | KirkMcDonald | learneralways: http://paste.pocoo.org/show/96229/ |
| 03:54 | KirkMcDonald | phoe6: To answer the question: b, a makes a tuple; then that tuple is iterated over, and its values assigned to a, b. |
| 03:54 | Luyt | Actually ROT_TWO is used. http://rafb.net/p/JeJctT93.html |
| 03:54 | verte | it depends on the size of the tuple. |
| 03:54 | KragenSitaker | KirkMcDonald: interestingly, while that's what happens in the model the language presents, that's not how it actually implements it in this case |
| 03:55 | KirkMcDonald | This can be considered an optimization. :-) |
| 03:55 | KragenSitaker | yes |
| 03:55 | verte | ROT_TWO is used to enforce the order of assignment. |
| 03:55 | KragenSitaker | but he did say "What is actually happening under the hood." |
| 03:55 | Defined | (BYTE) [32] Client Key ('A') - does anyone know what the 'A' means? |
| 03:56 | Defined | ah nevermind, i know... |
| 03:57 | Defined | sigh, now i really dunno what im doing wrong, 6:15am time to take a break... |
| 03:57 | verte | :) |
| 03:57 | GoldyOrNugget | Why does the 'IDLE subprocess couldn't make a connection' window always pop up? |
| whenever i try to open IDLE | ||
| 03:57 | Luyt | You have a firewall active? |
| 03:57 | Defined | verte: any chance you ever used NLS/SRP Protocol? |
| 03:58 | verte | your firewall is blocking the loopback |
| Defined, no. | ||
| 03:58 | GoldyOrNugget | and how can i disable the firewall? |
| 03:58 | Luyt | Depends on which firewall software you have installed |
| 03:58 | Defined | verte: well try stay away from it :p |
| 03:58 | verte | will do :) |
| 03:58 | GoldyOrNugget | i dont have any, so it's probably the built in windows one |
| XP | ||
| 03:59 | Defined | atleast that buffer you told me how to make is working :) |
| 03:59 | Luyt | GoldyOrNugget: http://www.utexas.edu/its/support/topics/disable-wfw.php |
| 03:59 | Defined | the server rejects the value |
| but it does work | ||
| 03:59 | verte | http://en.wikipedia.org/wiki/File:INTERCAL_Circuitous_Diagram.svg <- that is awesome. |
| 03:59 | GoldyOrNugget | thx |
| i think i got it done | ||
| 04:00 | Luyt | bus line 8, to New York |
| 04:00 | GoldyOrNugget | Is there a way to use bool operators in a list comprehension? e.g. |
| '[x for x in range(1000) if (x%5===) or (x%3==0)]' | ||
| for a list of all #s divisible by 5 or 3 | ||
| 04:01 | KirkMcDonald | GoldyOrNugget: Er, exactly that should work. |
| 04:01 | Luyt | Also working on the Euler python challenge? |
| 04:01 | GoldyOrNugget | Luyt: ye ive done 34 of the probs :) |
| 04:01 | scorchsaber_ | I wonder if it's homework. Euler challenges are frequently assigned. |
| 04:01 | KirkMcDonald | GoldyOrNugget: (Except for the = that I think you meant to be a 0.) |
| 04:01 | GoldyOrNugget | nah... in my free time |
| 04:02 | GoldyOrNugget | oh yeh it works! Strange, i remember it not working... |
| 04:02 | Luyt | print [x for x in range(1000) if (x%5==0) and (x%3==0)] |
| 04:03 | Luyt | and instead of or ;-) |
| 04:03 | KragenSitaker | you don't need the parens |
| 04:03 | GoldyOrNugget | no, its or, isnt it? |
| I thought the only way was 'print sum(filter(lambda n: n%3==0 or n%5==0, [x for x in range(1000)])) | ||
| 04:03 | KragenSitaker | also you should note the result of "1000 in range(1000)" |
| 04:04 | KirkMcDonald | Luyt: 'and' means only numbers divisible by both 5 and 3. |
| 04:04 | KragenSitaker | also you should note that [x for x in range(1000)] == range(1000) |
| 04:04 | KirkMcDonald | That is, multiples of 15. |
| 04:04 | Luyt | Oh I see, the problem is to sum both multiples of 3 and 5 |
| But a few hours ago someone with this same problem wanted an intersection set of those numbers | ||
| 04:04 | GoldyOrNugget | KragenSitaker: oooh, right, im an idiot |
| 04:05 | KragenSitaker | perhaps he misinterpreted |
| 04:05 | Luyt | Yeah, think so ;-) and it's indeed range(1001) ;-) |
| 04:05 | GoldyOrNugget | "Find the sum of all the multiples of 3 or 5 below 1000." quoted from PE.com site |
| 04:05 | Luyt | Not including 1000? |
| 04:05 | scorchsaber_ | below means xrange(1000), not xrange(1001) |
| 04:05 | GoldyOrNugget | well 1000 not divisible by 3 so its irrelevant if the range is 1000 or 1001 |
| 04:06 | GoldyOrNugget | and neither is 1001 |
| 04:06 | Luyt | but 1000 is divisible by 5 |
| 04:06 | scorchsaber_ | 1000 is divisible by 5 |
| 04:06 | GoldyOrNugget | oh yeh, right :P |
| its below 1000 | ||
| my mistake | ||
| 04:06 | Luyt | then range(1000) should be fine |
| 04:06 | GoldyOrNugget | ye |
| and has anyone come up with a smart python way of doing " | ||
| How many letters would be needed to write all the numbers in words from 1 to 1000?" | ||
| 04:07 | KragenSitaker | write a function, number_in_words(n) |
| then sum it up | ||
| 04:07 | learneralways | i need to trap all method calls in a class to update a counter which is increased when a method is called and decreased when method returns, with each method having it own counter. i wrote a metaclass which wraps all the callable methods with a decorator. howevever it is not calling decorator. |
| is my approach right? where am i wrong? | ||
| http://pastebin.com/d5514d4e4 | ||
| 04:08 | learneralways | plzz help |
| 04:08 | GoldyOrNugget | KragenSitaker: but what would that function be? considering you have to count all the 'and's |
| for example, 1001 would be 'one thousand and one' | ||
| 04:09 | barretj | from the INTERCAL wikipedia page: Anything the compiler can't understand, which in a normal language would result in a compilation error, is just skipped. |
| 04:09 | verte | I really hate wikipedia. I'm not going to get anything done today. |
| 04:09 | barretj | sounds like HTML |
| 04:10 | KragenSitaker | GoldyOrNugget: well, you'll have to write it |
| 04:10 | learneralways | verte: plz help |
| 04:10 | barretj | or VBScript with On Error Resume Next |
| 04:10 | verte | that's how you create comments :) |
| 04:10 | GoldyOrNugget | grrrr... |
| 04:10 | Luyt | GoldyOrNugget: print sum([len(number_in_word(nr)) for nr in range(1,1001)]) |
| 04:10 | KragenSitaker | GoldyOrNugget: you might start out by considering all the possible words that might be used and where they come from |
| 04:11 | verte | learneralways, you typically don't want to wrap anything that starts with _. if you're accessing the private API, you already have a lock. |
| 04:11 | linux_user400354 | how can i replace only the second occurrence of something in a string? |
| 04:11 | KragenSitaker | GoldyOrNugget: you could start by writing a version that works for numbers from 0 to 10, then make it work for 0 to 20, then 0 to 99 |
| 04:11 | GoldyOrNugget | KragenSitaker: hmm, ill think about it for a while. |
| 04:11 | learneralways | i am not doign it for lock |
| but for counter | ||
| 04:12 | learneralways | which tells which method are active |
| 04:12 | KragenSitaker | GoldyOrNugget: you might find it more enjoyable if you start by writing some doctests for it and running them with the doctest module |
| 04:12 | verte | interesting. |
| 04:13 | learneralways | ? |
| 04:14 | KragenSitaker | GoldyOrNugget: because that way you can see concrete progress much more quickly, and you don't break anything you previously got working without noticing |
| 04:14 | GoldyOrNugget | wat's doctest? |
| 04:14 | KragenSitaker | doctest isn't ideal for everything but it is a lot easier to get started with than unittest and it should be fine for a function that has to return a string |
| 04:14 | GoldyOrNugget | never heard of it |
| 04:14 | KragenSitaker | well, look it up |
| 04:15 | GoldyOrNugget | k i will |
| 04:15 | Luyt | http://docs.python.org/library/doctest.html "The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown. " |
| 04:18 | Luyt | linux_user400354: I came up with http://rafb.net/p/6lYxBO18.html but it's not very elegant |
| 04:21 | scorchsaber_ | habnabit is a bastard. He's gotten me so interested in my own ego that I'm writing an A* tutorial. :( |
| On the plus side, I'm also learning reST. | ||
| 04:23 | verte | grr. |
| 04:23 | KragenSitaker | scorchsaber_: have you read Amit Patel's A* tutorial? |
| 04:23 | scorchsaber_ | verte: grrrowfRowf! |
| 04:24 | KragenSitaker | I thought it was pretty good |
| although I don't know enough about A* to be a good judge of that | ||
| 04:24 | scorchsaber_ | KragenSitaker: I saw it, didn't like it that much, IIRC-- I learned the basics off of Patrick Lester's page. |
| I'm thinking that since such good tutorials already exist, I'm just going to aim at optimization of A* in Python. | ||
| 04:25 | scorchsaber_ | Or, something. I'll see how it goes, and if I can produce anything of quality. |
| 04:26 | scorchsaber_ | I'm betting on no, but here I am. |
| 04:32 | verte | yeah. I'm sure it's something simple I'm missing. -> http://codepad.org/L2i9qWus |
| 04:34 | Luyt | I think I must read up on metaclasses |
| 04:35 | KirkMcDonald | Luyt: As with all else in Python, they're actually quite simple in the general outlines. |
| But man, you can do some messed up stuff with them. | ||
| 04:35 | GoldyOrNugget | brb guys |
| 04:35 | Luyt | I have never felt the urge to use metaclasses, probably because I didn't knew they existed |
| 04:36 | verte | learneralways, well: http://codepad.org/1IqL65HN |
| 04:39 | Luyt | http://www.ibm.com/developerworks/linux/library/l-pymeta.html looks like an appropriate article |
| 04:39 | rubyphyte | can you force the garbage collector to execute |
| 04:39 | Luyt | import gc; gc.collect() |
| 04:40 | rubyphyte | thanks! |
| 04:42 | Evanlec | Luyt: hi again, so this is the page i want to log into https://setup.ibbsonline.com/index.htm with my py app we were speaking about earlier, i notice it is https:// what do i need to do to adapt to that? |
| 04:42 | Luyt | Excellent question |
| 04:42 | Evanlec | heh |
| 04:43 | Evanlec | does the source code reveal anything ? |
| 04:44 | Luyt | Yes, it's a frame redirect to https://setup.ibbsonline.com/default.asp |
| 04:44 | Evanlec | ah |
| u found that reading this line.. <input type="hidden" value="/default.asp" name="nextpage"/> | ||
| 04:45 | Luyt | No, this line: <frameset><frame src="default.asp"></frameset> |
| 04:45 | Evanlec | oh heh |
| 04:45 | verte | ah, frames... |
| 04:45 | Evanlec | okay, so what does that mean for me? |
| 04:46 | Dude-X | Dude-X_ |
| 04:46 | verte | it means that the actual content is contained in a frame. |
| 04:46 | Evanlec | alright |
| 04:46 | verte | (a frame is another page) |
| 04:46 | Evanlec | yea, i hate frames |
| 04:46 | Luyt | It's a rather sneaky and dirty way of redirecting, often used by malware and phishing sites. |
| 04:47 | Evanlec | but is that going to make things messy for me trying to interact with it via python urllib? |
| lol | ||
| 04:47 | Luyt | Don't expect a high Google pageranking if you use frame redirects ;-) |
| 04:47 | Evanlec | this is sposed to be developed by a rather large corporation |
| 04:47 | lepassive | how to fetch data in between <li>data</li> using beautiful soup ? |
| 04:47 | Luyt | ...and probably also meant to keep from prying search engine eyes |
| 04:48 | Evanlec | i see |
| Luyt: so how does the frame issue affect what im trying to do? | ||
| 04:48 | Luyt | the frameset on the first URL is only used to redirect the browser to a new page |
| probably your python script only has to do business with the 2nd URL, https://setup.ibbsonline.com/default.asp | ||
| 04:49 | lepassive | found it tag.contents attribute thanks |
| 04:49 | Evanlec | alright, so i will want to query the default.asp page then |
| yea | ||
| gotcha | ||
| 04:49 | Luyt | it might as well refer that 2nd URL directly, the first one is pretty useless |
| 04:49 | Evanlec | indeed |
| 04:49 | Luyt | yeah. But I don't know how well the https protocol is supported by urllib/urllib2. I never had to do something with it |
| 04:49 | Evanlec | and what about login.asp |
| 04:50 | Luyt | the form action on default.asp refers to login.asp, indeed |
| so that is where the POST request should be aimed at | ||
| 04:50 | Evanlec | okay |
| 04:52 | linux_user400354 | Luyt, found out how to replace the second occurrence with not much code. |
| Luyt, >>> occurrence = 2 | ||
| >>> 'elephant'.replace('e','x',occurrence).replace('x','e',occurrence-1) | ||
| 'elxphant' | ||
| 04:52 | Evanlec | elephant? |
| 04:53 | linux_user400354 | yes, just an example |
| 04:53 | Luyt | interesting |
| 04:53 | KragenSitaker | linux_user400354: interesting! |
| wait | ||
| 04:54 | Luyt | aha, the replace() has a third parameter, I didnt know that ;-) |
| 04:54 | KragenSitaker | >>> 'xxxxelephant'.replace('e', 'x', 2).replace('x', 'e', 2-1) |
| 'exxxxlxphant' | ||
| 04:55 | verte | what if len(set(s)) == 256 ? |
| 04:55 | Luyt | verte: You have 256 elements in your set, I suppose |
| 04:56 | Evanlec | so does anyone know if authentication over https is possible with urllib/urllib2 ? |
| 04:57 | verte | Luyt, well, you can to special-case the replacement in that case. |
| 04:58 | sunru | hello if i 'from package import module' does package/__init__.py get invoked? |
| i guess i could easily test that. | ||
| 04:59 | scorchsaber_ | sunru: It has to, since __init__.py is what tells you whether module can be imported from package. |
| Although I could be horribly horribly wrong about that, since I was never all that confident with package stuff. | ||
| Please do test it. | ||
| 05:00 | Luyt | "if a package's __init__.py code defines a list named __all__, it is taken to be the list of module names that should be imported when from package import * is encountered. " |
| 05:01 | KragenSitaker | linux_user400354: maybe you should try this |
| 05:02 | KragenSitaker | i = s.index('e'); s[:i+1] + s[i+1:].replace('e', 'x') |
| linux_user400354: where s = 'elephant' for example | ||
| 05:02 | Luyt | My solution gets the elephant thing correctly: http://codepad.org/CgN6U6D7 |
| 05:04 | KragenSitaker | Luyt: your example is awesome |
| 05:05 | Luyt | It's not a oneliner, however |
| 05:06 | pranny|afk | pranny |
| 05:08 | sunru | thats pretty cool |
| 05:08 | KragenSitaker | does it deal correctly with matches at the beginning and end of string? I didn't think to check |
| 05:09 | GoldyOrNugget | wats it meant to do? |
| sorry i missed it | ||
| 05:09 | Luyt | Replace the 2nd (or 3rd, 4th etc) substring in a string with another string. |
| 05:10 | phoe6 | Hi, urlopen() returns a file like object in python. Any other method that returns a file-like object?? |
| 05:10 | habnabit | phoe6, StringIO.StringIO() |
| 05:10 | GoldyOrNugget | ooh neat |
| 05:10 | phoe6 | oh yeah. thanks habnabit |
| 05:10 | habnabit | phoe6, there's lots of things that do. |
| phoe6, gzip.GzipFile too. | ||
| 05:11 | habnabit | phoe6, why? |
| 05:11 | phoe6 | yes, there are.. I actually forgot due to some gap in using. |
| habnabit: it is for http://bugs.python.org/issue4608 | ||
| 05:12 | phoe6 | I am actually writing a patch for it. |
| 05:13 | phoe6 | Wanted to see how other methods which return file like object have made the changes in Py3k for iterable objects |
| 05:13 | learneralways | i need to trap all method calls in a class to update a counter which is increased when a method is called and decreased when method returns, with each method having it own counter. i wrote a metaclass which wraps all the callable methods with a decorator. howevever it is not calling decorator. |
| is my approach right? where am i wrong? | ||
| http://pastebin.com/d5514d4e4 | ||
| 05:14 | learneralways | anyone still willing to help? |
| 05:14 | GoldyOrNugget | soz learneralways, i have no idea wat ur talking about :P |
| me = python newbie | ||
| 05:14 | verte | learneralways, did you see http://codepad.org/1IqL65HN ? |
| 05:14 | learneralways | nope |
| 05:15 | learneralways | looking,.. |
| 05:17 | learneralways | it is giving error |
| 05:18 | learneralways | verte: u thr? |
| 05:18 | Evanlec | Luyt: is it necessary to mix urllib and urllib2 as you have done? or can one just use urllib2? |
| 05:18 | keseldude | if I make a dictionary of key => lambda: value, will value be evaluated only when I call d[key]()? |
| 05:18 | habnabit | keseldude, yep. |
| 05:18 | learneralways | i hope i am clear with what i need |
| 05:18 | keseldude | interesting :) |
| 05:19 | Luyt | Evanlec: Maybe, I found I needed stuff from urllib that wasnt in urllib2 |
| 05:19 | Evanlec | Luyt: i see |
| Luyt: so do we know if https auth is even _possible_ with urllib/urllib2 ? | ||
| 05:19 | keseldude | is it more efficient to initialize the dictionary that way if I only plan to use a few select values? |
| 05:20 | Luyt | Maybe you do; I don't. |
| 05:20 | habnabit | keseldude, probably not. |
| 05:21 | habnabit | keseldude, well, unless generating the values is expensive. |
| 05:21 | verte | learneralways, of course it is. but you can work that one out. |
| 05:21 | Luyt | KragenSitaker: replace_nth fixed for fringe cases, at http://codepad.org/UqRDrYwv |
| I also made the index zero-based. | ||
| 05:21 | blice | How should I go about formatting seconds? Like, a number of seconds. I'd like to format it like 0:0:0:0, for days, hours, minutes, seconds. Is there an easy way to do this? |
| 05:22 | habnabit | blice, repeated divmod calls. |
| 05:23 | blice | Never used divmod. Sounds hard. |
| 05:23 | blice | google. |
| 05:23 | keseldude | well it's a large dictionary, and I feel bad initialising it with values that might not be used |
| 05:23 | Luyt | keseldude: Get something working first, optimize later |
| 05:23 | keseldude | fine |
| thank you | ||
| 05:25 | GoldyOrNugget | blice: the easiest way i can think of doing it is to have multiple counters for seconds, minutes, etc. Then minutes is seconds%60, hours is minutes%60, days is hours%24 and so on |
| 05:26 | GoldyOrNugget | is that what you were asking? |
| 05:26 | habnabit | GoldyOrNugget, yes, which is why you'd use divmod. |
| 05:26 | GoldyOrNugget | what's divmod? |
| is that %? | ||
| 05:26 | habnabit | GoldyOrNugget, docs.python.org |
| 05:26 | GoldyOrNugget | cant be bothered :P |
| 05:26 | blice | GoldyOrNugget: If it makes it any easier, I'm using datetime.datetime |
| 05:26 | zelakt | Hi. I'm a Python newbie. Is there a way to process items in a dictionary sequentially? Can I refer to the first, second, etc. item in a dictionary? |
| 05:26 | blice | And returning seconds with .seconds |
| 05:26 | habnabit | blice, then use the strftime method. |
| 05:27 | habnabit | zelakt, dictionaries don't have order. |
| 05:27 | blice | Can you strftime a datetime? |
| 05:27 | habnabit | blice, yes, datetimes have a strftime method. |
| 05:27 | Adys | is there an easy way of emptying a list or do I need to loop through it for that? |
| 05:27 | blice | Method? So it isn't with time.strftime? They have their own? |
| 05:27 | habnabit | Adys, del L[:] |
| 05:27 | linux_user400354 | Luyt, KragenSitaker, http://codepad.org/eCKJwCDc |
| 05:27 | habnabit | blice, yep. |
| 05:27 | Adys | thanks habnabit |
| 05:27 | blice | habnabit: Sure does make things easier :] |
| 05:28 | GoldyOrNugget | Zelakt, make a list of keys in the dict and then iterate through that |
| 05:28 | Adys | habnabit: I guess l.remove() is deprecated? |
| 05:28 | habnabit | Adys, no, it just doesn't do what you want. |
| 05:28 | zelakt | GoldyOrNugget, habnabit, thanks, got it. |
| 05:28 | habnabit | zelakt, you can iterate over a dictionary, but the keys aren't in any particular order. |
| 05:28 | Adys | oh nm remove doesnt take an index |
| 05:29 | habnabit | zelakt, so, 'for key in D:' will work, but you can't count on the order you get. |
| 05:29 | zelakt | i see. |
| 05:30 | zelakt | thanks :) |
| 05:30 | Luyt | blice: http://codepad.org/VFx7woX2 for an example |
| 05:30 | GoldyOrNugget | Zelakt: l=['jan', 'feb', 'mar'...]; monthDict = {'jan'= 31, 'feb'=30, 'mar'=31'}; for m in l:; #do stuff with monthDict[m] |
| 05:30 | habnabit | Luyt, actually, that's making it waaay harder than it needs to be. |
| 05:30 | linux_user400354 | KragenSitaker, your solution replaced 3 characters, not 1 |
| 05:31 | habnabit | infobob, redent Luyt seconds = ...; minutes, seconds = divmod(seconds, 60); hours, minutes = divmod(minutes, 60); days, hours = divmod(hours, 24) |
| 05:31 | infobob | Luyt, http://paste.pocoo.org/show/96232/ |
| 05:32 | Luyt | Ah, I like the elimination of the 'left' variable |
| But basically it's three divmods | ||
| 05:32 | blice | habnabit: AttributeError: datetime.timedelta object has no attribute 'strftime', shit. I guess it turned into a timedelta when I subtracted one datetime from another :] |
| 05:33 | habnabit | blice, well, yes, if you subtract two datetimes you get a delta between the two. |
| blice, I don't know what else you could even get. | ||
| Logically speaking. | ||
| 05:33 | blice | habnabit: Well I'm new to datetime objects/timedelta/etc... Can I format a timedelta like how I want then? |
| 05:33 | habnabit | No, there's no strftime for timedeltas. |
| You have to do the divmods. | ||
| 05:33 | blice | Lameee |
| 05:34 | Luyt | The outcome is the same ;-) http://codepad.org/3d7Xjjam |
| 05:37 | blice | Luyt: Code is perfect, thank you so much. :D |
| 05:37 | Luyt | and nicely packaged in a function, too! |
| 05:38 | blice | Yeah! |
| Love that. | ||
| 05:39 | Luyt | If I have to remove all items from a list, I tend to do it like this: L=[] |
| 05:39 | habnabit | That just rebinds the name to an empty list. |
| It doesn't mutate the original list. | ||
| 05:39 | KirkMcDonald | del L[:] |
| 05:39 | Luyt | Hmmm yeah |
| and all the old crud stays referenced | ||
| 05:41 | Luyt | OTOH, the garbagecollector might be smart enough to detect that |
| 05:41 | linux_user400354 | Luyt, KirkMcDonald, couldnt the replace nth occurrence be done with a regular expression? |
| 05:41 | habnabit | Well, yes, if that was the last reference to the list then everything that was in it is decreffed. |
| 05:41 | blice | What's the difference between setting it to a new empty list and deleting all the contents of the original list? |
| Isn't that the same thing? | ||
| 05:42 | habnabit | blice, not at all. |
| 05:42 | blice | Like, functionality wise |
| Really? | ||
| 05:42 | Luyt | linux_user400354: Undoubtely. |
| 05:42 | blice | To me it seems like... settings a string to '' instead of doing .remove or something. |
| 05:42 | habnabit | blice, http://codepad.org/7VS9m6ru |
| 05:43 | blice | Oh I see. |
| 05:43 | andrewfree | Is it important that i understand how this works? http://pastebin.com/mf1a7b9a |
| 05:43 | blice | Interesting. |
| Thanks :0 | ||
| 05:43 | habnabit | andrewfree, that's some pretty bad code there. |
| 05:45 | verte | ewww. |
| 05:47 | andrewfree | habnabit: It was out of my book. |
| 05:47 | habnabit | andrewfree, what book is this? |
| 05:47 | linux_user400354 | Luyt, $_ = 'elephant'; s/(e.*?)e/$1x/; $_ |
| 05:47 | andrewfree | XD I was learning factorials and got that, but then it gave this example and i shit bricks http://www.amazon.com/Learn-Program-Using-Python-Self-Starters/dp/0201709384 |
| 05:47 | merlin83 | Introduction to Python Programming, dhh |
| 05:48 | habnabit | andrewfree, if that's one of the examples, I whole-heartedly anti-recommend the book. |
| 05:48 | Luyt | $What $do $those $dollarsigns $mean? |
| 05:49 | andrewfree | habnabit: Well then I shall skip that example |
| 05:49 | Inside | looks like demonic runes |
| 05:49 | andrewfree | I might come back to reclusion later |
| 05:49 | Inside | they may be trying to summon ctuthlu |
| 05:49 | andrewfree | lmao |
| 05:49 | Luyt | or klaatu |
| 05:50 | Luyt | and this time he's not pleased |
| 06:01 | zelakt | hi again. i need to loop from 1 to a very large number. it's too big for range(). how should i do it? |
| 06:02 | habnabit | zelakt, xrange! |
| 06:02 | zelakt | it's too large for xrange, apparently |
| 06:02 | scorchsaber_ | Ouch. Write your own generator for it. |
| 06:02 | habnabit | itertools.count/itertools.islice. |
| 06:02 | scorchsaber_ | Ooh, forgot about itertools. Always seem to. Drat. |
| 06:02 | zelakt | OverflowError: long int too large to convert to int |
| 06:02 | verte | too big for itertools.count |
| 06:03 | habnabit | verte, itertools.count overflows? |
| 06:03 | verte | c = itertools.count(0x100000000) |
| 06:03 | andrewfree | any premade irc bots? |
| 06:03 | scorchsaber_ | andrewfree: Tons. |
| 06:03 | habnabit | verte, indeed, that's a shame. |
| 06:03 | andrewfree | scorchsaber_: rwar |
| 06:04 | scorchsaber_ | Cool, I was right! :D |
| 06:04 | andrewfree | recommend any? |
| 06:04 | habnabit | andrewfree, the one I wrote! |
| 06:04 | andrewfree | habnabit: links? |
| 06:04 | habnabit | andrewfree, /ctcp infobob source |
| 06:04 | andrewfree | ?? |
| 06:04 | zelakt | duh, i could just use a while loop, didn't think about that. |
| 06:04 | KirkMcDonald | zelakt: Works in 3.0. :-) |
| 06:05 | scorchsaber_ | zelakt: Yes, but abstract it away. Write your own generator that uses a while loop internally. |
| 06:05 | zelakt | scorchsaber_: why? i only need to do this once |
| 06:05 | scorchsaber_ | zelakt: Because it's more readable, and also makes it easy to switch to xrange when xrange supports larger numbers. |
| 06:05 | zelakt | i'm also not quite sure how -- i've just started using python yesterday and i'm still learning |
| 06:06 | scorchsaber_ | zelakt: Then an additional reason: it's a great learning experience. |
| 06:06 | KirkMcDonald | zelakt: The simplest way would be to use a generator. |
| 06:07 | KragenSitaker | zelakt: I've just started using Python in 2000 and I'm still learning |
| 06:07 | zelakt | KragenSitaker, way to crush my spirit! |
| 06:07 | scorchsaber_ | I started using Python in 2k5, and it feels to me like I've stopped. It makes me sad. :( |
| 06:07 | KragenSitaker | zelakt: what, you don't like learning? |
| 06:07 | scorchsaber_ | Or maybe it was 2006, actually. |
| 06:08 | scorchsaber_ | Er, stopped learning* |
| 06:08 | squiggly | has anyone tried to manipulate fb2k with python? |
| 06:08 | KragenSitaker | framebuffer 2000? |
| 06:09 | KragenSitaker | facebook 2000? |
| 06:09 | zelakt | KragenSitaker, i do -- almost as much as i do simply knowing. |
| 06:09 | SAHChandler | foobar2000? |
| 06:09 | squiggly | foobar2000 |
| 06:09 | KragenSitaker | zelakt: then it should cheer you up to know that your learning could continue for a long time! |
| 06:10 | sunru | hello, is there a PEP or guide about docstrings? |
| got it | ||
| 06:12 | learneralways | verte; u thr? |
| 06:12 | verte | here |
| 06:12 | scorchsaber_ | No, he's not Thor. Why would you think that? |
| 06:13 | scorchsaber_ | Well, maybe he is. Don't tell anybody. |
| 06:13 | learneralways | hi scorchsaber_ |
| 06:13 | verte | SILENCE MORTAL |
| 06:13 | zelakt | KragenSitaker, i know :) |
| 06:13 | learneralways | oh, i think i found the problem |
| 06:13 | scorchsaber_ | verte: We'll see what you say in ragnarok, fool! |
| 06:13 | learneralways | the self problem |
| 06:13 | verte | the problem is that the class doesn't become an instance descriptor |
| 06:14 | learneralways | see this example |
| http://code.activestate.com/recipes/198078/ | ||
| it does it but same thing when i do--it doesn't work | ||
| :( | ||
| 06:15 | verte | learneralways, no, it returns a function, not a class |
| 06:15 | learneralways | it seems to be i can wrap around a function |
| but not a class method | ||
| 06:15 | verte | no. your descriptor needs to return a function |
| not a class | ||
| 06:16 | verte | well, instance |
| 06:16 | pedepy2 | hi |
| 06:17 | learneralways | verte: so i should wrap it around a class |
| i shouldn't | ||
| 06:20 | verte | that's right, you should use a function. |
| you *can* do it with a class in three possible ways, but two of them aren't really correct, and the third one certainly feels like a hack. | ||
| 06:21 | learneralways | http://code.activestate.com/recipes/198078/ |
| in the above code | ||
| 06:22 | learneralways | all method in a class are wrapped around the another class |
| right? | ||
| 06:22 | verte | _method is the function |
| 06:22 | learneralways | right |
| oops | ||
| 06:22 | verte | all methods in the class are wrapped by another function |
| 06:22 | learneralways | hmm |
| 06:23 | learneralways | got it |
| :D | ||
| 06:23 | AxleLonghorn | how do I tell if an object is a slice object? |
| 06:23 | habnabit | AxleLonghorn, isinstance(obj, slice) |
| 06:23 | AxleLonghorn | thanks habnabit |
| 06:24 | learneralways | but verte: see the argument here |
| http://www.artima.com/weblogs/viewpost.jsp?thread=240845 | ||
| 06:25 | learneralways | i also need to pass arguments |
| got it | ||
| 06:30 | lepassive | is here anyone uses lisp for a daily job ? |
| 06:31 | habnabit | I think you're asking the wrong channel. |
| 06:32 | verte | lisp hackers with jobs are either paid enough to not go looking for other languages, or are in a zen state, and hence do not go looking for other languages. |
| 06:32 | lepassive | habnabit, I mean lisp with python in the same system |
| 06:32 | verte | pypy includes a scheme interpreter? |
| 06:33 | lepassive | verte, I don't know |
| 06:33 | kizzo | Is there a way to tell what exceptions are raised by a function? |
| 06:33 | lepassive | I'm wondering if lisp and python can live together in a hybrid system |
| 06:33 | verte | kizzo, not really, no. |
| 06:33 | lepassive | kizzo, i guess you should take alook at traceback module |
| 06:34 | KirkMcDonald | lepassive: Well, they can both talk to C, at the very least. |
| 06:34 | kizzo | That blows. |
| 06:34 | verte | lepassive, no, I mean, pypy does include a scheme interpreter. |
| kizzo, pokemon style code blows. | ||
| 06:34 | habnabit | kizzo, you like Java? |
| 06:34 | kizzo | haha |
| What kind of code is pokemon style? | ||
| No I don't like Java. | ||
| 06:34 | habnabit | kizzo, gotta catch 'em all. |
| 06:34 | verte | gotta catch em all |
| 06:34 | kizzo | hahaha cute |
| 06:35 | verte | it means obscuring real bugs |
| 06:35 | lepassive | KirkMcDonald, I agree |
| 06:35 | pedepy2 | i can now start a python interpreter from my phone which is find very coool |
| 06:35 | KragenSitaker | pedepy2: on the phone? |
| 06:35 | kizzo | "obscuring real bugs" |
| 06:35 | KirkMcDonald | pedepy2: Which phone? |
| 06:35 | pedepy2 | yup |
| 06:35 | merlin83 | heh, most python developers are lisp-philosophy users, if they use map/reduce/lambda functions =P |
| 06:35 | pedepy2 | an iphone. |
| 06:35 | KragenSitaker | merlin83: you can't define macros in Python |
| 06:36 | KragenSitaker | pedepy2: so it's python on macos |
| 06:36 | verte | lepassive, pymacs is a python | emacs bridge, although calling elisp a real lisp is a bit of a stretch. |
| 06:36 | merlin83 | which python devel hasn't seen a a = [f(each) for each in somelist] |
| 06:36 | pedepy2 | yes well, iphoneos if you will |
| 06:36 | KragenSitaker | elisp is certainly a real lisp |
| 06:36 | KirkMcDonald | I recently got my hands on a G1. I should look into finding Python for it... |
| 06:36 | KragenSitaker | just a weak one |
| 06:37 | blice | KirkMcDonald: I have a G1 too, and I searched |
| And failed. | ||
| :/ | ||
| 06:37 | pedepy2 | KirkMcDonald: neat ... at least yours wont have to be hacked to death to see the joy of python ;/ |
| 06:37 | blice | If I could root the thing I'd have python stuff running on it like a champ, but they put out the new update before I had a chance |
| ;__; | ||
| 06:37 | verte | lepassive, you could easily write a C library that interfaces between guile and cpython. |
| 06:37 | pedepy2 | well here's a project for you guys .... port python to android |
| 06:37 | KirkMcDonald | blice: The Dev version? |
| 06:37 | pedepy2 | its a little much for me |
| 06:37 | blice | KirkMcDonald: No, regular. But I don't think you can root the dev one either, can you? |
| 06:38 | blice | Since you can't mount the file system (to chroot into it) |
| 06:38 | lepassive | verte, maybe, i've tried guile before |
| 06:38 | KirkMcDonald | blice: I installed the Terminal Emulator, and can do "su -" in it, for whatever that's worth. |
| 06:38 | pedepy2 | is this linux |
| 06:38 | KragenSitaker | pedepy2: you jailbroke it? |
| 06:39 | blice | KirkMcDonald: wat, you can do su?! When I do anything in the terminal emulator it gives me "Permission Denied" ;__; Luckyyyy |
| 06:39 | pedepy2 | yea piece of cake with what they have today |
| 06:39 | blice | I'd have openbox running on that thing. |
| 06:39 | verte | lepassive, guile's extension interface is pretty slick. the only thing that would be a pain is maintaining that you've got the GIL on cross-interpreter invocations. |
| 06:39 | pedepy2 | im actually tethering via proxy right now |
| 06:39 | ivazquez|laptop | wants to see a Python-to-Dalvik crosscompiler |
| 06:39 | pedepy2 | using my 3G connection to access mibbit in firefox on my laptop ;) |
| 06:39 | blice | pedepy2: With the most recent rc?! The one where they fixed the bug where what you type gets sent to a root terminal? |
| 06:39 | pedepy2 | and its slooooooooooooow |
| 06:40 | KirkMcDonald | blice: This is one of the key differences between the regular and dev versions, I believe. |
| 06:40 | pedepy2 | rc? |
| 06:40 | blice | pedepy2: Yeah, rc30 I think. |
| 06:40 | pedepy2 | iphone? |
| 06:40 | blice | No, G1. |
| 06:40 | pedepy2 | im talking about apple here |
| 06:40 | scorchsaber_ | pedepy2: Get WiMax! |
| 06:40 | blice | ..Oh |
| 06:41 | pedepy2 | scorchsaber_: i wish ... this company was supposed to roll out wimax in town .. that was 2 years ago and still no dice :/ |
| 06:41 | scorchsaber_ | bahaha. :( |
| 06:41 | pedepy2 | i always assumed since android ran linux you could just use the standard tools to do whatever you want given you just have access to the stuff 'behind the curtains'.. |
| 06:43 | scorchsaber_ | pedepy2: You mean you can't? |
| 06:43 | pedepy2 | i dunno .. ive never played with that |
| 06:44 | pedepy2 | you dont know how the canadian cellular market is like ... if apple hadnt pushed the iphone onto us so forcibly we'd still barely have 3g |
| 06:44 | \Kira | Is this a support channel for python? |
| 06:44 | pedepy2 | so .. android .. make 2012.. whatever |
| \Kira: the best there is ! | ||
| 06:44 | KirkMcDonald | \Kira: "Support" sounds ominous. :-) |
| 06:44 | scorchsaber_ | pedepy2: I do so know what it's like. |
| 06:44 | pedepy2 | you got folks here that can write a kernel in python using one lambda function |
| 06:44 | \Kira | pedepy2: good to know :) Thanks. |
| 06:45 | scorchsaber_ | pedepy2: The canadian telecom industry is why I don't own a phone. |
| 06:45 | ivazquez|laptop | ....... |
| 06:45 | pedepy2 | scorchsaber_: patience my friend .. patience ..... telus will deploy its umts network and EAT Ted Rogers |
| 06:46 | ivazquez|laptop | First they need to find their ass. |
| 06:46 | scorchsaber_ | Doesn't help the ridiculous pricing etc. |
| 06:46 | pedepy2 | \Kira: you had a question? |
| 06:47 | khaije1 | chan's favorite CMS? |
| 06:47 | pedepy2 | im wonderin here .... if they had the python interpreter work on an iphone, does this mean its been written in objective C ?.. |
| (rewritten anyway) | ||
| 06:47 | KragenSitaker | pedepy2: no |
| 06:48 | pedepy2 | ok. |
| 06:48 | \Kira | pedepy2: oh, no. Im just in the proccess of learning python and wanted to find a support channel in case i run into complications during the tutorial. Thanks, though |
| 06:48 | scorchsaber_ | IIRC Objective-C still supports a large subset of C (like C++ does). |
| 06:48 | \Kira | pedepy2: you can expect to see me here alot, though :) |
| 06:49 | scorchsaber_ | So CPython could already be valid Objective-C anyway. |
| 06:49 | pedepy2 | yea yea but i wondered if they had to recompile the interpreter with an objc compiler and perhaps have to rewrite small portions of it |
| 06:49 | ivazquez|laptop | You mean like gcc? |
| 06:49 | pedepy2 | like gcc.. |
| :p | ||
| 06:50 | KragenSitaker | I'm pretty sure you can run C on the iPhone |
| 06:50 | tazle | why wuld the iPhone care what language a program was written in as long as it's valid binary?-) |
| 06:51 | tazle | or rather, "how" |
| 06:51 | autonomy | I have a question... I have a module which (generally) requires root access as it needs access to /dev/mem |
| 06:52 | autonomy | On import, I detect if the user has appropriate permissions to the default device... |
| 06:52 | learneralways | verte: u thr? |
| 06:52 | pedepy2 | tazle: i guess thats the truth |
| 06:52 | ivazquez|laptop | No, you can't elevate single modules |
| 06:52 | autonomy | where they do not... what should I do? |
| 06:52 | ivazquez|laptop | It's all or nothing. |
| 06:52 | learneralways | can anyone tell me--what's the error? |
| http://codepad.org/2w7JVvDB | ||
| 06:52 | autonomy | stop the module loading all together sounds reasonable - how do I make that happen? |
| 06:52 | ivazquez|laptop | sys.exit() |
| 06:52 | pedepy2 | so then can you use python to compile a bundled up binary thatll run its own little intepreter and perhaps be allowed into the appstore if apple cant tell the difference ? |
| 06:53 | pedepy2 | (although i suspect apple to request the code..) |
| 06:53 | KragenSitaker | pedepy2: presumably, but IIRC Apple has an anti-interpreter policy |
| 06:54 | learneralways | KragenSitaker: can u plz look into the code |
| http://codepad.org/2w7JVvDB | ||
| 06:54 | pedepy2 | yea yea but what if the binary is the interpreter with just what it needs and the script? .. |
| 06:54 | scorchsaber_ | autonomy: Throw an exception. |
| 06:54 | autonomy | ahh |
| that sounds much better | ||
| 06:54 | KragenSitaker | learneralways: '%s' % is unnecessary |
| 06:55 | tazle | pedepy2: a human can certainly tell the difference |
| 06:55 | scorchsaber_ | autonomy: Well, it was already suggested, sort of. |
| autonomy: sys.exit() raises SystemExit iirc. | ||
| 06:55 | blice | Flushing stdout and reprinting this progress bar over and over makes it go to 5% CPU usage.. but if I time.wait on it, it'll also put a pause on my download (That the progress bar is showing)- Is there a way for me to slow down the rate of this progress bar while not slowing down the rate of my download?? >: |
| 06:55 | pedepy2 | a human? |
| 06:55 | KragenSitaker | learneralways: the problem is that you need to pass both key and value to decoratorforall |
| well no | ||
| 06:56 | KragenSitaker | the problem is that you need to call the value instead of trying to getattr it |
| you're not passing the methodname; you're passing the method itself! | ||
| 06:56 | learneralways | let me see |
| 06:57 | learneralways | not clear to me |
| plz change the code if possible | ||
| 06:57 | scorchsaber_ | blice: What are you doing now? Could you paste the source (to a pastebin)? |
| 06:57 | learneralways | KragenSitaker: plzz |
| 06:58 | blice | scorchsaber_: I'm downloading a file, and I have a progress bar I print out to show the progress. |
| 06:58 | sunru | learneralways: don't be pathetic. |
| 06:58 | blice | scorchsaber_: But uhm.. flushing stdout and then re-printing the line over and over, it makes the script use 5% CPU. |
| 06:58 | scorchsaber_ | blice: Yes, but your question doesn't make sense to me, so I need to see how you're going about doing it. It seems to be different than what I'm expecting. |
| blice: Also, don't worry about % CPU usage. It means little to nothing, imho. | ||
| 06:59 | blice | scorchsaber_: I have reasons for worrying about it. This is going on a 300mhz computer that has other things to do aswell. |
| 06:59 | learneralways | sunru: i m frustated, not patheitc |
| 06:59 | KragenSitaker | blice: maybe flush stdout and re-print the line less often |
| 06:59 | scorchsaber_ | Alright. I would still like to see the source. |
| 06:59 | sunru | action |
| 06:59 | KragenSitaker | blice: like, maybe only when the progress bar changes |
| 06:59 | learneralways | http://codepad.org/2w7JVvDB |
| 06:59 | pedepy2 | blice: i will send you a pentium 2 for christmas |
| 06:59 | blice | KragenSitaker: Like, set a flag to make it do it every other time or something? |
| 06:59 | scorchsaber_ | waiting should not be the only way to do the stdout magic less often. |
| 07:00 | scorchsaber_ | In fact, so far as I know, you can simply download chunks that are large enough to cause a change in the bar, and block in the meantime. |
| 07:00 | blice | KragenSitaker: It's always changing... I mean every time it's called to update, it's a change. |
| 07:00 | KragenSitaker | blice: I was thinking that you could remember how many squares were lit up last time around, and only print something out if it had changed |
| 07:00 | pedepy2 | hell, a pentium 3. this the season for giving |
| 07:00 | KragenSitaker | oh, scorchsaber_'s idea might be better |
| 07:00 | sdkmvx_ | sdkmvx |
| 07:00 | blice | Hmm |
| 07:00 | KragenSitaker | pedepy2: he might be putting it on a cellphone or a router or something |
| 07:00 | blice | I think I know what to do :D |
| Ima go try something~ Thanks guys | ||
| 07:00 | scorchsaber_ | It might be, but you're the person that gave it to me. ;) |
| 07:01 | verte | hey, I'm using a pentium III. it works great. |
| respect. | ||
| 07:01 | pedepy2 | silly KragenSitaker phones can run python |
| 07:01 | scorchsaber_ | I'm using a Pentium 4. :( |
| 07:01 | pedepy2 | oh wait |
| 07:01 | blice | Nothing wrong with a 300-800mhz computer. They work just fine. |
| 07:01 | KragenSitaker | pedepy2: yes but they might reasonably have a 300MHz CPU |
| 07:01 | scorchsaber_ | OTOH, I'm getting an Intel Core i7 this month.... :) |
| 07:01 | pedepy2 | yea ... at suckingg |
| true.. true | ||
| 07:01 | KragenSitaker | my laptop is P3 700MHz. it is kind of annoyingly slow. |
| 07:02 | blice | KragenSitaker: learn how to linux better |
| 07:02 | scorchsaber_ | This laptop is 1.x GHz, and also annoyingly slow. |
| 07:02 | pedepy2 | well the good news is that you can shop around without guilt |
| my laptop is 2.4ghz and its pretty fast :D | ||
| 07:02 | KragenSitaker | blice: thanks for the good wishes, I'll try :) |
| 07:02 | verte | I've got 833 MHz, but I do a lot on it, and it works fine, mostly. with Xen and running most things in dom0, it can get laggy. |
| 07:02 | blice | :D |
| 07:03 | pedepy2 | ;) |
| uh | ||
| 07:03 | scorchsaber_ | Oh yeah? My desktop is 2.6 GHz and faster. I can even play games on it! |
| 07:03 | blice | scorchsaber_: nethack? |
| 07:03 | scorchsaber_ | blice: Left 4 Dead |
| (among others, of course) | ||
| 07:03 | KragenSitaker | you can play old versions of Hack on a 64kB IBM PC |
| 07:03 | blice | Never heard of it. Uses ncurses? or? |
| 07:03 | pedepy2 | i was shocked i can actually play Quake 1 on my iphone too ... when that first came out I had a 66mhz 486 that could barely run it @ 320x240 |
| 07:03 | scorchsaber_ | ldlework plays with me regularly. It's creepy. |
| blice: Errr | ||
| 07:03 | pedepy2 | how times have changed |
| 07:04 | blice | scorchsaber_: Just kidding :] |
| 07:04 | scorchsaber_ | blice: Oh, good. :'( |
| 07:04 | pedepy2 | scorchsaber_: yeah but thats a desktop ... you cant take to the beach |
| 07:04 | scorchsaber_ | wants to shout and screw about the new PC, which will probably be better than anybody's here. And it's only a bit above $1k! |
| 07:04 | KragenSitaker | shout and screw? |
| 07:05 | scorchsaber_ | pedepy2: Laptops + beaches = broken laptops |
| 07:05 | pedepy2 | lol.. |
| 07:05 | ivazquez|laptop | L4D is great. And this is coming from someone that hates shooters. |
| 07:05 | scorchsaber_ | Er, scream |
| that's an awkward typo. | ||
| 07:05 | KragenSitaker | scorchsaber_: he's talking about his iphone though |
| 07:05 | pedepy2 | damn isnt there a !grab bot in here |
| that was priceless.. | ||
| 07:05 | KragenSitaker | pedepy2: NO LOL |
| 07:05 | scorchsaber_ | ivazquez|laptop: Damn straight. |
| 07:05 | lyrae | Mild problem. When i get filenames from files in a dir, the extensions don't seem to come. I say this because i split the names at '.' and get an error |
| 07:05 | pedepy2 | ;) |
| 07:05 | gk | hello, given list of lists how can I make flat list of all elements from it? |
| 07:05 | KragenSitaker | gk: list(itertools.chain(*listoflists)) |
| 07:05 | scorchsaber_ | gk: nested loops. |
| 07:05 | pedepy2 | KragenSitaker: when someone means scream and says screw im sorry but i will lol. |
| rule or no rule | ||
| 07:05 | scorchsaber_ | Or that. Damn itertools is lovely. |
| 07:06 | ivazquez|laptop | played the last 2 campaigns with his brother yesterday |
| 07:06 | pedepy2 | that was the one allowed exception right there |
| 07:06 | ivazquez|laptop | And the first 2 last weekend. |
| 07:06 | gk | KragenSitaker: thanks |
| 07:06 | scorchsaber_ | ivazquez|laptop: That makes three semi/regular #python-goers that play L4D. We need just one more. |
| 07:06 | ivazquez|laptop | I hope they come up with more maps. |
| 07:06 | scorchsaber_ | Me too. |
| 07:06 | KragenSitaker | gk: sure. we discussed this for like an hour earlier today |
| 07:07 | KragenSitaker | gk: we came up with lots of solutions |
| 07:07 | pedepy2 | whats l4d |
| 07:07 | KragenSitaker | gk: probably the most obvious one was this |
| 07:07 | scorchsaber_ | I also hope they manage to make the other two playable in versus, which is also amazing to play. |
| 07:07 | ivazquez|laptop | scorchsaber_: Do you play on PC or X360? |
| 07:07 | scorchsaber_ | PC. |
| 07:07 | ivazquez|laptop | Ah. |
| 07:07 | KragenSitaker | result = []; for L in listoflists: result.extend(L) |
| 07:07 | scorchsaber_ | Damn. |
| 07:07 | ivazquez|laptop | He has it on X360. |
| 07:07 | scorchsaber_ | Damndamndamn. You're the loner, sir. |
| 07:07 | ivazquez|laptop | I'll so have it when they port it to Linux though :P |
| 07:07 | scorchsaber_ | Alright, two more pythoneers. |
| 07:08 | scorchsaber_ | ivazquez|laptop: "when"? Have they announced something, or is it that steam linux client thing? |
| It's a DX game, which makes it unlikely, but not at all impossible-- Source is beautifully modular, I hear. | ||
| 07:08 | ivazquez|laptop | Nothing official yet. |
| 07:08 | lyrae | I wish we could use // as comments |
| damn # is an ugly sign | ||
| its like pubic hair | ||
| 07:08 | scorchsaber_ | lyrae: It won't happen, ever. // is now an operator. |
| 07:08 | lyrae | tangled. ic an't use it |
| 07:08 | ivazquez|laptop | If Icculus can port Prey then L4D will be cake. |
| 07:08 | lyrae | oh... =( |
| 07:09 | scorchsaber_ | ivazquez|laptop: Prey used OpenGL and all that, though. At least, I thought it did-- I do know it used id Tech 4. |
| 07:10 | KragenSitaker | lyrae: haha! we should totally have a pubic hair character in Unicode |
| lyrae: how do you like the Ada and SQL -- | ||
| ? | ||
| 07:10 | ivazquez|laptop | Source uses OpenGL ES on the PS3, so lots of hope. |
| 07:10 | lyrae | KragenSitaker: i like sql |
| 07:11 | lyrae | pubic hair is a rather interesting name for a character |
| 07:12 | lyrae | i use ''' to coment''' |
| which is also ugly, but better than # | ||
| 07:13 | lyrae | Also, i figured out Gedit is a great tool for web dev and python dev |
| has a py console, side panel with file list, indentantion, lots of cool plugins | ||
| 07:13 | ivazquez|laptop | geany is better. |
| 07:13 | lyrae | nah |
| dont like the color scheme...takes too long to change | ||
| 07:14 | lyrae | gedit is the best =} |
| 07:15 | lyrae | can even have FTP built into it |
| if i remember,geany, scream, bluefish and spe didn't | ||
| 07:15 | ivazquez|laptop | Bluefish does. |
| 07:15 | ultra- | hello |
| 07:15 | lyrae | oh |
| 07:15 | verte | or get an OS that has ftp built into it. |
| 07:15 | ivazquez|laptop | In fact, gedit and bluefish use the same mechanism for it. |
| 07:16 | lyrae | well Gedit uses the OS's |
| 07:16 | verte | gedit uses gvfs |
| 07:16 | lyrae | don't know what bluefish uses |
| 07:16 | scorchsaber_ | K editors > gedit, from what I've heard. |
| 07:17 | scorchsaber_ | Though, annoyingly, they can't deal with raw-triple-strings in their syntax highlighting. |
| 07:17 | lyrae | i dont know. gedit's very light and handy. i like it alot |
| 07:17 | verte | yeah. neither does emacs. |
| 07:18 | bob2 | does too! |
| 07:18 | scorchsaber_ | lyrae: The k-editors can be either light and handy, or heavy and handy, or in-between. That's just cool. |
| 07:18 | verte | bob2, try this: ''' foo's ''' |
| 07:18 | bob2 | python-mode/el or python.el? |
| 07:18 | lyrae | scorchsaber_: same goes for gedit i suppose |
| 07:18 | verte | using python-mode |
| 07:19 | scorchsaber_ | if lighter is > , kwrite > kate > kdevelop |
| lyrae: I don't believe so, actually. | ||
| 07:19 | lyrae | well in that case then leafpad |
| just blank textbox basically hehe | ||
| 07:19 | verte | gedit is never really light |
| it takes longer to load than firefox here | ||
| 07:19 | lyrae | verte: i say it in comparison to spe, etc |
| then something's wrong | ||
| 07:20 | bob2 | verte: python.el seems to handle it |
| 07:20 | lyrae | take about a second or a little less for me |
| 07:20 | scorchsaber_ | lyrae: Yes, but the k-editors are both lighter than and heavier than pretty much anything. Really, it's just useful, and they share their settings and stuff. |
| 07:20 | verte | bob2, nice. might have to look into that. |
| 07:22 | learneralways | scorchsaber/verte: can u explain the meaining of line 7/8 in this code |
| http://code.activestate.com/recipes/198078/ | ||
| def _method(self,*argl,**argd): | ||
| 07:23 | learneralways | what are argl/ardg? |
| they are not passed | ||
| 07:23 | sadmac | I have a dict where a custom defined class is serving as the key. When I print mydict, it is showing the key values as <__main__.Foo instance at 0xdeadbeef> even though the class has a __str__ |
| is there anything else like __str__ that I need to define to get more magic in the printing or do I just need to manually iterate? | ||
| 07:24 | KirkMcDonald | sadmac: The dict is printing the class's __repr__. |
| 07:24 | lyrae | Ok back my problem. Tiny script: http://slexy.org/view/s20ag4vW8M. Problem: when pringing 'e', index is out of range. why? its as if the filenames arent being copied with the extension |
| 07:24 | sadmac | KirkMcDonald: ok |
| 07:25 | sadmac | thanks |
| 07:25 | bob2 | learneralways: section 4.7 of the tutorial |
| 07:25 | learneralways | which tutorial? |
| 07:25 | KirkMcDonald | lyrae: Perhaps there is a file which does not have an extension? |
| 07:25 | bob2 | learneralways: the one in the topic |
| 07:26 | lyrae | KirkMcDonald: they all do though. its a test folder im using, 3 files inside |
| like hello.txt | ||
| 07:27 | lyrae | KirkMcDonald: nevermind i just lied |
| 07:27 | KirkMcDonald | heh |
| 07:27 | lyrae | i forgot when you F2, gnome doesnt highlite the file extension |
| so i was pasting the name in new files without extension. oops. | ||
| 07:28 | learneralways | bob2: *argl,**argd is clear to be that they are arguments and key,value pair |
| 07:28 | bob2 | learneralways: yes |
| 07:28 | learneralways | but they are never initialized while calling |
| in particular, | ||
| def logmethod(methodname): | ||
| def _method(self,*argl,**argd): | ||
| 07:29 | learneralways | why two def? |
| 07:29 | KirkMcDonald | learneralways: The usual convention is to call them args and kwargs. |
| 07:29 | bob2 | lyrae: http://slexy.org/view/s2k3CxeSFx <- some pythonicness tweaks you might be interestedness |
| 07:29 | KirkMcDonald | Instead of argl and argd. |
| 07:29 | bob2 | learneralways: nested functions |
| 07:29 | learneralways | k |
| 07:29 | KragenSitaker | learneralways: you want logmethod to return a function |
| learneralways: so inside of logmethod you define the function you want to return, and then you return it | ||
| it's inside so that it can use methodname | ||
| 07:29 | bob2 | that's pretty awful code, though |
| 07:30 | bob2 | don't learn python from it :) |
| 07:30 | lyrae | bob2: thank you :) |
| 07:31 | lyrae | what difference does putting (object) next to the class's name make? |
| 07:31 | bob2 | lyrae: it makes it a new style class, instead of an old style |
| 07:31 | learneralways | KragenSitaker: thanks |
| 07:31 | lyrae | bob2: so i was using old styled code? |
| 07:31 | learneralways | bob2 2 |
| 07:31 | lyrae | =( |
| 07:31 | bob2 | lyrae: it doesn't matter in thsi case, but it lets you use properties, the 'super' keyword some other stuff I forget |
| 07:31 | lyrae | man life is too short to catch up on everything |
| 07:31 | bob2 | lyrae: (and is the default in py3k) |
| 07:32 | lyrae | ah okay |
| 07:32 | bob2 | lyrae: just 'old style classes' |
| 07:32 | lyrae | gotcha |
| 07:32 | bob2 | lyrae: http://www.python.org/download/releases/2.2.3/descrintro/ has all the gory differences if you're ever terribly bored |
| 07:33 | lyrae | ill bookmark. its almost 3am. trying to get this done and sleep. but many thanks |
| 07:35 | lyrae | random question. might be absurd..can i have a method inside a method? |
| 07:35 | scorchsaber_ | Sure, but it still has to be connected to an object. |
| 07:36 | KragenSitaker | if you put a function inside a class, it becomes a method. |
| 07:36 | verte | you can have a function inside a method. |
| 07:36 | scorchsaber_ | if you create an int inside a method, for instance, you've got methods on the int object. |
| 07:36 | KragenSitaker | but if you put a function inside a method, it doesn't become a method automatically. |
| 07:36 | verte | a method inside a method doesn't make as much sense. |
| 07:36 | KragenSitaker | but if you put a class inside the method, you can have methods inside that. |
| 07:36 | scorchsaber_ | Alternatively, you can create a new method-wrapper object connected to some object. |
| It's not really what you're asking for, probably. | ||
| 07:36 | KragenSitaker | so the answer is "it's complicated" :) |
| 07:36 | scorchsaber_ | Yes! |
| 07:36 | lyrae | ill just use a loop, hehe |
| 07:37 | verte | the scoping rules stack like you'd expect |
| 07:37 | scorchsaber_ | ^ , so if you just want to access self, a function inside a method would be fine. |
| 07:38 | scorchsaber_ | Word of warning to all present: check the expiry date on your ketchup before putting it on your hot dog. |
| Especially if you came over to visit your non-ketchup-consuming parents for the winter, and find that they have ketchup. | ||
| 07:39 | verte | that makes sense. |
| 07:39 | KirkMcDonald | scorchsaber_: Along similar lines, beware convenience store milk. |
| 07:40 | KragenSitaker | ketchup, that sounds yummy |
| 07:40 | scorchsaber_ | Ye gods yes. |
| KragenSitaker: Not when it expired in 2007. | ||
| January 2007. | ||
| Aaaauugh. | ||
| 07:41 | KragenSitaker | haha |
| it doesn't taste good? | ||
| 07:41 | scorchsaber_ | No. Actually, it tasted really strange. Metallic/sour something. |
| Also, it was brown. | ||
| Well, a browner red than healthy ketchup. | ||
| 07:42 | KragenSitaker | healthy ketchup, heh |
| 07:43 | KragenSitaker | it probably won't have made you sick |
| 07:43 | pedepy2 | am i still here? |
| 07:44 | verte | no. |
| 07:44 | pedepy2 | ketchup aint so bad.. its what you normally eat it with thats harsh |
| 07:44 | KragenSitaker | yeah, the hotdogs around here are normally kept in a bath of hot water for hours before you buy them |
| 07:45 | pedepy2 | i like how tethering is so slow i often get pushed the 'b' version of pages thats mostly text a few images here and there ... i feel like its 1995 and im discovering the internet |
| 07:45 | KragenSitaker | 'b'? |
| 07:46 | pedepy2 | the half assed rendition |
| 07:46 | KragenSitaker | hooray discovering the internet |
| 07:46 | pedepy2 | the first time i was on the internet was in text mode |
| it also was the only time | ||
| well, i guess i mean the world wide web | ||
| 07:46 | KragenSitaker | my high school had a VAX-11/785 with a 56kbps frame relay link |
| 07:47 | KragenSitaker | I accessed the WWW by telnetting to lynx.cc.ukans.edu |
| to run lynx | ||
| 07:48 | pedepy2 | epic |
| im surprised at how many ads there still are for 56k dial up internet in a local computer paper | ||
| 07:48 | radixor | kek lynx :D |
| 07:49 | habnabit | I wish I had hot dogs |
| 07:49 | pedepy2 | i guess its relatively low cost to maintain |
| 07:49 | habnabit | . |
| 07:49 | pedepy2 | gee habnabit |
| 07:49 | habnabit | What? |
| 07:49 | pedepy2 | make some :p |
| 07:49 | KragenSitaker | they're hard to make |
| 07:49 | habnabit | I dn't have any! |
| 07:50 | KragenSitaker | you need some brains, some tendons, some marrow... |
| and a meat grinder | ||
| 07:50 | pedepy2 | KragenSitaker: still is human std lib |
| ok meat grinder is third party | ||
| 07:51 | pedepy2 | habnabit: there are surely stores around that sell all you need for hot dogs ... or even maybe restaurants thatll sell you some |
| 07:51 | KragenSitaker | extracting them from your own body is very difficult! |
| 07:51 | pedepy2 | KragenSitaker: you dont need to do that |
| 07:51 | habnabit | pedepy2, no car, no bus, pitch black and icy outside, and the nearest store is at least five miles. |
| 07:52 | pedepy2 | well .. move to a bigger town |
| 07:52 | habnabit | I'm home for the holidays! |
| If I was at school I could go downtown and find a grocery store no problem. | ||
| 07:52 | pedepy2 | ive about 7 open restaurants in range of 10 minutes by foot .. and its 3 am |
| 07:53 | habnabit | Yes, well, my parents live in the middle of nowhere. :( |
| 07:53 | ultra- | is there anything wrong this this: list.append(somevalue) ? |
| 07:53 | pedepy2 | soon you will have hot dogs then |
| 07:53 | habnabit | ultra-, nope! |
| 07:53 | ultra- | weird |
| 07:53 | KragenSitaker | ultra-: assuming you mean foobar where you say list, no |
| 07:53 | ultra- | thanks |
| 07:54 | ultra- | i do mean foobar! |
| 07:54 | pedepy2 | ultra im sure list.append(somevalue) isnt your whole script |
| 07:54 | sunru | does a method decorator of a parent class get passed to the reimplemented method? |
| 07:54 | KragenSitaker | ultra-: if you have a variable called list that holds a list, it may impede you from being able to convert things to lists |
| using the list builtin | ||
| 07:54 | ultra- | bytes1 = midi_bytes[1] |
| er crap | ||
| 07:54 | habnabit | sunru, are you talking about overloading methods in subclasses? |
| 07:54 | ultra- | self.byteLog.append(bytes1) |
| 07:54 | pedepy2 | sunru: shut yo' mouth |
| 07:54 | ultra- | bytes1 for sure has data |
| 07:54 | KragenSitaker | yeah clearly |
| 07:54 | habnabit | ultra-, and the error is? |
| 07:54 | sunru | pedepy2: why |
| 07:55 | pedepy2 | sunru: nevermind its late |
| 07:55 | KragenSitaker | or you'd get an exception at midi_bytes[1] |
| sunru: he was trying to be funny I think | ||
| 07:55 | sunru | yeh i laughed |
| 07:55 | pedepy2 | ohhhh, yeah |
| 07:55 | ultra- | no error because i'm running this from within an app (api) |
| 07:55 | sunru | i just reimplemented a method. |
| 07:55 | habnabit | ultra-, then why are you asking? |
| 07:55 | sunru | does the parent decorator get inherited as well? |
| 07:55 | habnabit | sunru, no. |
| 07:56 | habnabit | sunru, decorators are applied only once: when the function is defined. |
| sunru, the class doesn't even know about them. | ||
| 07:56 | ultra- | because i just wanted to know if there was a syntax problem in there |
| i did look it up but just in case | ||
| 07:56 | habnabit | ultra-, you should probably say that in the first place next time. |
| 07:57 | sunru | habnabit: ok |
| thanks | ||
| 07:57 | ultra- | sorry |
| 07:58 | gloriaC991 | hi, does anyone have any experience installing pygame on a mac? i'm getting an error when i try to run the binary about not having python 2.5 on my system, but i definitely have it |
| 07:59 | ultra- | blah |
| bed time | ||
| 07:59 | habnabit | gloriaC991, are you installing from the binary package? |
| 07:59 | gloriaC991 | yeah |
| 07:59 | habnabit | gloriaC991, and are you on 10.4 or 10.5? |
| 07:59 | gloriaC991 | 10.5 |
| 07:59 | habnabit | gloriaC991, what is the exact error message? |
| 07:59 | gloriaC991 | one second, let me do it again |
| 08:00 | gloriaC991 | when it says "Select a Destination" and i click my hard drive, it says "You cannot install pygame 1.8.1release on this volume. pygame requires System Python 2.5 to install." |
| 08:01 | habnabit | gloriaC991, and you're certain you're on 10.5? |
| 08:01 | gloriaC991 | positive. i bought it about a month and a half ago |
| 08:01 | habnabit | gloriaC991, so you upgraded from 10.4? |
| 08:01 | gloriaC991 | and in About This Mac, it says Version 10.5.6 |
| 08:01 | sadmac | what determines if two keys match in dicts? I thought it was __hash__ |
| 08:01 | habnabit | sadmac, __hash__ and __eq__ |
| 08:02 | sadmac | habnabit: ok |
| 08:02 | nvictor | Python for ever! |
| HELLOOOOO python artists! | ||
| 08:02 | scorchsaber_ | sadmac: equality must also be tested-- hashing is a shortcut, and equality guarantees equality when hashes are equal. |
| 08:02 | habnabit | gloriaC991, did you install the developer tools as well? |
| 08:02 | scorchsaber_ | er, __eq__ guarantees... * |
| 08:02 | sadmac | scorchsaber_: ok |
| 08:02 | gloriaC991 | habnabit: you mean the Xcode stuff? |
| 08:02 | habnabit | gloriaC991, yes. |
| 08:03 | gloriaC991 | yes, i did |
| 08:03 | KragenSitaker | sadmac: are you trying to make things match in a dict, or trying to figure out why they are matching? |
| 08:03 | habnabit | gloriaC991, odd. Sounds like everything should be set up just fine. |
| 08:03 | gloriaC991 | and when i type 'python' at the terminal, it says it's Python 2.5.1 |
| yeah, that's what i thought | ||
| 08:03 | sadmac | KragenSitaker: make them match. They already have the __hash__ output I expected, I just needed __eq__ |
| 08:03 | KragenSitaker | ok |
| 08:04 | habnabit | sadmac, just make sure that two objects that match from __eq__ always have the same hash value. |
| 08:04 | sadmac | habnabit: my __eq__ is literally return self.__hash__() == other.__hash__() |
| 08:04 | habnabit | sadmac, er, that's sort-of the wrong way to do it in more than one way. |
| 08:05 | gloriaC991 | habnabit: any other ideas? |
| 08:05 | scorchsaber_ | sadmac: use hash() instead. |
| 08:05 | habnabit |




