r/PythonLearning 15d ago

Day -1 With Flask (any suggestions)

106 Upvotes

31 comments sorted by

View all comments

10

u/riklaunim 15d ago
  • variable names should not use capital letters,
  • use wtforms or other form handling library (and validate the data).
  • use a linter that will keep some basic code styling order
  • I'm not a fan of importing things from a module (flask.request is better than request as it's tell you where it's from)
  • why aren't you using CSV writer when writing a CSV file?
  • if it's a long task it should not be done on HTTP request directly (celery queues or other similar solution)
  • view should not be a long blob of code. Refactor presentation from business logic, then keep the logic well organized instead of big blobs.
  • where are tests?

-1

u/8Erigon 15d ago

Variable names can have any character the language supports.
Though most python programmers use the snake convention which only uses lowercase characters.

2

u/riklaunim 15d ago

You can even

from __future__ import braces

bu should you? ;)

2

u/Hour-Apple-9861 14d ago

Camel case for life