Message249089
| Author |
larry |
| Recipients |
Arfrever, barry, berker.peksag, brett.cannon, eric.snow, josh.r, jwilk, larry, ncoghlan, njs, serhiy.storchaka, takluyver |
| Date |
2015年08月25日.00:32:06 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1440462727.25.0.0935518967849.issue24305@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Is it really *impossible* to "correctly issue a deprecation warning for a module", as the title asserts? Or does the new import system simply make it *tiresome*?
if sys.version_info.major == 3 and sys.version_info.minor == 4:
stacklevel = 8
elif sys.version_info.major == 3 and sys.version_info.minor == 4:
stacklevel = 10
else:
stacklevel = 2 # I bet they fixed it in 3.6!
warnings.warn("{} is deprecated".format(__name__), DeprecationWarning,
stacklevel=stacklevel)
That's Python for you, doing six "impossible" things before breakfast. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年08月25日 00:32:07 | larry | set | recipients:
+ larry, barry, brett.cannon, ncoghlan, jwilk, Arfrever, njs, eric.snow, takluyver, berker.peksag, serhiy.storchaka, josh.r |
| 2015年08月25日 00:32:07 | larry | set | messageid: <1440462727.25.0.0935518967849.issue24305@psf.upfronthosting.co.za> |
| 2015年08月25日 00:32:07 | larry | link | issue24305 messages |
| 2015年08月25日 00:32:06 | larry | create |
|