Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 81c6c1d

Browse files
committed
Many changes, just committing
1 parent 0504836 commit 81c6c1d

10 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎2._Learning_Python/A._Basic_-_no_OOP/1._Basic_constructs/3._Condtionals.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ elif condition3:
4242
# code
4343

4444
else:
45-
# no else
45+
# else
4646
}}}
4747

4848
Note: This is a syntax demonstration, you can't have empty blocks in Python. If you want to "do nothing", use ''pass'' keyword. Like so:

‎2._Learning_Python/A._Basic_-_no_OOP/4._Iterables/0._String.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ Created Thursday 14 January 2021
2424
"day" in "Monday, return
2525

2626
**String methods**
27-
1. string.''strip()'' -> a string - removes the ending characters maximally w.r.t to the given string, until a unknown character is encountered
27+
1. string.''strip()'' -> a string - removes the ending characters maximally w.r.t to the given string, until a unknown character is encountered.
2828
2. string.''split([sep=whitespace, [max_splits=-1]])'' - returns a list of strings which were seperated by 'sep' in the "string"
2929
3. sep''.join(''iterable of strings'')'' -> a string - joins the list/set/dict into a string seperated by sep, solves terminating comma-like problems.

‎2._Learning_Python/A._Basic_-_no_OOP/4._Iterables/1._Lists.txt‎

100755100644
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ Common operations:
3030
4. list(string) returns a list of the characters.
3131

3232
=== **Spread operator** - asterisk ===
33-
The spread operator is a very powerful and useful syntax sugar.
33+
* The spread operator is a very powerful and useful syntax sugar.
34+
* Used for list, set.
35+
* Double asterisk is used for dict.
3436
{{{code: lang="python3" linenumbers="True"
3537
x = [1, 2]
3638
y1 = list(x)+[3] # old style

‎2._Learning_Python/A._Basic_-_no_OOP/6._File_IO/1._Working_with_text_files.txt‎

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Reading is very easy.
1010
a. path can be relative(. and ..) or absolute. Just write file name if we are in the same directory.
1111
b. File will be created, only in **w **mode.
1212
c. Modes are discussed ahead.
13-
2. reading - check file.readable() == True
13+
2. reading - check ''file.readable()''
1414
a. readline() - line by line, one line as a string at a time
1515
b. readlines() - returns a list of lines as strings
1616
c. read() - returns the whole file as a string
@@ -27,7 +27,7 @@ f.close()
2727
* There's a fail-proof method for reading files - using **with **keyword, this tidies up the object after execution. Files support this. **with **also returns an exception if an **error occurs. **This is called a context Manager.
2828
This helps us release the file once we are done working on it:
2929
{{{code: lang="python3" linenumbers="True"
30-
with open('file.ext', 'r') as f: # same syntax as import
30+
with open('file.ext', 'r') as f: # same syntax as import, object of interest at the end
3131
for line in f:
3232
print(line, end='')
3333
# no need to close the file

‎2._Learning_Python/A._Basic_-_no_OOP/6._File_IO/1._Working_with_text_files/1._Read_functions.txt‎

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ data[0]=2 # throws an error that tuples are immutable - demonstrates successful
2525
}}}
2626

2727
eval() evaluates any string passed to **it as legitimate parts** of the programs.
28-
**Note:** eval() is not a good thing, coz it can be source of problems. Obviously. There are better ways to do it. As it could write/corrupt the file and/or have damaging unintended instructions while reading.
28+
**Note:** eval() is not a good thing, coz it can be source of problems. Obviously. There are better ways to do it. As it could write/corrupt the file and/or have damaging/unintended instructions while reading.

‎2._Learning_Python/A._Basic_-_no_OOP/6._File_IO/4._Shelve_-_Persistent_Dicts/1._Issues_with_Shelve.txt‎

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Content-Type: text/x-zim-wiki
2-
Wiki-Format: zim 0.4
2+
Wiki-Format: zim 0.6
33
Creation-Date: 2020-05-14T16:35:39+05:30
44

55
====== 1. Issues with Shelve ======
@@ -20,11 +20,11 @@ Created Thursday 14 May 2020
2020
* file.sync() clears the cache.
2121
{{{code: lang="python3" linenumbers="True"
2222
with shelve.open('recipies') as recipies:
23-
recipies['blt'].append('butter') #does not update
23+
recipies['blt'].append('butter') #does not update in file
2424

2525
with shelve.open('recipies') as recipies:
2626
temp_list = recipies['blt']
27-
temp_list.append('butter') #updates the list
27+
temp_list.append('butter') #updates the list in file
2828
}}}
2929

3030
**Remember**: Only values are tangible(printable, processable), not metadata like keys(), values() etc. All values are **returned by** **value**. This is **practical** because a single entry can be worked upon rather than millions of data entries. **This is why append does not work.**

‎2._Learning_Python/A._Basic_-_no_OOP/7._Functions_and_Modules/1._Functions/2._Params_and_Args/1._Order_of_params.txt‎

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Created Friday 15 January 2021
99
The sole purpose of using default params is that we can skip them in the function call. The order exists because if default params came:
1010
* Before or in between non-default - default args won't be skippable in function call(they'd have to be passed explicitly), thereby defeating their purpose.
1111
{{{code: lang="python3" linenumbers="True"
12-
def fun1(a="who is you", b="True", x, y):
12+
def fun1(a="who are you", b="True", x, y):
1313
print (a,b,x,y)
1414

1515
f("a arg", "b arg", 1, 2) # what's the use of default args
1616
}}}
1717

18-
* Hypothetically, it can be argued that even if the interpreter //were// made to //skip //default params; 'a' and 'b' in this case, and if we allowed for mixing the params. It would be impossible judge whether the arguments were supposed to be for a default or a non-default argument. It is ambiguos.
18+
* Hypothetically, it can be argued that even if the interpreter //were// made to //skip //default params; 'a' and 'b' in this case, and if we allowed for mixing the params. It would be impossible judge whether the arguments were supposed to be for a default or a non-default argument. It is ambiguous.
1919
{{{code: lang="python3" linenumbers="True"
2020
func1("ok a", "ok b", 1) # is "ok a" meant for 'a' or 'b'
2121
}}}

‎2._Learning_Python/A._Basic_-_no_OOP/7._Functions_and_Modules/3._Modules_and_Packages/0._Modules.txt‎

100755100644
File mode changed.

‎2._Learning_Python/A._Basic_-_no_OOP/7._Functions_and_Modules/3._Modules_and_Packages/1._Module_Search_Path.txt‎

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Created Tuesday 12 January 2021
77

88
Modules are accessed by importing them, using the ''import'' keyword.
99

10-
When the interpreter executes an ''import'' statement, it searches the in the //in-built modules **first**//. If not found, it looks at ''sys.path'' which is initalized based on these sources:
10+
When the interpreter executes an ''import'' statement, it searches the //in-built modules **first**//. If not found, it looks at ''sys.path'' which is initalized based on these sources:
1111
1. Current directory - location where the interpreter was started, may not be the place where the top-level script is present.
1212
2. PYTHONPATH (a list of directory names, copy of the terminal shell variable called PATH).
1313
3. An installation-dependent list of directories configured at the time Python is installed. This contains modules installed using pip.

‎3._Development_In_Python/1._Project_Structure/Project_Sandman/requirements.txt‎

Whitespace-only changes.

0 commit comments

Comments
 (0)