Skip to content

Commit fc379cb

Browse files
committed
added with statement and context managers
1 parent 8505a26 commit fc379cb

File tree

5 files changed

+254
-16
lines changed

5 files changed

+254
-16
lines changed

bibliography/bibliography.bib

+97-3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ @string { a_bottazzini_umberto
5959
@string { a_bradbury_james = "James Bradbury" }
6060
@string { a_brandl_georg = "Georg Brandl" }
6161
@string { a_brash_ron = "Ron Brash" }
62+
@string { a_bray_tim = "Tim Bray" }
6263
@string { a_brent_richard_p = "Richard P.\ Brent" }
6364
@string { a_brett_matthew = "Matthew Brett" }
6465
@string { a_bright_jonathan = "Jonathan Bright" }
@@ -85,6 +86,7 @@ @string { a_chintala_soumith
8586
@string { a_cimran_robert = "Robert Cimrman" }
8687
@string { a_clinton_david = "David Clinton" }
8788
@string { a_coghlan_alyssa = "Alyssa Coghlan" }
89+
@string { a_cole_timothy_w = "Timothy W.\ Cole" }
8890
@string { a_conway_john_horton = "John Horton Conway" }
8991
@string { a_cook_curtis_r = "Curtis R.\ Cook" }
9092
@string { a_cormen_thomas_h = "Thomas H.\ Cormen" }
@@ -154,12 +156,14 @@ @string { a_haberland_matt
154156
@string { a_haldane_allan = "Allan Haldane" }
155157
@string { a_hammoud_mohammad = "Mohammad Hammoud" }
156158
@string { a_hammouda_imed = "Imed Hammouda" }
159+
@string { a_han_myung_ja_k = "Myung{-}Ja K.\ Han" }
157160
@string { a_hance_jared = "Jared Hance" }
158161
@string { a_harris_charles_r = "Charles R.\ Harris" }
159162
@string { a_hastings_larry = "Larry Hastings" }
160163
@string { a_hausenblas_michael = "Michael Hausenblas" }
161164
@string { a_heap_danny = "Danny Heap" }
162165
@string { a_heiberg_johan_ludvig = "Johan Ludvig Heiberg" }
166+
@string { a_helmes_christian = "Christian Heimes" }
163167
@string { a_henriksen_ian = "Ian Henriksen" }
164168
@string { a_herbsleb_james_d = "James D.\ Herbsleb" }
165169
@string { a_hetland_magnus_lie = "Magnus Lie Hetland" }
@@ -194,6 +198,7 @@ @string { a_klein_andreas
194198
@string { a_klein_bernd = "Bernd Klein" }
195199
@string { a_klopf_andreas = "Andreas K{\"o}pf" }
196200
@string { a_knuth_donald_ervin = "Donald Ervin Knuth" }
201+
@string { a_kodes_katie = "Katie Kodes" }
197202
@string { a_kohn_tobias = "Tobias Kohn" }
198203
@string { a_komiya_takeshi = "Takeshi Komiya" }
199204
@string { a_konovalov_alexander = "Alexander Konovalov" }
@@ -229,6 +234,7 @@ @string { a_luce_laurent
229234
@string { a_lun_anthony_w_c = "Anthony W.{\nobreakdashes-}C.\ Lun" }
230235
@string { a_lundell_bjorn = "Bj{\"o}rn Lundell" }
231236
@string { a_luschny_peter = "Peter Luschny" }
237+
@string { a_maler_eve = "Eve Maler" }
232238
@string { a_mann_samuel = "Samuel Mann" }
233239
@string { a_marsh_charlie = "Charlie Marsh" }
234240
@string { a_massa_francisco = "Francisco Massa" }
@@ -270,6 +276,7 @@ @string { a_oliphant_travis_e
270276
@string { a_ortega_cisneros_susana = "Susana {Ortega Cisneros}" }
271277
@string { a_paixao_matheus = "Matheus Paix{\~a}o" }
272278
@string { a_pajankar_ashwin = "Ashwin Pajankar" }
279+
@string { a_paoli_jean = "Jean Paoli" }
273280
@string { a_paquete_luis = "Lu{\'i}s Paquete" }
274281
@string { a_pasareanu_corina_s = "Corina S.\ P{\u{a}}s{\u{a}}reanu" }
275282
@string { a_passos_alexandre = "Alexandre Passos" }
@@ -344,6 +351,7 @@ @string { a_smith_ethan
344351
@string { a_smith_nathaniel_j = "Nathaniel J.\ Smith" }
345352
@string { a_sobolev_nikita = "Nikita Sobolev" }
346353
@string { a_sottet_jean_sebastien = "Jean{\nobreakdashes-}S{\'e}bastien Sottet" }
354+
@string { a_sperberg_mcqueen_c_m = "C.\ M.\ Sperberg{-}McQueen" }
347355
@string { a_sphinx_developers = "{\Pgls{sphinx} Developers}" }
348356
@string { a_stein_clifford = "Clifford Stein" }
349357
@string { a_steiner_benoit = "Benoit Steiner" }
@@ -407,6 +415,7 @@ @string { a_yang_joonmo
407415
@string { a_yang_xuanda = "Xuanda Yang" }
408416
@string { a_ye_jingchen = "Jingchen Ye" }
409417
@string { a_yee_ka_ping = "Ka{\nobreakdashes-}Ping Yee" }
418+
@string { a_yergeau_francois = "Fran{\c{c}}ois Yergeau" }
410419
@string { a_yu_yuan = "Yuan Yu" }
411420
@string { a_zarrelli_giorgio = "Giorgio Zarrelli" }
412421
@string { a_zheng_xiaoqiang = "Xiaoqiang Zheng" }
@@ -464,6 +473,7 @@ @string { l_usa_chicago
464473
@string { l_usa_cincinnati = "{{Cincinnati}, {OH}, {USA}}" }
465474
@string { l_usa_columbia = "{{Columbia}, {SC}, {USA}}" }
466475
@string { l_usa_dallas = "{{Dallas}, {TX}, {USA}}" }
476+
@string { l_usa_dublin = "{{Dublin}, {OH}, {USA}}" }
467477
@string { l_usa_flower_mound = "{{Flower Mound}, {TX}, {USA}}" }
468478
@string { l_usa_hanover = "{{Hanover}, {MD}, {USA}}" }
469479
@string { l_usa_highland_park = "{{Highland Park}, {NJ}, {USA}}" }
@@ -491,6 +501,7 @@ @string { l_usa_seattle
491501
@string { l_usa_sebastopol = "{{Sebastopol}, {CA}, {USA}}" }
492502
@string { l_usa_shelter_island = "{{Shelter Island}, {NY}, {USA}}" }
493503
@string { l_usa_south_san_francisco = "{{South San Francisco}, {CA}, {USA}}" }
504+
@string { l_usa_wakefield = "{{Wakefield}, {MA}, {USA}}" }
494505
@string { l_usa_washington_dc = "{{Washington}, {DC}, {USA}}" }
495506
@string { l_usa_wilmington = "{{Wilmington}, {DE}, {USA}}" }
496507
@@ -533,6 +544,7 @@ @string { p_informs
533544
@string { p_io_press = "{{I/O}~Press}" }
534545
@string { p_iso = "{International Organization for Standardization~{(ISO)}}" }
535546
@string { p_leibniz_zentrum_fur_informatik = "{{Schloss Dagstuhl} -- {Leibniz\nobreakdashes-Zentrum f{\"u}r Informatik}}" }
547+
@string { p_libraries_unlimited = "Libraries Unlimited" }
536548
@string { p_logilab = "Logilab" }
537549
@string { p_manning_publications = "{Manning Publications}" }
538550
@string { p_mcgraw_hill = "{McGraw\nobreakdashes-Hill}" }
@@ -551,6 +563,7 @@ @string { p_oreilly
551563
@string { p_oxford_university_cl = "{Oxford University Computing Laboratory}" }
552564
@string { p_oxford_university_press = "{Oxford University Press}" }
553565
@string { p_packt = "{Packt Publishing Ltd}" }
566+
@string { p_payhip = "Payhip" }
554567
@string { p_pearson_education = "{Pearson Education, Inc.}" }
555568
@string { p_microsoft_press = "{Microsoft Press}, " # p_pearson_education }
556569
@string { p_plos = "Public Library of Science~{(PLOS)}" }
@@ -578,6 +591,7 @@ @string { p_university_of_toronto_cs
578591
@string { p_university_of_washington = "{University of Washington}" }
579592
@string { p_usas = "{United States of America Standards Institute~{(USAS)}}" }
580593
@string { p_usenix = "{{USENIX} Association}" }
594+
@string { p_w3c = "{World Wide Web Consortium~{(W3C)}}" }
581595
@string { p_wiley = "{Wiley}" }
582596
@string { p_wiley_and_sons_ltd = "{John Wiley and Sons Ltd.}" }
583597
@string { p_wiley_vch = "Wiley\nobreakdashes-VCH GmbH" }
@@ -621,6 +635,7 @@ @string { pa_ifip
621635
@string { pa_infinite_skills = l_canada_oakville }
622636
@string { pa_informs = l_usa_catonsville }
623637
@string { pa_leibniz_zentrum_fur_informatik = l_germany_wadern }
638+
@string { pa_libraries_unlimited = l_usa_dublin }
624639
@string { pa_logilab = l_france_toulouse }
625640
@string { pa_manning_publications = l_usa_shelter_island }
626641
@string { pa_mcgraw_hill = l_usa_new_york }
@@ -639,6 +654,7 @@ @string { pa_oreilly
639654
@string { pa_oxford_university_cl = l_uk_oxford }
640655
@string { pa_oxford_university_press = l_uk_oxford }
641656
@string { pa_packt = l_uk_birmingham }
657+
@string { pa_payhip = l_uk_london }
642658
@string { pa_pearson_education = l_usa_hoboken }
643659
@string { pa_microsoft_press = pa_pearson_education }
644660
@string { pa_plos = l_usa_san_francisco }
@@ -666,6 +682,7 @@ @string { pa_university_of_toronto_cs
666682
@string { pa_university_of_washington = l_usa_seattle }
667683
@string { pa_usas = l_usa_new_york }
668684
@string { pa_usenix = l_usa_berkeley }
685+
@string { pa_w3c = l_usa_wakefield }
669686
@string { pa_wiley = l_usa_hoboken }
670687
@string { pa_wiley_and_sons_ltd = l_uk_chichester }
671688
@string { pa_wiley_vch = l_germany_weinheim }
@@ -1000,6 +1017,12 @@ @xdata{ser_utics
10001017
series = {Undergraduate Topics in Computer Science~{(UTICS)}},
10011018
}
10021019

1020+
@xdata{ser_w3cr,
1021+
series = {{W3C}~Recommendation},
1022+
publisher = p_w3c,
1023+
address = pa_w3c,
1024+
}
1025+
10031026
@xdata{ser_zvegdwiih,
10041027
author = a_bachmann_paul_gustav_heinrich,
10051028
publisher = p_teubner_b_g,
@@ -1245,6 +1268,15 @@ @book{BN2018BC
12451268
isbn = {9781788629362},
12461269
}
12471270

1271+
@book{BPSMM2008EMLX1FE,
1272+
editor = a_bray_tim # and # a_paoli_jean # and # a_sperberg_mcqueen_c_m # and # a_maler_eve,
1273+
title = {Extensible Markup Language~(\pgls{xml})~1.0~(Fifth Edition)},
1274+
xdata = {ser_w3cr},
1275+
date = {2008-11-26/2013-02-07},
1276+
url = {http://www.w3.org/TR/2008/REC-xml-20081126},
1277+
urldate = {2024-12-15},
1278+
}
1279+
12481280
@article{C2002LFLHADWTDM,
12491281
title = {Learning from Liu Hui? A Different Way to Do Mathematics},
12501282
author = a_cullen_christopher,
@@ -1304,6 +1336,16 @@ @book{CEOEB2024GR
13041336
urldate = {2024-12-14},
13051337
}
13061338

1339+
@book{CH2013XFCAMLTMC,
1340+
author = a_cole_timothy_w # and # a_han_myung_ja_k,
1341+
title = {\pgls{xml} for Catalogers and Metadata Librarians~(Third Millennium Cataloging)},
1342+
edition = {1},
1343+
isbn = {9781598845198},
1344+
date = {2013-05-23},
1345+
publisher = p_libraries_unlimited,
1346+
address = pa_libraries_unlimited,
1347+
}
1348+
13071349
@book{CLRS2009ITA,
13081350
author = a_cormen_thomas_h # and # a_leiserson_charles_e # and # a_rivest_ronald_linn # and # a_stein_clifford,
13091351
title = {Introduction to Algorithms},
@@ -1633,6 +1675,14 @@ @article{H2007MA2GE
16331675
doi = {10.1109/MCSE.2007.55},
16341676
}
16351677

1678+
@book{H2021D0XBPFPSM,
1679+
author = a_helmes_christian,
1680+
title = {defusedxml~0.7.1: \pgls{xml}~Bomb Protection for \python\ stdlib Modules},
1681+
date = {2021-03-08},
1682+
url = {https://pypi.org/project/defusedxml},
1683+
urldate = {2024-12-15}
1684+
}
1685+
16361686
@book{H2022LML,
16371687
author = a_hausenblas_michael,
16381688
title = {Learning Modern \linux},
@@ -1809,6 +1859,14 @@ @book{K2018EIPFEUU
18091859
doi = {10.3139/9783446453876},
18101860
}
18111861

1862+
@book{K2019ITXJY,
1863+
author = a_kodes_katie,
1864+
title = {Intro to~\pgls{xml}, JSON, \&~YAML},
1865+
date = {2019/2020-09-04},
1866+
publisher = p_payhip,
1867+
address = pa_payhip
1868+
}
1869+
18121870
@book{K2024REH,
18131871
author = a_kuchling_andrew_m,
18141872
title = {\glslink{regexp}{Regular Expression} {HOWTO}},
@@ -2245,6 +2303,16 @@ @techreport{PEP289
22452303
urldate = {2024-11-08}
22462304
}
22472305

2306+
@techreport{PEP343,
2307+
author = a_van_rossum_guido # and # a_coghlan_alyssa,
2308+
title = {The \inQuotes{\pythonilIdx{with}} Statement},
2309+
xdata = {rep_pep},
2310+
number = {343},
2311+
date = {2005-05-13/2006-07-30},
2312+
url = {https://peps.python.org/pep-0343},
2313+
urldate = {2024-12-15},
2314+
}
2315+
22482316
@techreport{PEP362,
22492317
author = a_cannon_brett # and # a_seo_jiwon # and # a_selivanov_yury # and # a_hastings_larry,
22502318
title = {Function \Pgls{signature}\pythonIdx{signature} Object},
@@ -2370,7 +2438,6 @@ @techreport{PEP3107
23702438
title = {Function Annotations},
23712439
date = {2006-12-02},
23722440
xdata = {rep_pep},
2373-
xdata = {PEP},
23742441
url = {https://peps.python.org/pep-3107},
23752442
urldate = {2024-12-12},
23762443
}
@@ -2765,6 +2832,14 @@ @inbook{PSF2024TSTS
27652832
urldate = {2024-07-25},
27662833
}
27672834

2835+
@inbook{PSF2024TWS,
2836+
title = {The \pythonilIdx{with} Statement},
2837+
chapter = {8.5},
2838+
xdata = {PSF2024TPLR},
2839+
url = {https://docs.python.org/3/reference/compound_stmts.html#with},
2840+
urldate = {2024-12-15},
2841+
}
2842+
27682843
@xdata{PSF2024WNIP,
27692844
volume = {What's New in \python},
27702845
crossref = {PSF2024P3D}
@@ -2778,6 +2853,14 @@ @inbook{PSF2024WNIP38FSFSDEAD
27782853
urldate = {2024-12-01}
27792854
}
27802855

2856+
@inbook{PSF2024WSCM,
2857+
title = {With\pythonIdx{with} Statement Context Managers},
2858+
chapter = {3.3.9.},
2859+
xdata = {PSF2024TPLR},
2860+
url = {https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers},
2861+
urldate = {2024-12-15},
2862+
}
2863+
27812864
@inbook{PTVF2007EAAS,
27822865
title = {1.1~Error, Accuracy, and Stability},
27832866
chapter = {1~Preliminaries},
@@ -3112,7 +3195,7 @@ @book{TUC2023U1510
31123195
}
31133196

31143197
@book{TUC2023U151ACS,
3115-
title = {The Unicode Standard, Version~15.1:~Archived Code Charts},
3198+
title = {The \Pgls{unicode} Standard, Version~15.1:~Archived Code Charts},
31163199
date = {2023-08-25},
31173200
publisher = p_unicode_consortium,
31183201
address = pa_unicode_consortium,
@@ -3121,7 +3204,7 @@ @book{TUC2023U151ACS
31213204
}
31223205

31233206
@techreport{USAS1967USCFII,
3124-
title = {USA Standard Code for Information Interchange~{(ASCII~1967)}},
3207+
title = {{USA} Standard Code for Information Interchange~{(ASCII~1967)}},
31253208
date = {1967-07-07},
31263209
number = {USAS~X3.4-1967},
31273210
institution = p_usas,
@@ -3224,6 +3307,17 @@ @inproceedings{WW2023RSDEWASSAA
32243307
doi = {10.1145/3583133.3596306},
32253308
}
32263309

3310+
@techreport{Y2003UATFOI1,
3311+
author = a_yergeau_francois,
3312+
title = {\Pgls{utf8}, A Transformation Format of ISO~10646},
3313+
xdata = {rep_rfc},
3314+
number = {3629},
3315+
date = {2003-11},
3316+
url = {https://www.rfc-editor.org/rfc/rfc3629},
3317+
urldate = {2024-12-16},
3318+
addendum = {See \pgls{unicode} and~\cite{ISOIEC106462020ITUCCSU}}
3319+
}
3320+
32273321
@book{Y2022PPADT,
32283322
author = a_yanev_martin,
32293323
title = {\pycharm\ Productivity and Debugging Techniques},

notation/acronyms.sty

+3
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414
\newacronym[description={see \gls{stderrs} and~\cite{J2024PTOGBSI8IS12ESSSSIS}},sort={stderr}]{stderr}{\texttt{stderr}}{standard error stream}%
1515
\newacronym[description={see \gls{stdins} and~\cite{J2024PTOGBSI8IS12ESSSSIS}},sort={stdin}]{stdin}{\texttt{stdin}}{standard input stream}%
1616
\newacronym[description={see \gls{stdouts} and~\cite{J2024PTOGBSI8IS12ESSSSIS}},sort={stdout}]{stdout}{\texttt{stdout}}{standard output stream}%
17+
\newacronym[description={Universal Coded Character Set, see \gls{unicode}}]{UCS}{UCS}{Universal Coded Character Set}%
18+
\newacronym[description={\acrshort{UCS}~Transformation Format~8, see \gls{utf8} and~\cite{Y2022PPADT,ISOIEC106462020ITUCCSU}}]{UTF8}{UTF8}{\acrshort{UCS}~Transformation Format~8}%
1719
\newacronym[description={Version Control Systems, see \gls{vcs}}]{VCS}{VCS}{Version Control Systems}%
20+
\newacronym[description={Extensible Markup Language, see \pgls{xml} and~\cite{BPSMM2008EMLX1FE,K2019ITXJY,CH2013XFCAMLTMC}}]{XML}{XML}{Extensible Markup Language}%
1821
%

notation/terms.sty

+23
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,16 @@ See \cref{bp:typeHints,sec:varTypeHints}.%
321321
}%
322322
%
323323
%
324+
\newglossaryentry{utf8}{%
325+
name={UTF-8},%
326+
description={%
327+
The \acrfull{UTF8} is one standard for encoding \pgls{unicode} characters into a binary format that can be stored in files~\cite{Y2003UATFOI1,ISOIEC106462020ITUCCSU}. %
328+
It is the world wide web's most commonly used character encoding, where each character is represented by one to four bytes. %
329+
It is backwards compatible with ASCII~(see~\cref{sec:unicodeChars}).%
330+
}%
331+
}%
332+
%
333+
%
324334
\newglossaryentry{unicode}{%
325335
name={Unicode},%
326336
description={%
@@ -351,3 +361,16 @@ The \ensuremath{x}\nobreakdashes-axis is the horizontal axis of a two-dimensiona
351361
}%
352362
}%
353363
%
364+
%
365+
\newglossaryentry{xml}{%
366+
name={XML},%
367+
plural={XML},%
368+
description={%
369+
The \acrfull{XML} is a text-based language for storing and transporting of data~\cite{BPSMM2008EMLX1FE,K2019ITXJY,CH2013XFCAMLTMC}. %
370+
It allows you to define elements in the form \textil{<myElement myAttr="x">...text..</myElement>}. %
371+
Different from \pgls{csv}, elements in XML can be hierarchically nested, like~\textil{<a><b><c>test</c></b><b>bla</b></a>}, and thus easily represent tree structures. %
372+
XML is one of most-used data interchange formats. %
373+
To process XML in \python, use the \pythonilIdx{defusedxml} library~\cite{H2021D0XBPFPSM}, as it protects against several security issues.%
374+
}%
375+
}%
376+
%

text/main/classes/dunder/dunder.tex

+5
Original file line numberDiff line numberDiff line change
@@ -1239,4 +1239,9 @@
12391239
\FloatBarrier%
12401240
\endhsection%
12411241
%
1242+
\hsection{Implementing Context Managers for the \texttt{with} Statement Revisited}%
1243+
\label{sec:dunder:contextManager}%
1244+
%
1245+
\endhsection%
1246+
%
12421247
\endhsection%

0 commit comments

Comments
 (0)