"Eike Welk" wrote
In a rather consistent approach, Python does not provide any
standard way to simply define/describe/structure an object -- or a
class.
The added flexibility of Python gives great powers to the
programmers
of libraries.
It goves a lot of flexibility, whether that really is
> Python 2.x can add new methods to a user-defined class or instance or
> redefine existing methods.
> In [6]: def sayFoo(self): print 'foo'
>
> In [7]: Data.sayFoo = sayFoo
>
> In [8]: d1.sayFoo()
> foo
>
Now for some reason I was sure that didn't work. So sure I never even tried!
(despite
Hello Spir!
On Friday 30 January 2009, spir wrote:
> In a rather consistent approach, Python does not provide any
> standard way to simply define/describe/structure an object -- or a
> class.
The added flexibility of Python gives great powers to the programmers
of libraries.
There is for examp
On Fri, Jan 30, 2009 at 3:50 PM, Alan Gauld wrote:
> "spir" wrote
>
>> I was not thinking at data hiding or protection, rather at object
>> structure
>> (or behaviour) specification. First, to the human -- and alse to the
>> machine.
>
> Ah, OK, then in that case I am happier to agree that Python
"spir" wrote
I was not thinking at data hiding or protection, rather at object
structure
(or behaviour) specification. First, to the human -- and alse to the
machine.
Ah, OK, then in that case I am happier to agree that Python is unusual
(although not unique - Lisp can do the same) in its ab
Le Fri, 30 Jan 2009 19:05:40 -,
"Alan Gauld" a écrit :
> "spir" wrote
>
> > There is no real native support for ordinary OOP in python, meaning
> > as is done in most other languages, or according to the theory.
>
> I have to disagree. I think you are confusing OOP with C++ and Java.
> The
"spir" wrote
There is no real native support for ordinary OOP in python, meaning
as is done in most other languages, or according to the theory.
I have to disagree. I think you are confusing OOP with C++ and Java.
The early OOP languages had a variety of approaches to this. Several
took the s
On Fri, Jan 30, 2009 at 12:43, Kent Johnson wrote:
>
> A note on terminology: In Python, what you are describing is called an
> attribute. 'property' has a very specific meaning, it is a way to
> associate a value with an instance that uses attribute notation for
> access, i.e. a.b, but actually
Le Fri, 30 Jan 2009 12:22:10 +0100,
Vicent a écrit :
> Thanks to all for your clear answers. I learned a lot about the way Python
> manages properties or attributes.
>
> In my particular case, I think, as Spir said, that the best implementation
> depends on wether I am going to update the "base"
On Thu, Jan 29, 2009 at 1:59 PM, Vicent wrote:
> This is an easy question, I guess, but I am not able to find out the answer.
>
> In fact, it is both a Python question and a general programming "style"
> question.
>
> I want to define a class that contains a list (or a NumPy array) of elements
> o
Thanks to all for your clear answers. I learned a lot about the way Python
manages properties or attributes.
In my particular case, I think, as Spir said, that the best implementation
depends on wether I am going to update the "base" properties very often or
not, and wether I am going to access "t
>
>
>
> For me, the "()" look like artificial, not necessary. I would prefer just
> to type"a.list_1stpart" , a property.
>
>
>
> --
>
> Others have explained their preference for using get methods for accessing
internal data structures, However it does look like you have specifically
mention
"Vicent" wrote
This is an easy question, I guess, but I am not able to find out the
answer.
Or in fact a series of not so easy questions! :-)
Andre has already answered most of them but I'll add a few extras.
(1) Where are the right places to define PROPERTIES for my class,
and how (I
mea
Le Thu, 29 Jan 2009 19:59:09 +0100,
Vicent a écrit :
> This is an easy question, I guess, but I am not able to find out the answer.
>
> In fact, it is both a Python question and a general programming "style"
> question.
>
> I want to define a class that contains a list (or a NumPy array) of ele
On Thu, Jan 29, 2009 at 7:59 PM, Vicent wrote:
> This is an easy question, I guess, but I am not able to find out the answer.
>
> In fact, it is both a Python question and a general programming "style"
> question.
>
> I want to define a class that contains a list (or a NumPy array) of elements
> o
This is an easy question, I guess, but I am not able to find out the answer.
In fact, it is both a Python question and a general programming "style"
question.
I want to define a class that contains a list (or a NumPy array) of elements
of a certain type, and an integer:
class ExampleList :
d
16 matches
Mail list logo