Thank you very much for all your responses!
Now I have too much ideas :-)
I'm saving your answers and I'll see what is more
appropriate/comfortable in my case.
Best regards.
Paulo
--
https://mail.python.org/mailman/listinfo/python-list
On 3/22/2020 11:37 PM, DL Neil via Python-list wrote:
On 23/03/20 3:32 PM, Paulo da Silva wrote:
Às 02:18 de 23/03/20, Paulo da Silva escreveu:
Hi!
Olá,
Suppose a class C.
I want something like this:
class C:
KA=0
KB=1
KC=2
...
Kn=n
def __init__ ...
...
> On 23 Mar 2020, at 11:52, Rhodri James wrote:
>
> On 23/03/2020 02:18, Paulo da Silva wrote:
>> Hi!
>> Suppose a class C.
>> I want something like this:
>> class C:
>> KA=0
>> KB=1
>> KC=1
>> ...
>> Kn=n
>> def __init__ ...
>> ...
>> These constants
On 23/03/2020 02:18, Paulo da Silva wrote:
Hi!
Suppose a class C.
I want something like this:
class C:
KA=0
KB=1
KC=1
...
Kn=n
def __init__ ...
...
These constants come from an enum in a .h (header of C file).
They are many and
Does the enum module help?
https://docs.python.org/3/library/enum.html
Note that within __init__ you can reference your enumerated constants
using (for example) self.KA.
Skip
--
https://mail.python.org/mailman/listinfo/python-list
Paulo da Silva wrote:
> Às 02:18 de 23/03/20, Paulo da Silva escreveu:
>> Hi!
>>
>> Suppose a class C.
>> I want something like this:
>>
>> class C:
>> KA=0
>> KB=1
> KC=2
>> ...
>> Kn=n
>>
>> def __init__ ...
>> ...
>>
>>
>> These constants come from an enum in a .h (header of C file).
>> Th
On 23/03/20 3:32 PM, Paulo da Silva wrote:
Às 02:18 de 23/03/20, Paulo da Silva escreveu:
Hi!
Olá,
Suppose a class C.
I want something like this:
class C:
KA=0
KB=1
KC=2
...
Kn=n
def __init__ ...
...
These constants come
Às 02:18 de 23/03/20, Paulo da Silva escreveu:
> Hi!
>
> Suppose a class C.
> I want something like this:
>
> class C:
> KA=0
> KB=1
KC=2
> ...
> Kn=n
>
> def __init__ ...
> ...
>
>
> These constants come from an enum in a .h (header of C fil