Conversation
|
Hi,
Couple ideas:
1. Itself is one word.
2. Double-quotation marks?
3. How about tuples? Something like,
a = "a", "b", "c", "d", "e",
The above becomes an immutable tuple by the compiler. In general, tuples
should perform a little better than lists, at least in terms of memory
usage.
4. This is confusing. Why use x twice?
Matrix = [[0 for x in range(5)] for x in range(5)]
Use an underscore if the index isn't needed.
Matrix = [[0 for _ in range(5)] for _ in range(5)]
5. It's okay to put comments above the expression being referred to. No
need for inline comments in most places.
No -
print(Matrix[0][0]) # prints 1
Yes -
# out: 1
print(Matrix[0][0])
6. Good to check if exists first.
Current -
def column(matrix, i):
return [row[i] for row in matrix]
Suggested -
def column(matrix, i):
if len(matrix) == 0 or len(matrix[0]) >= i:
return
return [row[i] for row in matrix]
Etc.
Really, just a terrible file that could use a lot more improvement. Sorry
if that comes across as rough as it's not a personal attack.
Best,
Mark M.
…On Sun, Jun 1, 2025, 2:42 AM temp382000 ***@***.***> wrote:
error fix in basic_commands.py.
------------------------------
You can view, comment on, or merge this pull request online at:
#27
Commit Summary
- 8452907
<8452907>
some erroe fix
File Changes
(1 file <https://github.com/ujjwalkarn/DataSciencePython/pull/27/files>)
- *M* basic_commands.py
<https://github.com/ujjwalkarn/DataSciencePython/pull/27/files#diff-5e6cfe1c2dacb0bb9ba922163e6195eb3545dc5fe158f3e58470eca8afc0f289>
(54)
Patch Links:
- https://github.com/ujjwalkarn/DataSciencePython/pull/27.patch
- https://github.com/ujjwalkarn/DataSciencePython/pull/27.diff
—
Reply to this email directly, view it on GitHub
<#27>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF62TY3PUVIBPAXJ5Q3XVWT3BLDHTAVCNFSM6AAAAAB6K4VMS6VHI2DSMVQWIX3LMV43ASLTON2WKOZTGEYDMOJWGQYTOOI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
error fix in basic_commands.py.