Emanuel Barry added the comment:

There definitely needs to be a better message for that. The problem is that the 
parser doesn't have access to the whole string (of course; it's being 
constructed!), so I think there are several possible venues here:

- Change DeprecationWarning to display the line which is faulty (unlikely);
- Promote these specific warnings to SyntaxErrors *only* if the warning is an 
error (i.e. Python was run with -W error), in which case the compilation of 
code is stopped either way, so there is no drawback (but only being a syntax 
error "sometimes" is likely to confuse people);
- Use a different warning class, but presumably we'd need a new one and we 
can't do that now since we're in beta (unless Ned thinks this is appropriate, 
but I doubt it).

Anything else, maybe? I'm sure there is a way to properly fix it; my personal 
favourite all things considered is the second option (which I've thought over 
and over recently), but I'm open to other, less intrusive alternatives.

My intention is to make this deprecation the least painful possible for 
application and third-party library developers. As such, I think adding a note 
to the docs (possibly in What's New, but probably also under a few other 
related places) is good, and probably doing a preemptive SO question+answer for 
people who stumble upon this.

I've added to nosy a couple of people whose feedback I believe could be very 
helpful.

----------
nosy: +brett.cannon, ncoghlan, rhettinger, yselivanov

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

Reply via email to