oct 13
questions
- asked in class: 'can I import all the modules at once?'
- answer: no. This is by design, I think: python tries to avoid what are called 'name collisions'. Also, there are *lots* by default and you may have installed more. See for example the list of modules in the base distribution (hundreds).
- We'll talk more about modules in chapter 10.
openglopish
- I've assigned a pig-latin exercise as homework.
- To explore how that sort of thing works, let's look at openglopish in class.
- See wikipedia:opish and the links from that page.
English: To speak Opish is to know Opish.
Openglopish: Topo spopeak Opopopish opis topo knopow Opopopish.
The rule is "Insert the syllable 'op' before the vowel cluster in each syllable."
This rule is a bit hard to automate, since figuring out what's a syllable and what isn't is tricky - for example, I think that 'are' turns into 'opare', since it only has one syllable.
So let's instead do our own version, which inserts 'op' before every consecutive string of vowels. Thus 'are' becomes 'oparope' and 'too' becomes 'topoo'.
Let's also try to do the right thing with capitals, turning "Alex' into 'Opalopex'.
Here are some of the sub-tasks to think about.
- Can we split a line into words?
- Can we insert 'op' into a word somewhere?
- Can we find the places to do the insertion?
- Can we allow for capitals?
Syntax reminders :