Re: change vars in place w/loop or list comprehension



> >>> a = 'one'
> >>> b = 'two'
> >>> c = 'three'
> >>> [a, b, c] = [s.upper() for s in [a, b, c]]
> >>> a
> 'ONE'
>
> Both of these accomplish what I'm after; I prefer the second for its
> brevity. But either approach requires that I spell out my list of
> vars-to-alter [a, b, c] twice. This strikes me as awkward, and
> would be difficult
> with longer lists.

seq = a, b, c
a, b, c = seq = [s.upper() for s in seq]

.



Relevant Pages

  • Re: "Fixing" Clerics
    ... I still feel that the standard Cleric has too broad a spell list. ... In Complete Psionics, you have the concept of "mantles", which are collections ... You might consider requiring your clerics to draw all of their spells from the ... lists of their deity's domains - to compensate for the reduction in power, ...
    (rec.games.frp.dnd)
  • Re: {kjd-imc} Sorcerer differentiation (was: {Lorenz} Site/Rules Critique)
    ... Draconic and Dana's Faerie bloodline, ... Spell Focus, Spell Penetration. ... Improved Familiar would *probably* be on most family lists ... That's a possibility - I was too lazy to build a list for each dragon ...
    (rec.games.frp.dnd)
  • Re: Skill Challenge by Mike Mearls
    ... piles of power lists. ... because the differences lie in the powers ... And the very CONSTRUCTION of the character should tell me what kind of a character I'm dealing with. ... In game mechanical terms, swinging a sword will not be anything like casting a spell, unless the spell itself is designed to mimic the swinging of a sword or at least the use of some other physical weapon. ...
    (rec.games.frp.dnd)
  • Re: GM knowing casters spells
    ... For example, the GM may set up certain puzzles for the players to figure out, knowing that they have the means available to solve them. ... On the other hand, the GM may want to keep the spell lists a secret, so that the story can evolve in a way they could not foresee. ... So relax, it's a game you're all playing for fun, just grow up a bit and start treating each other with respect. ...
    (rec.games.frp.dnd)
  • Re: A note about spell points
    ... didn't know how the fireball spell works ... and (I forget the name -- the spontaneous clericky class). ... (they have small spell lists and crap casting compared to fullcasters ...
    (rec.games.frp.dnd)