Re: The Industry choice

2004-12-31 Thread Hans Nowak
nit tests for a dynamic language, you don't check for these things at all. How often do you explicitly check types in Python unit tests? IMHO, when using a dynamic language, you don't need most of the checks that Java, C# and their ilk force upon you. -- Hans Nowak http://

Re: The Industry choice

2004-12-31 Thread Hans Nowak
Christopher Koppler wrote: > -- > Christopher > > In theory, I'm in love with Lisp, > but I hop into bed with Python every chance I get. That reminds me of something my old math teacher used to say... "My wife is my cathedral, but I pray in every chapel.

Re: what is lambda used for in real code?

2004-12-31 Thread Hans Nowak
expression, just like other types can be part of an expression. However, by that same reasoning, maybe classes aren't special enough either to warrant a special case. Where's the keyword to create an anonymous class? :-) -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.o

Re: The Industry choice

2005-01-01 Thread Hans Nowak
Donn Cave wrote: Quoth Hans Nowak <[EMAIL PROTECTED]>: | Paul Rubin wrote: | |> You should write unit tests either way, but in Python you're relying |> on the tests to find stuff that the compiler finds for you with Java. | | As I wrote on my weblog a while ago, I suspect th

Re: UserDict deprecated

2005-01-01 Thread Hans Nowak
Uwe Mayer wrote: Why is the UserDict module is deprecated after Python 2.2. The application of it I have in mind is, i.e. multiple inheritance from "file" and "dic" - which is not possible. I am curious, what would you do with a class that derives from both file and dict?

Re: UserDict deprecated

2005-01-01 Thread Hans Nowak
#x27;t do what you want, so you have to override them anyway. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python evolution: Unease

2005-01-04 Thread Hans Nowak
pment will continue in the same vein. (He may just be putting his thoughts on paper, but it's the BDFL, so what is one supposed to think?) I for one will NOT welcome our new static typing overlords. ;-) -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Funny Python error messages

2005-01-21 Thread Hans Nowak
" + x[18:] >>> cPickle.loads(y) Traceback (most recent call last): File "", line 1, in ? ValueError: insecure string pickle -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write a tutorial

2005-01-23 Thread Hans Nowak
nks for the tip, man! -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Hans Nowak
To add m as a new method to the *instance*, use new.instancemethod, as Diez B. Roggisch already pointed out. HTH, -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Hans Nowak
Bill Mill wrote: On Fri, 28 Jan 2005 11:09:16 -0500, Hans Nowak <[EMAIL PROTECTED]> wrote: > To add m as a new method to the *class*, do this: >>> class test: ... def __init__(self, method): ... self.__class__.method = method ... self.method() ... >>&

Re: Where are list methods documented?

2005-02-01 Thread Hans Nowak
eason, "pydoc list.sort" doesn't work on my machine (Python 2.3.4, Windows XP). -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: changing __call__ on demand

2005-02-14 Thread Hans Nowak
;>> t() Called with: () {} >>> t(3, 4) Called with: (3, 4) {} >>> t(42, x=0) Called with: (42,) {'x': 0} -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How Do I get Know What Attributes/Functions In A Class?

2005-02-19 Thread Hans Nowak
lp', 'login', 'mail', 'noop', 'putcmd', 'quit', 'rcpt', 'rset', 'send', 'sendmail', 'set_debuglevel', 'starttls', 'verify', 'vrfy'] To get more detailed information than just a list of names, see the inspect module. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: BASIC vs Python

2004-12-17 Thread Hans Nowak
plex form with grids, explorer like trees etc. in 2 minutes in standard python. To be fair, this is more a property of a GUI builder than of a language... -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to pass globals across modules (wxPython)

2004-12-20 Thread Hans Nowak
ication" object from other modules, actually the windows and frames that live therein and I don't know how to do this. If you just need to access the running application from other wxPython objects, then wx.GetApp() is your friend. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.py

Re: Boo who? (was Re: newbie question)

2004-12-20 Thread Hans Nowak
s syntax may look like C or C++ in some areas, but the languages are nowhere near alike.) Pointing out the difference is not trolling. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Hans Nowak
Doug Holton wrote: Steve Holden wrote: 'Scuse me? This group has a long history of off-topic posting, and anyway who decided that CPython should be the exclusive focus? Even on-topic we can talk about Jython and PyPy as well as CPython. I agree with your point, although Hans Nowak and other

Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Hans Nowak
Doug Holton wrote: Hans Nowak wrote: Now you're trying to make it seem like I am against free speech on this list, and against people's rights to discuss whatever they want. I never said that, and I in fact enjoy the fact that c.l.py posters are an eclectic bunch who have knowled

Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Hans Nowak
Doug Holton wrote: Hans Nowak wrote: You said that boo should not be mentioned on this newsgroup. Please point me to the post where I said that. Since everything is stored in Google Groups, it should be easy for you to come up with an URL... if such a post existed. Quote: "th

Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Hans Nowak
Doug Holton wrote: Hans Nowak wrote: Quote: "this is comp.lang.python, not comp.lang.boo." Which is obviously not the same as "Boo should not be mentioned on this newsgroup". I used the exact same phrase in another note except using the term "logo" instead o

Re: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-28 Thread Hans Nowak
ally necessary, unless code is ambiguous. >>> x = 1, 2, 3 >>> x (1, 2, 3) >>> y = 5, >>> y (5,) but: >>> print 8, 9 # not a tuple 8 9 >>> print (8, 9) (8, 9) HTH, -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: copying classes?

2004-12-30 Thread Hans Nowak
oo) >>> FooCopy >>> Foo It appears it doesn't copy the class at all, you just get the same class back. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: program with raw_input prompt behaves differently after compile

2005-12-24 Thread Hans Nowak
-a-exe-text-color-187633.html The solution described here was to compile the program as a console app, rather than a Windows app. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Hans Nowak
Robert Kern wrote: > PyPy will not bring about the Singularity. But if it did, imagine how cool that would look on the developers resumes... :-) -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple question on Parameters...

2005-12-28 Thread Hans Nowak
eColor=(1.0, 1.0, 1.0, 1.0), fillColor=(0.0, 0.0, 0.0, 0.25)): r, g, b, a = outlineColor fr, fg, fb, fa = fillColor ...do something with these values... -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: questions about py2exe and wax

2005-12-30 Thread Hans Nowak
future releases of Wax...) Feel free to contact me by private mail if you need more help. Cheers, -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-31 Thread Hans Nowak
to me that the end of the expression ... for u in(3,14,10)) can be written as: ... for u in 3,14,10) which would shave off a character. Tuples don't always need parentheses... -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-31 Thread Hans Nowak
André wrote: > Hans Nowak wrote: > >>André wrote: > > >>I don't know if this suggestion has been made already, but it seems to >>me that the end of the expression >> >> ... for u in(3,14,10)) >> >>can be written as: >> &

Re: Python or Java or maybe PHP?

2006-01-02 Thread Hans Nowak
generator. (Or is this behavior different in Python 2.5? I hope not...) -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-03 Thread Hans Nowak
ject_id => 2469 irb(main):036:0> x.object_id => 2469 irb(main):041:0> y = 1000 => 1000 irb(main):042:0> y.object_id => 2001 irb(main):043:0> y += 234 => 1234 irb(main):044:0> y.object_id => 2469 I am not an expert on Ruby internals, but it looks like these integers are cached. As with Python, I don't know if one can count on this behavior to happen always. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-09 Thread Hans Nowak
derstand why some people > have problems entering that same environment and privileged conditions > as yourself. This attitude is very common and needs only some kind > Blair-alike kind of selfhypnosis in order to effectively not being aware > of lying. Tony Blair, or the Blair Witch

Re: Spelling mistakes!

2006-01-11 Thread Hans Nowak
t attribute is of any importance. Otherwise there's a loophole in your tests. :-) -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Arithmetic sequences in Python

2006-01-19 Thread Hans Nowak
ve liked to say that lists are a fundamental data type, much more so than a set... but in reality that seems to be a matter of taste and priorities. Pascal, for example, has a set literal, but no list literal; in fact, it doesn't even have a built-in list type. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Wax: problem subclassing TextBox

2006-10-18 Thread Hans Nowak
98 > on char 98 > on char 99 > on char 99 > on char 100 > on char 100 Heh, that's a bug. As a temporary solution, go to textbox.py and comment out the line in the __events__ dict that says 'Char': wx.EVT_CHAR. I will need to fix the way Wax handles events like these; this will probably be solved in the next release. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: at what complexity, a comparison fails ?

2007-12-31 Thread Hans Nowak
Stef Mientki wrote: > hello, > > I had a program that worked perfectly well. > In this program modules were dynamically added, > just by putting the file in a predefined directory. > > Now one of the interface mechanisms was to see if some parameter was > changed in a an instance, > by comparing

Re: save dictionary for later use?

2008-05-16 Thread Hans Nowak
globalrev wrote: pickle.dumps(mg) pickle.load(mg) 'dict' object has no attribute 'readline' dumps load(well i dont know but i get no complaint but running load generates that error) The 'loads' and 'dumps' methods use strings: >>> import pickle >>> d = {"this": 42, "that": 101, "other": 17}

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Hans Nowak
Dan Upton wrote: for pid in procs_dict: if procs_dict[pid].poll() != None # do the counter updates del procs_dict[pid] The problem: RuntimeError: dictionary changed size during iteration I don't know if the setup with the pids in a dictionary is the best way to manage a pool of proc

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Hans Nowak
[EMAIL PROTECTED] wrote: On 16 mai, 23:34, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: On 16 mai, 23:28, Hans Nowak <[EMAIL PROTECTED]> wrote: Dan Upton wrote: for pid in procs_dict: (snip) for pid in procs_dict.keys(): I'm afraid this will do the same e

Re: SImple python print question

2008-05-16 Thread Hans Nowak
[EMAIL PROTECTED] wrote: Hey there, I have a simple question about python print statement. Take the following code snippet for example... 1 print "-#- executing: %s" % section, 2 tests[section] = test.testcase(name=config.get(section,'name')) 3 tests[section].runTest() 4 printStatus(tests[secti

Re: Classmethods are evil

2008-05-17 Thread Hans Nowak
Ivan Illarionov wrote: After re-reading "Python is not Java" I finally came to conclusion that classmethods in Python are a very Bad Thing. I can't see any use-case of them that couldn't be re-written more clearly with methods of metaclass or plain functions. I agree with your sentiments, al

Re: 2 different versions of python compiling files.

2008-05-22 Thread Hans Nowak
this: >>> import foo Traceback (most recent call last): File "", line 1, in ? ImportError: Bad magic number in foo.pyc I'm not sure what would happen if multiple Pythons try to write a .pyc file at the same time, though... -- Hans Nowak (zephyrfalcon at gmail dot org) ht

Re: Code execution in imported modules

2008-05-29 Thread Hans Nowak
;d like to compile it once. It is compiled when you import the module. -- Hans Nowak (zephyrfalcon at gmail dot com) http://4.flowsnake.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: accumulator generators

2008-05-30 Thread Hans Nowak
e the second example tries to do) would not be OK. Also see: http://zephyrfalcon.org/labs/python_pitfalls.html (pitfall #6). -- Hans Nowak (zephyrfalcon at gmail dot com) http://4.flowsnake.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does python not have a mechanism for data hiding?

2008-06-04 Thread Hans Nowak
odule, etc. So in this case, not telling them that the attributes exist, will not stop them from finding out. -- Hans Nowak (zephyrfalcon at gmail dot com) http://4.flowsnake.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Harry Potter?

2008-06-05 Thread Hans Nowak
. If you scan the alt.fan.harry-potter archives carefully, you will find at least one well-known Python core developer. :-) -- Hans Nowak (zephyrfalcon at gmail dot com) http://4.flowsnake.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question, list comprehension

2008-06-06 Thread Hans Nowak
, you can just use a slice, as localtime is a tuple: fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % localtime[:6] Hope this helps! ^_^ -- Hans Nowak (zephyrfalcon at gmail dot com) http://4.flowsnake.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamically naming objects.

2008-06-06 Thread Hans Nowak
w many of them I want to spawn. Any ideas? Sure. This will give you a list of n instances of user: [user() for i in range(n)] Of course, you could also use a good old for loop: for i in range(n): u = user() ...do something with u... Hope this helps! -- Hans Nowak (zephyrfal

Re: Dynamically naming objects.

2008-06-07 Thread Hans Nowak
Kalibr wrote: On Jun 7, 1:20 pm, Hans Nowak <[EMAIL PROTECTED]> wrote: Kalibr wrote: I've been developing a small script to fiddle with classes, and came accross the following problem. Assuming I get some user input asking for a number, how would I spawn 'n' objects from a

Re: Simple and safe evaluator

2008-06-12 Thread Hans Nowak
ses__()") Traceback (most recent call last): File "", line 1, in File "safe_eval.py", line 12, in safe_eval return eval(s) File "", line 1 (2)...() ^ SyntaxError: invalid syntax ...It's primitive, but it might work for your purposes. -- Hans Nowak (zephyrfalcon at gmail dot com) http://4.flowsnake.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I create user-defined warnings?

2008-06-17 Thread Hans Nowak
[2]: class MyWarning(Warning): pass ...: In [3]: warnings.warn(MyWarning("bah humbug")) /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/IPython/FakeModule.py:1: MyWarning: bah humbug # -*- coding: utf-8 -*- -- Hans Nowak (zephyrfalcon at g

Re: Do I need "self" and "other"?

2008-06-27 Thread Hans Nowak
You can use whichever (valid) names you want, but in general 'self' and 'other' are used for clarity. In this case, they indicate the vector that is operated on ("self") and another vector ("other"). Using 'x' and 'y' would be less clear

Re: Fractions as result from divisions

2009-07-08 Thread Hans Nowak
n-intuitive and hard to debug for beginners." -- Hans Nowak (zephyrfalcon at gmail dot com) http://4.flowsnake.org/ -- http://mail.python.org/mailman/listinfo/python-list