On 09/24/11 17:41, rantingrick wrote:
On Sep 24, 3:57 am, Steven D'Aprano wrote:
class StandardTestMixin:
def test_requires_one_argument(self):
self.assertRaises(TypeError, self.func)
def test_has_docstring(self):
self.assertTrue(self.func.__doc__)
And this is ano
On 9/24/2011 4:57 AM, Steven D'Aprano wrote:
Python says is that issubclass(Cat, Yamlafiable) will return True. The
*interpretation* of that fact is entirely up to you. If you want to
interpret it as meaning that cats are Yamlafiables, go right ahead. If you
want to interpret it as a technical r
On Sep 24, 3:57 am, Steven D'Aprano wrote:
> class StandardTestMixin:
> def test_requires_one_argument(self):
> self.assertRaises(TypeError, self.func)
> def test_has_docstring(self):
> self.assertTrue(self.func.__doc__)
And this is another example of why we need doc-stri
On Sep 22, 4:14 pm, Matt wrote:
> I'm curious about what people's opinions are about using mixins in
> Python. I really like, for example, the way that class based views
> were implemented in Django 1.3 using mixins. It makes everything
> extremely customizable and reusable. I think this is a very
On Thursday, September 22, 2011 2:14:39 PM UTC-7, Matt wrote:
> In terms of code, lets say we have the following classes:
>
> class Animal
> class Yamlafiable
> class Cat(Animal, Yamlafiable)
> class Dog(Animal, Yamlafiable)
>
> I've got an Animal that does animal things, a Cat that does cat thin
On Thursday, September 22, 2011 2:14:39 PM UTC-7, Matt wrote:
[snip]
> class MyMixin(object):
> def one_thing(self):
> return "something cool"
>
> @mixin(MyMixin)
> class MyClass(object):
> pass
>
> x = MyClass()
> x.one_thing() == 'something cool'
> x.__class__.__bases__ == (obj
Matt wrote:
> I'm curious about what people's opinions are about using mixins in
> Python. I really like, for example, the way that class based views
> were implemented in Django 1.3 using mixins.
Mixins considered harmful:
http://www.artima.com/weblogs/viewpost.jsp?thread=246341
http://www.artim
Matt wrote:
> I'm curious about what people's opinions are about using mixins in
> Python. I really like, for example, the way that class based views
> were implemented in Django 1.3 using mixins. It makes everything
> extremely customizable and reusable. I think this is a very good
> practice to
On 2011-09-22 23:14, Matt wrote:
> I'm curious about what people's opinions are about using mixins in
> Python. I really like, for example, the way that class based views
> were implemented in Django 1.3 using mixins. It makes everything
> extremely customizable and reusable. I think this is a very
On Sep 22, 4:14 pm, Matt wrote:
> (although having only a single parent doesn't
> make much sense either, I believe there are very few actual documented
> cases of that happening).
There is nothing wrong with an object having only one parent. Most
times the reasons are for maintainability. I mig
10 matches
Mail list logo