[issue26951] Unintuitive error when using generator expression in class property

2016-05-04 Thread Corey Farwell

New submission from Corey Farwell:

```
class A:
B = range(10)
C = frozenset([4, 5, 6])
D = list(i for i in B)
E = list(i for i in B if i in C)
```

```

coreyf@frewbook-pro /tmp [1]> python3 a.py
Traceback (most recent call last):
  File "a.py", line 1, in 
class A:
  File "a.py", line 5, in A
E = list(i for i in B if i in C)
  File "a.py", line 5, in 
E = list(i for i in B if i in C)
NameError: name 'C' is not defined
```

Why should I be able to access B but not C?

--
components: Interpreter Core
messages: 264819
nosy: corey
priority: normal
severity: normal
status: open
title: Unintuitive error when using generator expression in class property
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue18680] JSONDecoder should document that it raises a ValueError for malformed data

2013-08-07 Thread Corey Farwell

New submission from Corey Farwell:

Before someone comes in and tries to correct me, I know Python documentation is 
different than Javadocs. It is common to test if the JSON is malformed using a 
try...catch. What if I want to catch something more specific than Exception? 
The only way a user would know what to catch is to `python -c import json; 
json.loads('FAIL')`. Many other Python modules document which exception is 
raised on invalid input/parameters.

--
assignee: docs@python
components: Documentation
messages: 194628
nosy: corey, docs@python
priority: normal
severity: normal
status: open
title: JSONDecoder should document that it raises a ValueError for malformed 
data
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18680
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18680] JSONDecoder should document that it raises a ValueError for malformed data

2013-08-07 Thread Corey Farwell

Corey Farwell added the comment:

Ideally, this would also be decoumented in json.loads/json.load

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18680
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com