Re: access interactive namespace from module (shared namespace?)

2008-05-25 Thread TeroV
Ulrich Dorda wrote: I've got a probably embarrassing trivial problem with namespaces, but couldn't solve it myself nor find an answer in the net. Hopefully one of you guys can help me. What I want to do: Use the interactive shell and e.g define the variable a there. Then load a module and acce

Re: Simple - looking for a way to do an element exists check..

2008-02-23 Thread TeroV
Boris Ozegovic wrote: > Paul Rubin wrote: > >> if any(x[0]==element[0] for x in a): > > How come this list comprehension isn't in [] brackets? It isn't list comprehension, it is generator expression http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Generator_expressions -- Tero --

Re: Is it explicitly specified?

2008-02-03 Thread TeroV
Jorge Godoy wrote: > mario ruggier wrote: > >> Is there any way to tell between whether a keyword arg has been explicitly >> specified (to the same value as the default for it) or not... For example: >> >> def func(key=None): >> do something with key >> >> But the following two usages give sam

Re: constructor question

2008-01-21 Thread TeroV
azrael wrote: > lets supose i have a object > class a: __init__(self,b): self.b=b > object=a(2) > > > how can I bind the object with "print". I supose that this should be > possible with a constructor. but I don't know how. > print a > 2 > > Something like th

Re: python project ideas

2007-10-25 Thread TeroV
Neil Wallace wrote: > On Thu, 25 Oct 2007 04:09:00 +, [EMAIL PROTECTED] wrote: > >> hi to everyone >> I wondered if this might be the right place to ask for some ideas for >> python project for university. >> I'd like it to be something useful and web-based. And the project must >> be complete

Re: Bug with lists of pairs of lists and append()

2007-09-28 Thread TeroV
Gabriel Zachmann wrote: > Well, > > could some kind soul please explain to me why the following trivial code > is misbehaving? > > > #!/usr/bin/python > s = [] > l = [ 0 ] > r = [0, 0] > while r: > x = (l,r) > print x > s.append( x ) > l.append( r.pop(0) ) > print s > > > > T

Re: Line Wrapping

2007-06-18 Thread TeroV
Evan Klitzke wrote: > All, > > Mail messages should be wrapped at 78 characters (as suggested in RFC > 2822). I want my python batch scripts/cron jobs to enforce this > behavior, and format the mail that is sent out so that newline > characters are inserted as appropriate to keep line lengths at 7