Details
-
AboutI'm still learning.
-
SkillsC, Asm, Python, Java
Joined devRant on 3/25/2017
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
-
@RTRMS I still disagree. Fields, classes and functions should always have self-explaining names, but local variables *may* not. Because long names can sometimes lower readability.
I provided an example in which I think the full local variable name doesn't contribute to readability.
To which you replied with something completely unrelated about mother name.
Context is important. I bet even you don't use full names for iteration indexes (i,j,k). It is a convention and it is obvious from context.
Sure, there are cases, where fully qualified local variable names are better, but that is not always the case.
And in case you think, I am just one crazy guy, many big respectable open source libraries use one letter variable names, when appropriate. For example, numpy and libstdc++ (gnu).
What I am trying to say is that there is nothing *intrinsically* bad about one letter variable names. If you use your brain and follow conventions, it's totally okay. -
@Michelle really? Even for iteration indexes through matrices?
You would prefer
for row in range(matrix.shape[0]):
for column in range(matrix.shape[1]):
result += matrix[row, column]
to
for i in range(m.shape[0]):
for j in range(m.shape[1]):
res += m[i, j]
? -
I strongly dislike this kind of question. The information you are given is intentionally vague. The "boxes have been labeled incorrectly" could be interpreted as them having wrong labels. Such as "potato, null, 42" or "apples, apples, oranges". There is no reason to assume that the wrong labels are a transposition of the correct ones, if you don't know the solution in advance. And the "such that no label identifies the contents" part even reinforces the uncertainty by suggesting that the labels lack information about the contents.
Although I have to admit, this question is much better than some other similar questions I've seen. -
And to convert it back you can just subtract it back:
char c;
int num = c-'0';
JK, this is in C. -
This comment section is rated M for "I am very Mature". *grabs his handy anti-shield, anti-tank, anti-nuke, anti-colt, anti-popcorn chainsaw*
-
I don't understand. What do you mean "It's not fools day, it's fools day"?
DOES NOT COMPUTE! -
I don't even have code and it SEGFAULTs just fine.
-
People, who post hashtags/tags as plaintext instead of as tags.
-
I enjoy writing one-liners for answers on exams and homework, when the question is intentionally malformed. If you assign me a task that I had to read 5 times to even understand what do you want from me and then even more time to figure out, that it's a trick question, you shouldn't expect me to write a sensibly documented, easy to read answer, right?
