Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #105219
| From | "Sven R. Kunze" <srkunze@mail.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: monkey patching __code__ |
| Date | 2016-03-18 15:32 +0100 |
| Message-ID | <mailman.322.1458311532.12893.python-list@python.org> (permalink) |
| References | <56EBEB5A.7050207@mail.de> <CALwzid=XVSnSEt14Oer-2dO-0kT+fLi1EP4mNehXc0+zDqTX=g@mail.gmail.com> |
On 18.03.2016 14:47, Ian Kelly wrote:
> Your patched version takes two extra arguments. Did you add the
> defaults for those to the function's __defaults__ attribute?
That's it! :-) Thanks a lot.
Just to understand this better: why is that not part of the code object
but part of the function?
> This sounds like a pretty hairy thing that you're trying to do. Surely
> there must be some better way to accomplish the same goal.
We are open for suggestions. We featured our own reverse function for a
while but it lead to inconsistent behaviors across the field. Especially
considering that Django provides an {% url %} template tag which would
then use yet another reverse implementation.
Best,
Sven
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: monkey patching __code__ "Sven R. Kunze" <srkunze@mail.de> - 2016-03-18 15:32 +0100
csiph-web