TFKyle | sgeigerbot, triplah_w: if it just encodes all unicode paramaters sent to it maybe, but I think it'd be a bit hard to make a decorator that actually modified the function |
marienz | why would it have to modify the function it'd just have to do, erm, sec, hacking it up |
TFKyle | to encode all unicode objects in it |
marienz | it can't do that, but it can do it to all args |
sgeigerbot | TFKyle: Well, I tkhink the point of decorators is that the function isnt' modified. |
marienz | isn't that what the question is? |
sgeigerbot | TFKyle: he just wants parameters that are unicode. |
TFKyle | not sure |
marienz | triplah_w: what's the question again? :) |
TFKyle | ah, should've worded it better, I mean if you wanted to encode all unicodes in it |
pfn | hmm, ok, next question about python, can individual .py files in a "package" be split up amongst different directories? |
marienz | pfn: you don't normally want to do that, imho. pfn: you *can* do that (by modifying __path__ in the __init__ of the package) |
pfn | say I have trac.ticket.*, can I put SomeClass into /my/path/lib/trac/ticket/SomeClass, and the rest in /usr/lib/python/.../trac/ticket/* |
triplah_w | marienz: a decorator that encodes everything as utf-8 |
TFKyle | sgeigerbot: would need a huge amount of adoption to make much difference then I imagine |
marienz | pfn: but I disagree with the most common use case for that I have seen. |
triplah_w | although i'm guessing that writing a helper function would do the same thing |
marienz | triplah_w: define "everything" triplah_w: if "everything" means "all args and the return value" it is easy. |
triplah_w | marienz: sorry i cant do that, for me its just strings yep |
marienz | triplah_w: ok, what direction? the func gets passed unicode and you want it to get passed strings, or the other way around? meh, I'll just hack one up |
action | TFKyle figured triplah_w meant when that function calls things, to have it .encode on unicode objects |
TFKyle | figured triplah_w meant when that function calls things, to have it .encode on unicode objects |
triplah_w | yeah |
pfn | marienz, and what if I wanted to support my above use-case? basically have locally modified copies of the .py in the /my/path and still being able to use "pristine" copies in /usr/lib/... |
triplah_w | and viceversa for reading from files etc, to decode everything so no matter what your app gets datawise - it gets converted to utf-8 |
marienz | pfn: in a package: just copy it, imho. |
pfn | copy the entire package? hmm |
TFKyle | (which would require rewriting the function or some sort of weird stuff I think) |
pfn | I suppose I can try that |
TFKyle | file reading wouldn't be that hard I guess, monkeypatching file.read to do it guess py3k's io library'd be better though |
Ballo | thrash thrash thrash thrash... |
action | Ballo needs to reinstall |
Ballo | needs to reinstall |
marienz | triplah_w: http://rafb.net/p/XiUfjp14.html or something, but don't do it, it's a hack! also untested :) |