[issue33401] `exec` attribute can't be set to objects in Python2 (SyntaxError)

2018-05-01 Thread luav

luav <luar...@gmail.com> added the comment:

I'm sorry for the previous question, now it's clear (the space is allowed after 
the '.' which complicates the parsing):
```
>>> o.e = 1
>>> o. e
1
>>> o.e
1

```

Anyway, it would be nice to outline the eligible values for attributes in the 
documentation (https://docs.python.org/2/tutorial/classes.html).

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33401>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33401] `exec` attribute can't be set to objects in Python2 (SyntaxError)

2018-05-01 Thread luav

luav <luar...@gmail.com> added the comment:

Why Python 2 documentation does not outline that keywords / statements can't be 
used as the object attributes?
https://docs.python.org/2/reference/simple_stmts.html#exec

And why does this restriction exist at all? The keywords always stand-alone and 
newer follow '.', i.e. always distinguishable from the object attributes.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33401>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33401] `exec` attribute can't be set to objects in Python2 (SyntaxError)

2018-05-01 Thread luav

New submission from luav <luar...@gmail.com>:

The following code works fine on Python 3.5.2 but `exec` attribute fails to be 
set to the object on Python 2.7.12:
```python
>>> o = type('O', (object,), {})
>>> o.e = 1
>>> o.eval = 1
>>> o.exec = 1
  File "", line 1
o.exec = 1
 ^
SyntaxError: invalid syntax
```

OS Environments:  Ubuntu 16.04.4 LTS x64

--
components: Interpreter Core
messages: 316015
nosy: luav
priority: normal
severity: normal
status: open
title: `exec` attribute can't be set to objects in Python2 (SyntaxError)
type: behavior
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33401>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com