Skip to content

Commit 91668db

Browse files
Update Commands
1 parent ed6d649 commit 91668db

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

docs/python/functools

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
echo "python
4+
5+
Description:
6+
functools
7+
8+
9+
@cache
10+
@total_ordering"

docs/python/tuples

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
echo "python
4+
5+
Description:
6+
tuples
7+
8+
Tuples are objects that can store a specific number of other objects in order.
9+
They are immutable, meaning we can't add, remove, or replace objects on the fly.
10+
11+
Tuples are used to store data; behavior cannot be associated with a tuple.
12+
If we require behavior to manipulate a tuple, we hace to pass the tuple into
13+
function.
14+
15+
Examples:
16+
stock = \"FB\", 177.46, 178.67, 175.79
17+
or
18+
stock2 = (\"FB\", 177.46, 178.67, 175.79)
19+
20+
Access to tuple:
21+
stock = \"FB\", 177.46, 178.67, 175.79
22+
print(stock[2])
23+
or
24+
stock = \"FB\", 177.46, 178.67, 175.79
25+
symbol, current, hight, low = stock
26+
print(symbol)
27+
28+
29+
Named tuples
30+
31+
from collections import namedtuple
32+
33+
Stock = namedtuple(\"Stock\", [\"symbol\", \"current\", \"high\", \"low\"])
34+
stock = Stock(\"FB\", 177.46, 178.67, 175.79)
35+
stock.symbol
36+
37+
38+
Dataclasses
39+
40+
from dataclasses import dataclass
41+
42+
@dataclass
43+
class DataClassCard:
44+
name: str
45+
current: float
46+
high: float
47+
low: float
48+
"

scripts/python/functools

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
echo "New command created"

scripts/python/tuples

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
echo "New command created"

0 commit comments

Comments
 (0)