aboutcode-org / aboutcode-org/aboutcode

Replace and rewrite "assert" statements in non-test code

Offen
#175 48 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
easy good first issue
Vorherrschende Sprache
Batchfile
Sterne
302
Forks
249
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
2

Beschreibung

See https://www.reddit.com/r/learnpython/comments/zd217y/is_using_assert_considered_good_practice/

> assert statements should only be used for debugging purposes. They are removed when not running in debug mode (i.e. when invoking the Python command with the -O or -OO options).

> Instead use a raise statement to throw a proper, informative runtime exception, if you need to. That would definitely be best practice when there'd otherwise be no sensible return value for the function.

We are using a few asserts in our main code. See https://github.com/search?q=org%3Aaboutcode-org+NOT+path%3A*test*++"assert"++language%3APython&type=code

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.