Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72435 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2014-06-02 19:59 +0200 |
| Last post | 2014-06-02 19:59 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Strange Behavior Peter Otten <__peter__@web.de> - 2014-06-02 19:59 +0200
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2014-06-02 19:59 +0200 |
| Subject | Re: Strange Behavior |
| Message-ID | <mailman.10569.1401731983.18130.python-list@python.org> |
robertw89@googlemail.com wrote:
> Hello folks,
>
> I am not sure if it is only on my system the case that the code in
> http://pastebin.com/WETvqMJN misbehaves in the stated way.
> Can anybody reproduce it?
>
> I thought it could be that the tabs/spaces do influence it, but it doesn't
> care.
>
> Thank you very much for your time.
>
> Robert
I get what you expect:
$ cat bug.py
class EnumSectionContentType(object):
DATABYTE = 2
DATADOUBLEWORD = 3
DATAWORD = 4
#LABEL = 0
def _getStringOfElements(elements):
objectFileString = ""
elements = [{'type': 2, 'data': {'elements': ['83H', '0FAH', '9AH', '27H', '81H', '49H', '0CEH', '11H']}}]
for iterationElement in elements:
objectFileString += "INSIDE1 "
if iterationElement["type"] == EnumSectionContentType.LABEL:
objectFileString += iterationElement["data"]["labelname"] + ":" + "\n"
elif iterationElement["type"] == EnumSectionContentType.DATABYTE:
objectFileString += "INSIDE" + "\n"
if iterationElement["type"] == EnumSectionContentType.DATADOUBLEWORD:
objectFileString += objectFileString + "dd "
elif iterationElement["type"] == EnumSectionContentType.DATABYTE:
objectFileString += objectFileString + "db "
return objectFileString
print(_getStringOfElements(None))
$ python3.4 bug.py
Traceback (most recent call last):
File "bug.py", line 27, in <module>
print(_getStringOfElements(None))
File "bug.py", line 15, in _getStringOfElements
if iterationElement["type"] == EnumSectionContentType.LABEL:
AttributeError: type object 'EnumSectionContentType' has no attribute 'LABEL'
Are you absolutely sure you are invoking the right bug.py?
(I think on windows you can use type instead of cat to see
the file contents).
Back to top | Article view | comp.lang.python
csiph-web