Skip to content

Commit

Permalink
Update Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
josedejesuschavez committed Feb 27, 2021
1 parent ed6d649 commit 91668db
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/python/functools
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo "python
Description:
functools
@cache
@total_ordering"
48 changes: 48 additions & 0 deletions docs/python/tuples
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

echo "python
Description:
tuples
Tuples are objects that can store a specific number of other objects in order.
They are immutable, meaning we can't add, remove, or replace objects on the fly.
Tuples are used to store data; behavior cannot be associated with a tuple.
If we require behavior to manipulate a tuple, we hace to pass the tuple into
function.
Examples:
stock = \"FB\", 177.46, 178.67, 175.79
or
stock2 = (\"FB\", 177.46, 178.67, 175.79)
Access to tuple:
stock = \"FB\", 177.46, 178.67, 175.79
print(stock[2])
or
stock = \"FB\", 177.46, 178.67, 175.79
symbol, current, hight, low = stock
print(symbol)
Named tuples
from collections import namedtuple
Stock = namedtuple(\"Stock\", [\"symbol\", \"current\", \"high\", \"low\"])
stock = Stock(\"FB\", 177.46, 178.67, 175.79)
stock.symbol
Dataclasses
from dataclasses import dataclass
@dataclass
class DataClassCard:
name: str
current: float
high: float
low: float
"
3 changes: 3 additions & 0 deletions scripts/python/functools
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo "New command created"
3 changes: 3 additions & 0 deletions scripts/python/tuples
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo "New command created"

0 comments on commit 91668db

Please sign in to comment.