[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Eric V. Smith

Change by Eric V. Smith :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread miss-islington

miss-islington  added the comment:


New changeset 3b4c6b16c597aa2356f5658dd67da7dcd4434038 by Miss Islington (bot) 
in branch '3.7':
bpo-32505: dataclasses: raise TypeError if a member variable is of type Field, 
but doesn't have a type annotation. (GH-6192)
https://github.com/python/cpython/commit/3b4c6b16c597aa2356f5658dd67da7dcd4434038


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset 56970b8ce9d23269d20a76f13c80e670c856ba7f by Eric V. Smith in 
branch 'master':
bpo-32505: dataclasses: raise TypeError if a member variable is of type Field, 
but doesn't have a type annotation. (GH-6192)
https://github.com/python/cpython/commit/56970b8ce9d23269d20a76f13c80e670c856ba7f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5940

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Eric V. Smith

Change by Eric V. Smith :


--
keywords: +patch
pull_requests: +5939
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Eric V. Smith

Eric V. Smith  added the comment:

Thanks for the offer. I've already got the code written, I just need to write 
some tests. I'll get it done real soon now.

--
components: +Library (Lib)
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

> you'll notice that's an error?

Yes, but there are other scenarios, like using `init=False` or updating 
existing class definition and forgetting to update call sites (which will still 
work), etc.

What would we lose by not flagging this as an error? I think there are no 
legitimate use cases for such code, and implementation is straightforward. If 
you don't have time I can do this myself.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

But surely when you instantiate this: 
c = C(1)

you'll notice that's an error?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Some part of the discussion is in https://bugs.python.org/issue32428

I still think it is important to flag things like this as an error:

@dataclass
class C:
x = field()

This is a big bug magnet. Especially taking into account that attrs behave in 
the opposite way in this case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Guido van Rossum

Guido van Rossum  added the comment:

Fine to close as wontfix.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm not sure this is worth preventing. I can certainly make it an error, but 
since dataclasses ignores anything without a type annotation, I don't think 
it's a big deal. Basically I'd have to look through all class attributes that 
are of type Field but aren't in the class's __annotations__.

I cannot find the original conversation that caused me to open this issue. If 
anyone feels strongly that this case should be an error, let me know.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-01-06 Thread Eric V. Smith

Change by Eric V. Smith :


--
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32505] dataclasses: make field() with no annotation an error

2018-01-06 Thread Eric V. Smith

New submission from Eric V. Smith :

This is an attractive nuisance, especially when coming from attrs. Make it an 
error, since it's using field() with no annotation:

@dataclass
class C:
x = field()

--
assignee: eric.smith
messages: 309586
nosy: eric.smith, gvanrossum, levkivskyi
priority: normal
severity: normal
status: open
title: dataclasses: make field() with no annotation an error
type: behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com