Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105219 > unrolled thread

Re: monkey patching __code__

Started by"Sven R. Kunze" <srkunze@mail.de>
First post2016-03-18 15:32 +0100
Last post2016-03-18 15:32 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: monkey patching __code__ "Sven R. Kunze" <srkunze@mail.de> - 2016-03-18 15:32 +0100

#105219 — Re: monkey patching __code__

From"Sven R. Kunze" <srkunze@mail.de>
Date2016-03-18 15:32 +0100
SubjectRe: monkey patching __code__
Message-ID<mailman.322.1458311532.12893.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web