Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add materials on paths & directories #650

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

encukou
Copy link
Member

@encukou encukou commented Aug 10, 2020

These are based on my notes from a PyWorking workshop, rewritten to be a bit better for self-study.

@frenzymadness, this might be useful for the stdlib course

@frenzymadness
Copy link
Member

This is exactly the topic I need to cover. I'm gonna do a review asap.

Copy link
Member

@frenzymadness frenzymadness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good to me. I've found only a few nitpicks but I wouldn't hesitate to include it as is. @adelpopelkova do you want to take a look?

`C:\Users\Jana\Documents\archiv.tar.gz`

Tahle cesta začíná na disku `C:`.
Windows mají na rozdíl od Unixu zvláštní souborový systém pro každý disk,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Řekl bych, že všechny systémy (Unix/Win) mají samostatný/zvláštní/oddělený souborový systém pro každý disk. Tedy kromě speciálních FS, které se dají natáhnout přes více fyzických disků.

Bez zabíhání do detailů bych řekl, že to hlavní k vysvětlení tady je, že na Windows má každý disk/FS vlastní kořenový adresář a na Unixu je ten hlavní opravu jen jeden.

Co třeba jen: Windows mají na rozdíl od Unixu zvláštní kořenový adresář pro každý disk – třeba C:\ a D:\ – zatímco na Unixu je hlavní kořenový adresář jen jeden a disky jsou v něm připojené jako speciální adresáře.

cesta.write_text('Holka modrooká\nNesedávej u potoka!')
```

{#
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patří sem tahle část? Nepříjemně to navazuje na Notebook.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To je sice fakt, ale zase není třeba hluboká znalost notebooku k pochopení problému. Bohužel mě nenapadá jiný příklad, kterým by to šlo nahradit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Možná by to šlo nahradit obecnou poznámkou bez konkrétního příkladu jen s ukázkou chybové hlášky, která je často jako přes kopírák.

lessons/intro/pathlib/index.md Outdated Show resolved Hide resolved
soubory/README
```

{#
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tady si taky nejsem jistý, jestli je to dobré probírat. Vysvětlit globy zabere dost času.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To je pravda, ale když už je to jednou napsáno tak bych to tam nechal. Navíc je to na konci, takže ideální kandidát na bonusové samostudium.

Případně je možné z toho udělat samostatné lekce.

Copy link
Contributor

@adelpopelkova adelpopelkova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a few things, but otherwise it looks good.

lessons/fast-track/filesystem/index.md Outdated Show resolved Hide resolved
lessons/fast-track/filesystem/index.md Outdated Show resolved Hide resolved
# Otevření textového souboru "basnicka.txt" pro čtení
with open('basnicka.txt', encoding='utf-8') as soubor:
# Přečtení obsahu
contents = soubor.read()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIčemu to nevadí, ale tento ukázkový program je psán "česky" a proměnná contents je "anglicky".

lessons/intro/pathlib/index.md Outdated Show resolved Hide resolved
Comment on lines +223 to +224
>>> cesta.is_absolute()
True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pokud je v proměnné cesta Path('/home/janca/Documents/archiv.tar.gz') tak na Windows je toto jako False.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Myslíš, že by na začátku stálo za to zmínit absolutní cestu pro Windows? Nebo jen napsat, že na Windows to nebude fungovat úplně přesně stejně? Přijde mi, že posluchač už by v tuto chvíli měl mít jasno v tom, že se cesty výrazně odlišují, a při zkoušení by měl psát cesty pro svůj systém.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Řekla bych, že je to vcelku jedno, poznámka o tom, že to nebude fungovat úplně stejně, případně ať si posluchači zkopírují cestu dle svého systému by mohla stačit.

## Zkoumání disku

Všechno uvedené výše jsou čistě „textové“ operace – pracují jen se jmény.
Soubor `archiv.zip` (ani jiné) počítači mít, aby ses dostal{{a}} k příponě
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soubor archiv.zip (ani jiné) počítači mít

Missing word/s?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Soubor `archiv.zip` (ani jiné) počítači mít, aby ses dostal{{a}} k příponě
Soubor `archiv.zip` (ani jiné soubory) není třeba na počítači mít, aby ses dostal{{a}} k příponě

lessons/intro/pathlib/index.md Outdated Show resolved Hide resolved
lessons/intro/pathlib/index.md Outdated Show resolved Hide resolved
V takových případech ale stačí Path převést na řetězec.

```pycon
>>> str(base / 'hrad.jpeg')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two variables referencing the same thing somewhere it is base and elsewhere it is zaklad.

lessons/intro/pathlib/index.md Outdated Show resolved Hide resolved
Co-authored-by: adelpopelkova <59389471+adelpopelkova@users.noreply.github.com>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
@frenzymadness
Copy link
Member

I'm gonna teach this lesson next week. If you don't have time to take a look on this PR, I'll apply our suggestions just to this course and we can get back to it later.

frenzymadness added a commit to PyLadiesCZ/naucse.python.cz that referenced this pull request Sep 16, 2020
lessons/fast-track/filesystem/index.md Outdated Show resolved Hide resolved
Comment on lines +463 to +464
>>> for cesta in zaklad.iterdir():
>>> print(cesta)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Úplná drobnost, for cyklus v interaktivní konzoli vypadá trochu jinak,

Co-authored-by: adelpopelkova <59389471+adelpopelkova@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants