Compound data type: Difference between revisions

Content added Content deleted
(move cat to top)
(→‎[[Python]]: -- nothing version specific in this example)
Line 252: Line 252:
[[Category:Python]]
[[Category:Python]]


'''Interpreter:''' [[Python]] 2.5
'''Interpreter:''' [[Python]]


The simplest way it to use a tuple, or a list if it should be mutable:
The simplest way it to use a tuple, or a list if it should be mutable:
Line 270: Line 270:
p = Point()
p = Point()
print p.x
print p.x

One could also simpley instantiate a generic object and "monkeypatch" it:

point = object()
point.x, point.y = 0, 1


==[[Ruby]]==
==[[Ruby]]==