Python 2.7.6 help with modules

Chris Angelico rosuav at gmail.com
Sun Feb 9 03:14:52 CET 2014


On Sun, Feb 9, 2014 at 1:07 PM, Scott W Dunning <swdunning at cox.net> wrote:
>
> On Feb 8, 2014, at 6:46 PM, Chris Angelico <rosuav at gmail.com> wrote:
>
> I had no idea
> that, in a group of half a dozen nerds, nobody would recognize this
> broken text: "In brightest day, in blackest night / No evil ......
> sight / Let .... worship .... mi.... / .... my power .... tern...." -
> I'd have thought the first line alone would be enough for anyone who's
> at least mildly nerdy and/or geeky.)
>
> Green Lantern oath right?

Correct! (In this particular case, they were facing a magically-locked
vault; by shining a green light on it - say, from a candle inside a
green bottle - they could see how to open it.)

> You'll also note that you're trimming off bits and leaving "residual
> seconds". I would put all the "_rem" values back into "seconds", which
> would let you use augmented assignment:
>
>
> Not sure what augmented assignments are but I’ll look that up.  I’m gonna
> try and figure it out that way also just for the heck of it.
>
>
> weeks = seconds/604800
> seconds %= 604800
>
>
> Is the ->  seconds %= 604800
> Saying ->  seconds = seconds % 604800?

Pretty much, yeah. If you think about it in English as "Divide seconds
by 604800", most people will think that "seconds" will end up smaller;
so that's represented by augmented assignment. There are also some
optimizations that can be done, and some differences as regards
mutable objects, but with simple arithmetic, it's what you say.

> [1] Our father's not a captain, but there's still nothing about being
> a non-captain with seven children. And that movie is definitely one of
> our favorite things.
>
>
> Seven children is a lot.  It definitely takes a Captain to raise seven
> children.  : )
>

Not sure if you're familiar with the book, musical, or film, "The
Sound of Music", about Captain von Trapp and Maria and their children.
Maria sings (in the film) "A captain with seven children - what's so
fearsome about that?", and somehow my fingers left out the key word
"fearsome" in the above reference, which doesn't make it very clear.
There's nothing *fearsome* about being a non-captain, etc. Also, now
that you know I'm talking about the Sound of Music, you'll know why I
described it as one of our favorite things. :)

ChrisA



More information about the Python-list mailing list