Комментарии:
If a module has a strictly defined _all_ object, wildcard imports are OK. Sorry, that one seems arguable.
ОтветитьHow to Know How many Built in Python Functions are There???
ОтветитьLoading just one function from a module does not improve perfomance overhead, since the rest of the module is still left loaded in the memory. You pay for the whole math lib, use the whole math lib
ОтветитьYeah, a single-letter-variable for a loop index or counter of some kind seems at worst harmless and at best very readable with intentions immediately obvious.
ОтветитьGreat video ❤
But can I know which program you're using? (The one in the video)
the variable i: "why would u do this! i was helping everyone and this is how u repay me😭"
ОтветитьRIP
for i in range()
And
For i,v in enumerate()
Not in my own programming language 💀💀💀
ОтветитьFor the last point I see a some of useful exceptions:
- i, j, k as abbreviations of index: they are ubiquitous and everyone understands it (although you should avoid nesting loops to need that many index names).
- import module as <letter>: since the module object itself is not useful, you will be using its methods and attributes, and their names will give additional context to the abbreviation.
- lambdas: since they are simple and mostly single use, the context should be enough to understand it.
- short lived variables: if you need some placeholder for up to... idk, 8 lines of code, a single letter variable or even an underscore is okay. Although avoid using more than one at the same time (unless the example is trivially simple, like an add two numbers function).
Atleast he's self aware about the last tip
ОтветитьThat flashback was unnecessary as your code is simple and readable
ОтветитьThanks
ОтветитьMistake #4: using python
ОтветитьMy code: i = [y, x for p, a in enumerate(l) if o == e]
ОтветитьPreviously I used single letter variable names but now I just call them xa, xb, xc, ...
ОтветитьEverything in context. You might want to overwrite a function. You must might want to import all, and you might want single character variables. Different tools, different context.
Ответить1. Use Python, unless you do data science.
ОтветитьI love you he admits he also makes the common mistakes
Ответить"from moduleX import foo" still loads the entire moduleX. there is no performance gain.
Ответитьi just need your vs code theme ❤
ОтветитьThe only time I do single letters is when Im doing something like algebraic expressions and equations using established equations ij my code, like using an equation to allow an accurate graph of a realworld equation to be referenced by the program during runtime. For example, lets say im working with statistics and exponential functions, I would use the variables given in the equation I'm referencing and use comments to provide the context of the referenced equation.
ОтветитьYou had us the in the first half ...
Ответитьint1 int2 int3 int4 int5 int6 ect...
Anyone?
you can use single letters for meaningless variables like the examples
Ответитьjust use c++
ОтветитьHow is this related to python?
Ответитьfor the second one please just use an ide. don't do imports manually. life's too short to do imports manually.
First one is a great tip especially with with a good example.
Last one is ok for writing but replace them by refactoring the var names when you managed to get it running. Exceptions are x y i and maybe n
你好
ОтветитьAs someone who also do C usibg a ' hurt my eyes
ОтветитьThe actual mistake is to use python to begin with
ОтветитьWhich IDL do you use to program?
Ответить1. Using python
ОтветитьIt's actually okay to use singular variable name of "i" because it has become a convention that "i" is the iterating variable, specifically of type integer.
Of course it's better to use a more descriptive name when possible, but sometimes it's not really necessary and instead reduces readability.
Excellent video
ОтветитьThemes?
ОтветитьThis isn’t just python, you shouldn’t do this stuff in any language
ОтветитьRemember the golden rule: the size of the variable should be proportional to the project size.
This is to not waste time making variable names whilst still allowing you and others to look trough the code within a reasonable time frame.
Theme name ?
ОтветитьPylint and mypy gonna help with that
ОтветитьWhy do you say Wild card import cause “unnecessary performance overhead”? I don’t think this true. When importing another module, Python loads everything from that module whether you use wild card import or not. The only difference is the name space pollution.
ОтветитьPython mistakes:
Fundamental syntax variations from version to version...
Who wants to learn python if your knowledge could become obsolete from version to version...
Flashback of "single letter variable name" got me rolling😂
ОтветитьI’m new to python, what program is he using to code
Ответить😂
ОтветитьSingle letter variable names are okay if your code is 10 lines or less and is very easy to trace
Ответитьstr more than function... It's class
ОтветитьMistake 2 is not a problem, its just if you do only this then do only this
ОтветитьSo helpful. 😊
Ответить"Try not to use single letter variable names"
TI-BASIC Developers: *Uncontrollable Sobbing*
The code in the video is small, so using a single letter as a variable name doesnt affect the code's visual that much
Ответить