On Thu, Jan 28, 2016 at 9:56 AM, Chris Angelico wrote:
> On Fri, Jan 29, 2016 at 12:56 AM, jmp wrote:
> > My guess is that models.Model has a metclass. Without going too much int
> > details, the metaclass may change the class structure when it's created.
> >
> > django is very specific and very
On 28/01/16 13:15, ast wrote:
hello
Here is a class from django framework
from django.db import models
class Article(models.Model):
titre = models.CharField(max_length=100)
auteur = models.CharField(max_length=42)
contenu = models.TextField(null=True)
date = models.DateTimeField(
On Fri, Jan 29, 2016 at 12:56 AM, jmp wrote:
> My guess is that models.Model has a metclass. Without going too much int
> details, the metaclass may change the class structure when it's created.
>
> django is very specific and very database oriented.
>
> "
> article = Article(titre="Bonjour", aute
"ast" a écrit dans le message de
news:56aa1474$0$27833$426a7...@news.free.fr...
OK, thank you for answer
I didn't studied metaclass yet that's why it is not clear for me.
I have to take a look at that concept first
--
https://mail.python.org/mailman/listinfo/python-list
On 01/28/2016 02:15 PM, ast wrote:
hello
Here is a class from django framework
from django.db import models
class Article(models.Model):
titre = models.CharField(max_length=100)
auteur = models.CharField(max_length=42)
contenu = models.TextField(null=True)
date = models.DateT
On 12/3/2010 11:58 PM, Steven D'Aprano wrote:
> Right. If you define a *class* attribute, it lives in the class, not the
> instance, and so all instances share the same value.
Unless, of course, an instance binds the same name in its namespace, in
which case it will (usually) mask the class attri
On Sat, 04 Dec 2010 15:00:43 +0100, Omar Abo-Namous wrote:
>>> I think this behaviour is totally wrong, since it seems
>>> A.__init__(self) is changing the value inside of A() not inside of the
>>> object variable 'self' (that should be x or y)!!
>> It's not wrong at all. You expect "mylist" to b
Am 03.12.2010 23:11, schrieb Arnaud Delobelle:
OAN writes:
Hi,
i was having a problem with class attributes initiated outside of
__init__. This code is a demonstration of what i mean:
class A():
mylist = []
def __init__(self):
self.mylist.append(1)
pass
class B(A
On Fri, 03 Dec 2010 22:54:19 +0100, OAN wrote:
> Hi,
>
> i was having a problem with class attributes initiated outside of
> __init__. This code is a demonstration of what i mean:
[...]
> I would expect the following result:
>
> v: [1]
> x: [1, 2]
> y: [1, 2]
> z: [1]
> v: [1]
>
> Who wouldn't,
OAN writes:
> Hi,
>
> i was having a problem with class attributes initiated outside of
> __init__. This code is a demonstration of what i mean:
>
> class A():
> mylist = []
> def __init__(self):
> self.mylist.append(1)
> pass
>
> class B(A):
> def __init__(self):
>
Donnal Walter wrote:
> Each "presenter" (instance) needs its own "view" (instance). The class
> attribute references a wxPython class. The resulting instance attribute
> references a wxPython object (widget or container).
This is a reasonable idea, but it would be less confusing
to give the cla
Well, I've never heard of a method like that for assigning variables.
I'd rather put it in the __init__ method.
--
http://mail.python.org/mailman/listinfo/python-list
Devan L wrote:
> Why make it an instance attribute? Couldn't you just look at
> the class attribute?
Each "presenter" (instance) needs its own "view" (instance). The class
attribute references a wxPython class. The resulting instance attribute
references a wxPython object (widget or container)
Why make it an instance attribute? Couldn't you just look at the class
attribute? If its something that depends on each instance's value
assigned to the attribute, why not make it an instance attribute to
start with?
--
http://mail.python.org/mailman/listinfo/python-list
14 matches
Mail list logo