[CentralOH] 2016-04-20 Aladdin's Napkin Scribbles: regex python3 v python2 goto harmful case harmful terraform kilt k1lt dandelions HFCS good cap city
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Wed Apr 20 19:31:17 EDT 2016
Need a good problem to solve with Python
for which regex is optimal[1] solution.
Then someone who eschews regexes
can show us an easier to read solution in Python (without regexes).
Eight folks showed up.
Python3 versus Python2
not enough packages have been ported from 2 to 3,
to do real projects
However, in past year, enough packages _have_ been ported to Python3,
that Python3 is feasible for most non-trivial projects.
Go To Statement Considered Harmful by Edsger W. Dijkstra
http://www.cs.utexas.edu/users/EWD/ewd13xx/EWD1308.PDF
Regexes considered harmful
too hard to read
I often find problems for which regexes are the best solution,
in spite of them being hard to read.
Great teaching technique
a dad would bring something home and set it in front of kid.
When asked by kid about it, the dad would say that you'll figure it out.
Someone
stopped using regexes when started using Python instead of Perl.
Regexes are OK on command line to search for something,
but not if that regex is then handed to someone else.
Someone said:
"My goal is for the next person who reads my code to not hate me."
case statement considered harmful
Case statement just not needed in Python.
Use a dictionary of functions instead.
Post a solution that uses case statement.
Watch someone else rework that in Python.
geek
devops geek
python devops geek
compare
some cloud* thing (cloudforms???)
Terraform by Hashicorp
some vendor independence
compare
kilt
k1lt
compare
dreidel
dirndl
dreidel
cohpy at lunch:~$ python3
Python 3.4.3 (default, Oct 14 2015, 20:33:09)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> random.randint(1, 4)
4
>>> random.randint(1, 4)
4
>>> random.randint(1, 4)
2
>>>
cohpy at lunch:~$
Someone
thought that dirndl is a made-up word.
One of us rode a motorcycle.
There was a beemer in the parking lot.
Of course you know that this leads to a
discussion of adjusting valves in the morning and ZMM.
dandelions are early food for honey bees
wp:Anaphylaxis
wp:Epinephrine autoinjector
Amazing calming effect of smoke on bees
smoke from just about anything works
bees attack dark things
beekeeping suits are white
spillage of HFCS from rail tankcar fed to bees
wp: prefix means Wikipedia
To get good answers, consider following the advice in the links below.
http://catb.org/~esr/faqs/smart-questions.html
http://web.archive.org/web/20090627155454/www.greenend.org.uk/rjk/2000/06/14/quoting.html
security mba: first monday? 6pm?
python mba: first tuesday?
lebanon night????: first monday evening at Mazah???? (research before going)
Jasmine's Lebanese salad was excellent
Cap City Diner on ORR
Pour cold water on skin on which hot coffee has been spilled.
[1] Of course, everyone will have their own idea of what optimal is.
Interpret that word as you wish.
More information about the CentralOH
mailing list