On 30 Nov, 18:14, inhahe <inh...@gmail.com> wrote:
> i don't think structs technically exist in Python (though they exist
> in C/C++), but you could always use a plain class like a struct, like
> this, for a simple example:
>
> class Blah:
>   pass
>
> b = blah()
> b.eyecolor = "brown"

[...]

Yes, a "bare" class can be instantiated and the attributes of the
created instance populated as desired. In fact, there are structures
(or "structs") provided by various built-in extensions supplied with
Python, such as the time structure (struct_time), although this
appears as a class if you try to investigate it more closely from the
Python prompt. See the Objects/structseq.c file in the Python source
distribution for how such structures are actually implemented,
however.

Paul
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to