| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Comments:
<0> RadSurfer, the RFC. <1> and just where might I find that ? <1> grrrr.... <2> hopefully urlparse module knows them <1> research! every programmers needs to do research <1> that just breaks a url down... <1> I need to find 'em first <1> fascinating <1> it lists the RFC's <1> how handy is that !! <3> would creating an object in the __init__ method of a cl*** increase stability? or no? <4> RadSurfer: someone wrote a Perl program to *generate* a regep which recognises URL's: http://www.foad.org/~abigail/Perl/url2.html <1> thanks. <4> RadSurfer: click the "program" link for the source code <2> reikon: what kind of "stability" are you thinking about? <2> python is unlikely to crash any more or less
<3> drewp, I'm not used to python, so I'm not sure of all the issues it's prone to...mainly slowdowns and performance issues <5> reikon: Do not worry about speed or performance. <5> reikon: Not unless you know what you are doing anyhow. <5> And at the moment neither you (nor I :) know what we are doing with python. :) <3> haha <3> I know what I'm doing, just not what I'm doing with python as you said :P <5> For the vast majority of uses python will always be more than fast enough. <0> reikon, I wouldn't see why nested construction wouldn't work as expected, but from C++ I have adopted the rule that no constructor call (such as __init__()) should ever fail. <0> reikon, I would think it a bit more iffy and in need of careful testing if you were constructing more items of the SAME cl*** branch, thus recursing. <3> hari`, __init__() it's self can't fail, only the funciton it calls if the user supplies an argument. <0> reikon, sure, but what do you do then? Raise an exception? Very ugly. <3> yes...actually..i do :P <0> I would do two-stage construction then. <2> exceptions aren't ugly <0> exceptions from __init__ can be. You have this aborted half-initialized object out there. It would be uglier if there was a finalizer to have to contend with the mess. <3> my object isn't half initialized..i have it to where only 1 variable is created, before it's p***ed to the function that raises the exception <3> so no major processing has been done <0> You can do what you like. <2> hari`: how do you have a half-initialized object? <3> i'm just trying to make it as fast as possible <3> now that it actually works :P <5> drewp: The object is created but the various attributes or whatever are not completely set? <2> reikon: does your thing even work yet? <2> tessier_: nah <3> drewp, it works very well <3> now i'm optimizing <0> drewp, what if the function it was calling was sequestering resources of some kind. The finalizer may have to step carefully if some of the attributes aren't even there yet. <2> reikon: oh- then what's the slow part? don't just ask if python features are fast or slow; find your bottleneck and address it <0> I'm doomsaying and you're dismissing. The real level of concern is somewhere in between. <4> if you ***ign to __slots__ instead of "dynamic" attributes then they will all exist (but be None) I think <2> hari`: then __init__, like any other function, should release resources that it's not going to keep. that probably happens automatically in most cases <3> drewp, there are no bottlenecks as i know of...I guess i'm just too used to other languages :P <2> reikon: if it's too slow, there's a bottleneck. It might be very large, but that's unlikely <2> have you profiled? <3> nope... <6> RELATION_OPTIONS = [('relate_work', 'Work'),] <0> drewp, sure, but it's a lot less messy if you separate construction from all that double-blind-extra-safe-try-catch-everything code in the ctor and dtor. <6> How do I extract 'relate_work' <7> I'm looking to write something that you would use in the same way as twisted, but could also be incorporated as part of a larger framework containing multiple instances - any ideas? <6> From a list with two tuple pairs like taht? <7> an rtfm is fine if you suggest one <2> Patrick`: what are "multiple instances" of a twisted-like lib? <7> 2hmm <0> brian, RELATION_OPTIONS[0][0] <6> I mean like, a function.... <6> The list has more than one thing in it. <7> well, it would abstract "being a client" for a given service <7> but there could be a larger program that allows multiple instances <7> I guess it wouldn't work <6> Usually there is a better thing than a loop <7> since it's event driven from that one socket/whatever <0> brian, uh, I don't follow. <3> drewp, i'll show you my code if you like and you can point out anything stupid i'm doing... <0> Your example isn't two tuple pairs, either. <2> reikon: please present output from a profiling p*** too, and then we can suggest actual improvements <2> reikon: without that, we can probably make style suggestions only <3> can you suggest a profiler? <7> ok, my fundemental question, looking over these twisted examples, is when they do "from a import b" then "def Cl***Name(a)", how does that work? <7> is that cl*** extension or something? <7> and I'd like to write something that lets someone do the same thing with my code as a backend <2> Patrick`: that wouldn't work, since "from a import b" doesn't put 'a' in the namespace
<7> drewp: you know what I mean, I just used the wrong temporary variables in my example <7> from foo import a <6> hari`: Like there's zip... <6> hari`: Is there an unzip function? <0> Did you look? <6> hari`: I searched google <6> hari`: didn't really find anything <6> I'm finding stuff about compression <2> Patrick`: then what's the question? Cl***Name is subcl***ing from 'a', which was in module foo <7> subcl***ing, right <7> I wanted to know what bit of OO programming I needed to learn about next <0> Uh, 'def Cl***Name(a)'? <0> def? <6> How do I merge two lists? <2> brian: the opposite of x=zip(a,b) is zip(*x) <7> cl*** <7> meh <3> drewp, heres the source: http://paste.insanityflows.net/viewpaste.php?id=49359 I'll look for a profiler.. i heard pylint was good <7> I can't read <7> but yes, that's what I mean <2> reikon: stdlib profile is probabyl fine <0> Patrick`, if you ask a question, get your words right or nobody can follow what you're asking. :) <7> hari`: anyway, point is I need to read about subcl***ing <6> How do I merge two lists? <7> so I can build something that mimics twisted in the way you'd use it <7> brian: depends <7> list3 = list1 + list2 <2> brian: what does merge mean? x+y will concatenate them <7> will append list2 to list1 <2> reikon: well, this is so short that maybe you already know which function you want to optimize. are your input strings long, or just numerous? <3> possibly both, depending on who's using it <2> reikon: well that's informative. What function, and for what type of input, would you like me to make optimization suggests for first? <2> also, why do you make those local functions hex_string and bin_string? they seem to just make the code a bit harder to read <3> drewp, engine_crypt or it's transparent methods preferably <2> reikon: it may help on very long inputs to preallocate self.out, like "self.out = [None] * len(input)" <3> to keep the code clean, and because I had already created them in other scripts, and it made more sense to make them nested functions <3> ahhh <3> i suppose i should do the same for state_array? <2> reikon: but my move in a case like this would be to compile the program with pyrex. A few type hints would make this run about as fast as C-- you probably wouldn't even have to rewrite any of the algorithm <2> reikon: no! a loop of length 256 is not worth complicating your code over <2> reikon: my goal, and i hope it's your goal too, is to make the code run fast with the least amount of added junk <3> it is, however it's also for easy usability <2> _rc4_init is probably running very rarely, and probably takes no time <3> hence the hex_string and bin_string methods <2> how is the usability going to change? we're not messing with the cl*** API <3> it reduced the code in my test vectors script <3> it's not i was just stating my goals :P <2> how do hex_string and bin_string make any difference to the users of the RC4 cl***? <3> it allows them to get the output of the cipher in hex or p***ed through chr() without having to create the code themselves <3> i've already made use of it in them each in two examples, and the test vectors cl*** <2> wait, i see the point of engine_crypt_hex and engine_crypt_bin, but why does each one have a nested function that does the work? <8> hey, anyone knows why Python needs the new with clause, rather than just use a simple @run @with_stuff decorators? <3> drewp, copy and paste from my other scripts. I created those methods and decided it'd be easier to implement them in the RC4 cl*** than to keep putting them in scripts <3> that used the RC4 cl*** <3> but I see what you mean... <2> reikon: you're making me suffer because you copy/pasted? <3> hehe <3> well....i see your point :P <8> anyone here took a look at subtext? <2> reikon: anyway, i have changed my mind again about the profiling. Is the majority of the time being spent in engine_crypt, or in one of the output-formatter functions? <3> output formatter <3> i believe... <3> *check profiler* <8> might as well use print profiles.. <8> or a statistic profiler.. <2> Peaker: i'd love a statistical profiler <8> drewp: I always use one.. KeyboardInterrupt :-) <2> Peaker: that is a fine one <2> but i cannot help but wonder if there coudl be something, i don't know, a bit *richer* <8> heh <8> shouldn't be too tough to do
Return to
#python or Go to some related
logs:
#perl pythonfu+win32 #php perl win32 process send sigint pam-login block shadow undelete files knoppix ext3 swftool script how to determine location of bash script #gentoo XFburn+burn dvd
|
|