Re: Favorite non-python language trick?

2005-07-01 Thread Shai
Joseph Garvin wrote: > > I'm curious -- what is everyone's favorite trick from a non-python > language? And -- why isn't it in Python? > 1. Lisp's "dynamically scoped" variables (Perl has them, and calls them "local", but as far as I've seen their use their is discouraged). These are global variab

Re: Favorite non-python language trick?

2005-07-06 Thread Shai
; This introduces the same problem you noted with my original proposal, but in reverse: Now, in bar(), you define and use a local variable, and suddenly some library function changes its behavior misteriously. > For my example above, bar would *always* print 10. Nothing that > foo.foogle did wo

Re: Favorite non-python language trick?

2005-07-07 Thread Shai
Mike Meyer wrote: > "Shai" <[EMAIL PROTECTED]> writes: > > > They're called "Special vars", and you need to define them (unlike > > local LISP variables, which behave essentially like Python vars), but > > then you use them just like other v

Re: Cleaning up after failing to contructing objects

2009-07-15 Thread Shai
Since nobody else mentioned this... Python classes have a magic method called __del__ which is usually called just before an object is garbage-collected. Further, Python uses reference-counting to tell when an object is no longer accessible. This means that if your resource classes define __del__

Re: Override a method but inherit the docstring

2009-07-23 Thread Shai
7; in parents"%self.name) func.__doc__ = source.__doc__ return func doc_inherit = DocInherit Combining docstrings (as suggested by Jean-Paul Calderone), and taking proper care of classmethods and staticmethods, are left as an exercise to the reader. Have fun, Shai. -- http://mail.python.org/mailman/listinfo/python-list

Re: Override a method but inherit the docstring

2009-07-27 Thread Shai
On Jul 27, 5:05 pm, Jean-Michel Pichavant wrote: > Ben Finney wrote: > > > > The docstring for ‘FooGonk.frobnicate’ is, intentionally, perfectly > > applicable to the ‘BarGonk.frobnicate’ method also. Yet in overriding > > the method, the original docstring is not associated with it. > > I've also

Re: Override a method but inherit the docstring

2009-07-28 Thread Shai
On Jul 26, 6:55 pm, a...@pythoncraft.com (Aahz) wrote: > > Nice!  Maybe stick this on the Cookbook? http://code.activestate.com/recipes/576862/ Thanks for the suggestion, Shai. -- http://mail.python.org/mailman/listinfo/python-list

python database

2010-09-02 Thread shai garcia
can you pls help me to make a database program in python? It is a Quiz system which is database driven. The program has a choices which add question, edit, delete, list, take a quiz, quiz results, and exit. in take a quiz choice,questions should be randomly displayed and the result and name of t

python database

2010-09-02 Thread shai garcia
can you pls help me to make a database program in python? It is a Quiz system which is database driven. The program has a choices which add question, edit, delete, list, take a quiz, quiz results, and exit. in take a quiz choice,questions should be randomly displayed and the result and name of t