coding-style tag

17 questions


1 answers
95 views
0
Why do you define main() instead of just using it?

def main(): # Which chord?if __name__ == __main__: main()Why do you just do it like that from the top of the file when you have to define the main() in this way?

1 years ago

1 answers
114 views
0
How do I write conditional statements across lines in an if statement?

What kind of method should I use to write conditions across lines for if?if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_somethingThis way, code3 is on the same li...

1 years ago

1 answers
84 views
0
How to Overload Generators

I know that you can't make multiple _init__ in Python classSo how do I overload the constructor?My source code is You have to.Source Code 1 has two _init__ so it does not run properlySource code 2 wor...

1 years ago

1 answers
87 views
0
How to style TextView in code

To style a text view in code in a constructorTextView myText = new TextView(MyActivity.this, null, R.style.my_style );I tried it like this, but the style didn't apply at all. somyText.setTextAppearanc...

1 years ago

1 answers
72 views
0
Why do you have to cover it with a block when you repeat only one line of code?

I'm taking a C++ course and in the textbook,It says so. Other than that, you can understand it for readability or safety reasonsI don't understand to use {} even when writing a line.I think the source...


1 answers
111 views
0
What is the most appropriate translation of "deferred"?

For example:The escape() function was deprecated.What would be the most appropriate translation?

1 years ago

1 answers
74 views
0
Which do you use for indentation in Python, tab or space?

I indented it with a tap when I made the Python codeI'm asking because I heard that it's better to float it in space because the length of the tab is different between editorsHow are other Python deve...

« - 2 -

© 2024 OneMinuteCode. All rights reserved.