Just one additional word about mixins:
we've been inspired by Django's extensive usage of mixins for their
class-based views, forms and model classes. For one, we defined more
mixins for those classes (like UrlMixin for view classes), and for
another we developed our own mixin infrastructure
Hello,
I'm an attrs contributor so maybe I can clear up any questions.
Convert callables are only called in __init__, not in the setters. We've
had this requested a number of times and we will almost certainly support
it in the future, probably on an opt-in basis.
The reason we don't currently
Hi Guido,
Yes indeed, *only* invoked by __init__ .
See my test below.
=
import attr
@attr.s
class Foo:
x = attr.ib(convert=str)
foo = Foo(42)
print(repr(foo.x))
# prints '42'
foo.x = 42
print(repr(foo.x))
# prints 42
==
Not sure if this is a good design but it matches the docs.
So it is only called by __init__ and not by __setattr__?
On Fri, May 19, 2017 at 11:32 AM, Stephan Houben
wrote:
> Let me quote the attrs docs:
>
> ""
> convert (callable) – callable() that is called by attrs-generated __init__
> methods to convert attribute’s value to the
On 19.05.2017 04:37, Eric V. Smith wrote:
On 5/18/17 2:26 PM, Sven R. Kunze wrote:
On 17.05.2017 23:29, Ivan Levkivskyi wrote:
the idea is to write it into a PEP and consider API/corner
cases/implementation/etc.
Who's writing it?
Guido, Hynek, and I met today. I'm writing up our notes, and