-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Łukasz,

On 09/16/2011 03:42 AM, Łukasz Rekucki wrote:
> The one that just alters the given class also works, has no magic and
> has the same limitation - dont' do "B = decorator(A)". Honestly, I
> never needed that, but I understand some people might. Also note, that
> the "super() problem" is fixed in Python 3, where super() determines
> the base class from the call frame instead of referencing a global
> variable.

The failure mode for "just alter the given class" (i.e. monkeypatching)
is much worse if you're applying the decorator to a class defined
elsewhere (e.g. a non-subclassed generic view; and applying, say,
login_required to a generic view is a relatively common case). It
modifies the generic view itself, and suddenly every use of that view in
your entire codebase is login_required. Nasty and surprising bug, that.

Compared to this (and breaking super()), "weird alternate hierarchies"
and breaking issubclass is a minor issue. Not to say that I like it -
but we're dealing with a set of options that are all pretty bad, IMO.

Carl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5zNRgACgkQ8W4rlRKtE2didwCghtDhwFjGgnMKySa6egPRAnnI
ka4AnigoQlKV+//MUH6ze2LWzkra1CG3
=Duo1
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to