Memory layout of a data structure: Difference between revisions
Content added Content deleted
Line 175: | Line 175: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
This task cannot really be done efficiently in Python, as there is no type analogous to bit fields. The |
|||
<pre> |
|||
code below merely defines a dictionary with the pin names corresponding to entries in the dictionary. |
|||
⚫ | |||
# This task is easily accomplished with the use of a Python dictionary. |
|||
⚫ | |||
rs232 = { |
rs232 = { |
||
Line 204: | Line 205: | ||
} |
} |
||
#assignation and retrieval of data is trivial |
|||
rs232["RD Received data"] = 1 |
rs232["RD Received data"] = 1 |
||
print rs232["TC Transmit clock"] |
print rs232["TC Transmit clock"]</python> |
||
</pre> |