I love assert
TP
wingusr at gmail.com
Tue Nov 11 15:57:45 EST 2014
On Tue, Nov 11, 2014 at 11:40 AM, Peter Cacioppi <peter.cacioppi at gmail.com>
wrote:
> I think one needs to take care with some basic assert coding - it's not a
> substitute for unit tests, it doesn't absolve you of normal exception
> responsibilities, and, most of all, it should be used for passive
> inspection and not action. But given these guidelines, I still find it very
> useful as "active comments".
I first came across asserts when using Wing IDE. See "Helping Wing Analyze
Code" [1] explains why using assert and isinstance will let Wing IDE
autocomplete things it otherwise couldn't.
PyCharm uses docstrings to accomplish the same task [2] but can also use
asserts/isinstance [3].
[1] https://wingware.com/doc/edit/helping-wing-analyze-code
[2] https://www.jetbrains.com/pycharm/webhelp/type-hinting-in-pycharm.html
<https://www.jetbrains.com/pycharm/webhelp/type-hinting-in-pycharm.html#d232466e456>
[3]
http://stackoverflow.com/questions/9040387/is-there-a-way-to-explicitly-tell-pycharm-what-class-an-attribute-is-an-instance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141111/e2a53d1e/attachment.html>
More information about the Python-list
mailing list