Re: Dive Into Java?

2006-10-09 Thread Bjoern Schliessmann
erikcw wrote: > DiveIntoPython.org was the first book I read on python, and I > really > got a lot out of it. I need to start learning Java (to maintain a > project I've inherited), and was wondering if anyone knew of any > similar books for Java? Perhaps a bit of a rant, but learn Python and C+

Re: Dive Into Java?

2006-10-09 Thread Bjoern Schliessmann
Diez B. Roggisch wrote: > While I do not love java, this is one of the dumbest statements > for a while in this NG - even though it is not meant to be too > serious. Thanks for your concern. I didn't really state this from dumbness though. BTW, definitely consider looking up "irony" and "emotico

Re: Dive Into Java?

2006-10-09 Thread Bjoern Schliessmann
Diez B. Roggisch wrote: > What do you mean by "from dumbness"? It didn't originate from the "dumbness" area of my brain (== it wasn't my honest opinion). It was meant satirical. > And in context of somebody seeking enlightment regarding java, > it's especially unhelpful and confusing I think. Wh

Re: Dive Into Java?

2006-10-10 Thread Bjoern Schliessmann
Dan Bishop wrote: > On Oct 9, 11:40 am, Bjoern Schliessmann >> String eggs = new String(); >> >> The latter seems totally unnecessary to me, as well as being too >> verbose > It is! All you have to write is > > String eggs = ""; > > Unfor

Re: Dive Into Java?

2006-10-11 Thread Bjoern Schliessmann
Diez B. Roggisch wrote: > Yes. You can for example create a constructor for object Foo, > which then is implicitly chosen when assigning an int to a > variable of that kind. So it acts as a casting operator. I call > that wicked, and subtle. > > class Foo { > int _arg; > public: > Foo(int arg

Re: Newbie: trying to twist my head around twisted (and python)

2006-10-11 Thread Bjoern Schliessmann
Jan Bakuwel wrote: > Does anyone know how I need to complete the code below so it > returns this mysterious "Deferred result" and runs? Without having looked at your code at this late hour -- perhaps a short explanation of what a Deferred is will help. If a function wants to returns something th

Re: Dive Into Java?

2006-10-11 Thread Bjoern Schliessmann
Diez B. Roggisch wrote: > You don't seem to understand what is happening here. The fact that > string literals in java exist has nothing to do with an implicit > type casting as above example shows. Whoops. "10", arg and _arg /are/ integers, right? > C++ was new, nobody forced them to keep poin

Re: strings in the global section

2006-10-12 Thread Bjoern Schliessmann
Phoe6 wrote: > But it is not so. It always prints This is a String. astring > declared outside all the functions, is not in global section and > values be overwritten by functions accessing it? > > - How is this working? If you assign "astring" inside the function body, it's a local name. > -

Re: strings in the global section

2006-10-12 Thread Bjoern Schliessmann
Phoe6 wrote: > #!/usr/bin/python > global astring > astring = "This is a String" A global declaration just says "look for this name in the module namespace". Since you /are/ in the module namespace here, there's no need to put "global" here. > Works, but something different ? Excuse me, what d

Re: strings in the global section

2006-10-12 Thread Bjoern Schliessmann
Tim Chase wrote: > Sounded like the OP wanted a behavior similar to "auto-globals" > that has been a long-cursed aspect of PHP. That, without > specifying it, local-variables should be global if their name > exists in the global namespace. Sounds like a source of many hard to track down bugs.

Twisted Deferreds (was: Re: A friendlier, sugarier lambda -- a proposal for Ruby-like blocks in python)

2006-10-14 Thread Bjoern Schliessmann
Paul Rubin wrote: > But that's just ugly. The fetchPage function should take the > callback as an argument. In an asynchronous system it would even > be buggy. It won't, in my understanding/experience, since the local context must first terminate before the reactor takes control again and hand

Re: my first software

2006-10-26 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > #!C:\\Python25 Just from curiosity: Since when does the hash bang work in Windows? Regards, Björn -- BOFH excuse #417: Computer room being moved. Our systems are down for the weekend. -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing Hidden Character in Python

2006-10-26 Thread Bjoern Schliessmann
Wijaya Edward wrote: > How can we print out the hidden character like > "\n", "\r" etc in Python? Try repr(var)[1:-1] CMIIW. :) Regards, Björn -- BOFH excuse #271: The kernel license has expired -- http://mail.python.org/mailman/listinfo/python-list

Re: my first software

2006-10-27 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > cygwin? I thought so too, but cygwin would use #!/cygdrive/c/..., IIRC. > exemaker? some kind of web server? Okay, didn't know that :) Regards, Björn -- BOFH excuse #22: monitor resolution too high -- http://mail.python.org/mailman/listinfo/python-list

Re: Telnetlib to twisted

2006-10-27 Thread Bjoern Schliessmann
Matthew Warren wrote: > Could anyone show how the above would be written using the twisted > framework? All I'm after is a more 'intelligent' interactive > telnet session (handles 'vi' etc..) rather than the full > capabilities of the twisted framework. Not done this until now, but have a look at

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-29 Thread Bjoern Schliessmann
Snor wrote: > There is a lot of interaction between the clients and they would > often need to write to the same list of values, which of course > becomes a problem with a threaded server - so event driven solves > that problem, and I assumed it would solve all my problems. Which problem, and why

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-29 Thread Bjoern Schliessmann
Nick Vatamaniuc wrote: > If that is not an option, then you are faced with a problem of > connecting a threaded programming model with an event based model > (twisted and and such). I don't really see how threads could avoid a problem with delays in one connection ... Regards, Björn -- BOFH

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-31 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > by running the database queries in one or more separate threads, > you can still serve requests that don't hit the database (either > because they're entirely self-contained, or because they only rely > on cached data). Nothing that couldn't also be solved without threads.

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > what's wrong with using enumerate? or a list comprehension? or > some other of the many different ways you can use to build a list > from a set of values? Shouldn't there be one -- and preferably only one -- obvious way to do it? 8) Python Cookbook says "enumerate()", is

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > define "it". Sorry! I mean iterating over a list and having the list index available in the loop. Like: for i, thing in enumerate(things): pass Regards, Björn -- BOFH excuse #254: Interference from lunar radiation -- http://mail.python.org/mailman/listinfo/pyth

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > "enumerate" is the obviously right thing for this, sure. K. > but it's not necessarily the right thing for the OP's "I want to > create a new list based on an existing list". modifying the > existing list is usually not the most efficient way to do that. Agreed. Regards

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread Bjoern Schliessmann
Dan Lenski wrote: > for my next project. I too would avoid Qt, not because of the GPL > but simply because I don't use KDE under Linux and because Qt is > not well supported under Cygwin or on native Windows. Why not? BTW, big projects such as the Opera browser use Qt. Also in Windows. Regard

Re: Py3K idea: why not drop the colon?

2006-11-09 Thread Bjoern Schliessmann
Michael Hobbs wrote: > That is, assume that the expression ends at the colon, not at the > newline. That would make this type of statement possible: > if color == red or > color == blue or > color == green: > return 'primary' > Right now, such a statement would have to be s

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Bjoern Schliessmann
Neil Cerutti wrote: > On 2006-11-09, Bjoern Schliessmann >> if color == red or blue or green: >> return 'primary' >> >>:) > The Inform 6* programming language supports the serial 'or' (and > 'and') and looks just like that.

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Bjoern Schliessmann
Marc 'BlackJack' Rintsch wrote: > No it doesn't -- look again at the example given above. It's > legal syntax in Python but doesn't have the semantics implied by > the example. Sorry, I don't understand -- what is the difference between the example as it is and the implied semantics of it? Rega

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > >>> color = "blue" > >>> if color == "red" or "green" or "yellow": > ... print color, "is red or green or yellow" > ... > blue is red or green or yellow Whoops. Okay. Regards, Björn -- BOFH excuse #303: fractal radiation jamming the backbone -- http://mail.pyt

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Bjoern Schliessmann
Steven D'Aprano wrote: > And just for the avoidance of doubt, Python "x == blue or red or > yellow" is semantically equivalent to: > > (x == blue) or bool(red) or bool(yellow) Yep, got it. Shame on me, it's so obvious now :) Regards, Björn -- BOFH excuse #317: Internet exceeded Luser level

Re: Python v PHP: fair comparison?

2006-11-14 Thread Bjoern Schliessmann
walterbyrd wrote: > - PHP has a lower barrier to entry Which kind of barrier do you mean -- syntax, availability, ...? Also from what I know of PHP, language and API seem more unstable and inhomogenous. CMIIW. Regards, Björn -- BOFH excuse #219: Recursivity. Call back if it happens again.

Re: Why not event-driven packages in other than the main thread?

2006-09-14 Thread Bjoern Schliessmann
Tor Erik wrote: > But could anyone tell me why running these in a thread other than > the main one doesn't work? Just for personal interest: Why would you want to run the GUI in another thread? It's common to leave the GUI in the main thread and let worker threads handle heavy time-consuming stuf

Re: Why not event-driven packages in other than the main thread?

2006-09-14 Thread Bjoern Schliessmann
Lawrence Oluyede wrote: > It's better to use GUI with a real reactor available like GTK2 > anyway... What's not real about Tkinter's? Regards, Björn -- BOFH excuse #371: Incorrectly configured static routes on the corerouters. -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding Nested Loops

2006-09-15 Thread Bjoern Schliessmann
Rich Shepard wrote: > On Fri, 15 Sep 2006, Peter Otten wrote: >> It's not clear to me why you would use dictionaries, especially >> as they are unordered; I used lists instead: >Because the data comes via a serial port as sequences of two >bytes from an > OMR reader, and the byte pairs n

Re: wxTimer problem

2006-09-15 Thread Bjoern Schliessmann
abcd wrote: > ...and I am getting this error: > > "timer can only be started from the main thread" > > how can I fix this?? > > FYI, my script is being started by a new thread each time Fix: Start the script from the main thread only. Regards, Björn -- BOFH excuse #53: Little hamster in

Re: wxTimer problem

2006-09-16 Thread Bjoern Schliessmann
abcd wrote: > thanks for NO help. Know what? I knew you were going to answer like that. Regards, Björn -- BOFH excuse #415: Maintenance window broken -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace single character at given position

2006-09-19 Thread Bjoern Schliessmann
Martin Kulas wrote: > From programming languages like C I expect something like that: > idx = 1 s1 = "pxthon" s1[idx] = 'y' > Traceback (most recent call last): > File "", line 1, in ? > TypeError: object does not support item assignment > > It does not work :-( Yes, Python str

Re: Python 2.5 WinXP AMD64

2006-09-21 Thread Bjoern Schliessmann
Christophe wrote: > To be exact, you need a 64bit Windows OS on a 64bit cpu. Is there a reason that can be explained in a less-than-2-KB posting? :) I mean why Python depends on the processor type that much. Regards, Björn -- BOFH excuse #52: Smell from unhygienic janitorial staff wrecked t

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-22 Thread Bjoern Schliessmann
Saizan wrote: > Why subclassing bool from int either __invert__ or __neg__ haven't > been overrided to produce a boolean negation? I wonder what -True or -False should evaluate to. Regards, Björn -- BOFH excuse #297: Too many interrupts -- http://mail.python.org/mailman/listinfo/python-l

Re: Python 2.5 WinXP AMD64

2006-09-22 Thread Bjoern Schliessmann
Bryan Olson wrote: > The O.P. has a 64-bit Athlon processor, but is running a 32-bit > OS. The processor emulates its 32-bit predecessor in "legacy > mode", so 32-bit software runs. Ah, of course. Thanks for all replies! :) Regards, Björn -- BOFH excuse #13: we're waiting for [the phone co

Re: Does Python provide "Struct" data structure?

2006-09-22 Thread Bjoern Schliessmann
Daniel Mark wrote: > I have two following questions: > > 1> Does Python provide such Struct in this standard libary. > Python has "4.3 struct -- Interpret strings as packed binary > data", but it looks like different from what I really want to get. Yes, that module is used when you want to deal

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-22 Thread Bjoern Schliessmann
Saizan wrote: > Well in boolean notation -True == False and -False == True, > actually you may prefer ¬ or a line over the term, (I can't remember reading "-" (minus) for a standard boolean negation operator anywhere. Even C/C++ uses "!".) > but since there's no such operator in python I think

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-22 Thread Bjoern Schliessmann
Saizan wrote: > (However (not x) whould be as annoying as 1-x even if a little > more readable (if you consider lispish parentheses readable): > Input expression: (not (not x)&(not y)!(not (z|v))) Did you notice that you use bitwise AND and OR here? How about not (not x) and (not y) or (not (z o

Re: no-installation version of python

2006-09-22 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Is there a stand-alone version of python out there that I can > package with my scripts so that I don't have to bother with > something like py2exe? Isn't this the exact intention of py2exe? Regards, Björn -- BOFH excuse #247: Due to Federal Budget problems we hav

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-22 Thread Bjoern Schliessmann
Saizan wrote: > Thanks for pointing that out ( the "!" is a misstyped "|"), Ah, I suspected so. > my classes of discrete math have warped my mind with a mix of > various non-C-style operators notation, I never use bitwise > operation and this is just a bad day for thinking about things.. Hehe,

Re: Application logging to screen and file - any favorite modules (no luck on cheeseshop)

2006-09-23 Thread Bjoern Schliessmann
metaperl wrote: > Hello, I am looking for a module which has > * log levels > * output to stdout and file (either/or based on config) > * nicely formatted log output (e.g., indentation when appropriate) Sorry for being nosey, but how'd you use indentation in a log? Regards, Björn -- BOFH exc

Re: grabbing random words

2006-09-23 Thread Bjoern Schliessmann
Jay wrote: > How would I be able to grab random words from an internet source. > I'd like to grab a random word from a comprehensive internet > dictionary. What would be the best source and the best way to go > about this? The *best* source would be a function of the internet dictionary that sel

Re: no-installation version of python

2006-09-23 Thread Bjoern Schliessmann
Robert Kern wrote: > I think he wants a no-install (or, perhaps more accurately, > simply-unzip-to-install) version of the interpreter that doesn't > need to touch the Windows registry or copy DLLs to system > locations. py2exe builds such a thing (or nearly so) for the > application itself, if i

Re: Application logging to screen and file - any favorite modules (no luck on cheeseshop)

2006-09-23 Thread Bjoern Schliessmann
Gabriel Genellina wrote: [log w/indentation] > I do - what's wrong? Imagine the following on a single line... Ah, K. Got it :) Regards, Björn -- BOFH excuse #351: PEBKAC (Problem Exists Between Keyboard And Chair) -- http://mail.python.org/mailman/listinfo/python-list

Re: Need compile python code

2006-09-23 Thread Bjoern Schliessmann
mistral wrote: > Need compile python code, source is in html and starts with > parameters: Excuse me? > #!/bin/sh - > "exec" "python" "-O" "$0" "$@" Is the line break intended? > I have installed ActivePython for windows. What exactly do you want? Python code is always compiled (to byte cod

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-23 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > Which is why C++ allows "not", "and" and "or". Is this standards compliant? My reference (book) doesn't contain it, but g++ allows it. Regards, Björn -- BOFH excuse #441: Hash table has woodworm -- http://mail.python.org/mailman/listinfo/python-list

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-23 Thread Bjoern Schliessmann
MonkeeSage wrote: > "The C++ standard provides _operator keywords_ (Fig. 21.8) that > can be used in place of several C++ operators." (Deitel & Deitel, > 2001; 1082). Thanks. Only if I'd known that earlier ;) Regards, Björn -- BOFH excuse #39: terrorist activities -- http://mail.python.or

Re: Verify an e-mail-adress - syntax and dns

2006-09-24 Thread Bjoern Schliessmann
Ingo Linkweiler wrote: > b) verify an existing mailserver or DNS/MX records "Or"? That's two different things. If you don't know already: Even if you test all this, it is still possible that - the target mail account doesn't exist - the sender's IP is filtered by the server so he'll reject - th

Re: Verify an e-mail-adress - syntax and dns

2006-09-24 Thread Bjoern Schliessmann
Ingo Linkweiler wrote: > yes, I do this allready. But it would be nice to do some checks > before to avoid wrong user inputs. What do you do if the user inputs a "wrong" address? If you reject with an error message, the medium intelligent user will enter something like [EMAIL PROTECTED] as next

Re: Verify an e-mail-adress - syntax and dns

2006-09-24 Thread Bjoern Schliessmann
Ben Finney wrote: > I believe Ingo is checking for the case where the user intended to > enter a valid email address, and made a typing error resulting in > a trivially invalid one. Ah. Good intention, but the same applies: Typos in the localpart are not detectable. Typos in the domain part could

Re: Daemonizing python

2006-09-24 Thread Bjoern Schliessmann
Paul Rubin wrote: > NinjaZombie <[EMAIL PROTECTED]> writes: >> I was wondering if it is possible to turn the current python >> proccess into a unix daemon, but not doing it like this: >> python myscript.py & >> but from code programaticaly. > Yeah, os.fork and the parent process exits. Or littl

Re: tempfile.NamedTemporaryFile wont work

2006-11-19 Thread Bjoern Schliessmann
Imbaud Pierre wrote: > tf = tempfile.NamedTemporaryFile() > tfName = tf.name > [...] > print >> sys.stderr, '%s: %s' % (tfName, ['no', > 'yes'][os.path.exists(tfName)]) > subprocess.Popen(['strings', tfName]) Just out of curiosity: Why did you a

Re: syntax error in sum(). Please explicate.

2006-11-19 Thread Bjoern Schliessmann
Paul Rubin wrote: > Generator comprehensions Are generator comprehensions and generator expressions the same? Regards, Björn -- BOFH excuse #35: working as designed -- http://mail.python.org/mailman/listinfo/python-list

Re: decompiler

2006-11-19 Thread Bjoern Schliessmann
Fuzzyman wrote: > That's terrible. You read comp.lang.perl.misc *as well* ? > > ;-) You have to know your enemy ;) Regards, Björn -- BOFH excuse #343: The ATM board has run out of 10 pound notes. We are having a whip round to refill it, care to contribute ? -- http://mail.python.org/mai

Re: socket.error connection refused

2006-11-23 Thread Bjoern Schliessmann
Vania wrote: > IOError: [Errno socket error] (10061, 'Connection refused') What does "telnet www.google.com 80" in some cmd.exe window say? The same? Regards, Björn -- BOFH excuse #36: dynamic software linking table corrupted -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, main loop question.

2006-11-23 Thread Bjoern Schliessmann
Exod wrote: > Don't know if its possible in this light-weight GUI toolset, but > can i somehow hook up into the mainloop in it, for example if i > were to create an internet application, i would need to keep > recieving data from within it? That's something where you could try the Twisted framewo

Re: Access to variable from external imported module

2006-11-23 Thread Bjoern Schliessmann
GinTon wrote: > Sorry, I mean access to local variable from a method > > import module > method(value) That's no access to a local variable of a method. It's a simple function call. > I would to access to values that are created locally in that > method Something with your interface seems hor

Re: socket.error connection refused

2006-11-24 Thread Bjoern Schliessmann
Vania wrote: > For anyone interested restarting windows fixed the connection > problem. Some nifty "firewall" software? 8) Regards, Björn -- BOFH excuse #78: Yes, yes, its called a design limitation -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I access a main frunction from an import module?

2006-11-24 Thread Bjoern Schliessmann
Jim wrote: > I have created an import module. And would like to access a > function from the main script, e.g., May I ask why? This style violates "normal" module philosophy. Regards, Björn -- BOFH excuse #307: emissions from GSM-phones -- http://mail.python.org/mailman/listinfo/python-l

Re: NFS server

2006-11-24 Thread Bjoern Schliessmann
srj wrote: > i wish to develop an NFS server usin python from scratch( some > wise guy told me i'ts easy!). That wise guy must be very wise, or stupid 8) > can i get any kinda tutorial for this?? > > any suggestions on how 2 begin? - Read RFCs about NFS - Read the Python tutorial - If you want

Re: Calling a thread asynchronously with a callback

2006-11-27 Thread Bjoern Schliessmann
Edwin Gomez wrote: > I'm a C# developer and I'm new to Python. I would like to know if > the concept of Asynchronous call-backs exists in Python. Sure. Either with this: http://twistedmatrix.com/projects/core/documentation/howto/async.html Or manually using select(). > Basically what I mean i

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread Bjoern Schliessmann
yaru22 wrote: > I was looking at the python library and thought urllib or urllib2 > may be used to make this program work. > > But I don't know how to send my urls to the w3c validator and get > the result. Another great alternative is using the Twisted framework:

Re: I/O Multiplexing and non blocking socket

2006-12-01 Thread Bjoern Schliessmann
Salvatore Di Fazio wrote: > I'm looking for a tutorial to make a client with a i/o > multiplexing and non blocking socket. > > Anybody knows where is a tutorial? Perhaps a bit of an overkill, but try this: http://twistedmatrix.com/projects/core/documentation/howto/clients.html Regards, Björn

Re: Thread help

2006-12-01 Thread Bjoern Schliessmann
Grant Edwards wrote: > On 2006-12-01, Salvatore Di Fazio <[EMAIL PROTECTED]> >> I would make 3 threads for a client application. > You should use 4. I vote for just 1. Regards, Björn -- BOFH excuse #236: Fanout dropping voltage too much, try cutting some of those little traces -- http

Re: I/O Multiplexing and non blocking socket

2006-12-01 Thread Bjoern Schliessmann
Salvatore Di Fazio wrote: > Thank you guys, but I would like to use the standard libraries Then I suggest you read a good book about Unix programming, especially about the workings of read(), write() and select(). If you've understood this doing it with python's read/write/select will be easy. E

Re: python vs java & eclipse

2006-12-01 Thread Bjoern Schliessmann
Paul Boddie wrote: > Eclipse may be quite a technical achievement, but I found it > irritating. Aside from the misuse of screen real-estate, I found > that typing two characters and having what seemed like half my > source file underlined in red, with multiple messages telling me > that I had yet

Re: Thread help

2006-12-02 Thread Bjoern Schliessmann
John Henry wrote: > Why stop there? Stop where, after one thread? Different question: Why use many threads? It adds complexity and overhead and forces you to think about thread safety and reentrance. Regards, Björn -- BOFH excuse #134: because of network lag due to too many people playing d

Re: global name 'self' is not defined

2006-12-02 Thread Bjoern Schliessmann
Evan wrote: > So I have deleted the 'old' script2 and renamed the new one, and > no problem. Pity. Next time try using diff (or something similar). Regards, Björn -- BOFH excuse #115: your keyboard's space bar is generating spurious keycodes. -- http://mail.python.org/mailman/listinfo/pyt

Re: twisted problem with reactor.stop()

2006-12-03 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I use twisted 1.3 in my python application. Isn't 1.3 heavily outdated? The most recent is 2.4. > in my program, I have one server and on client running at same > time (so 2 reactor.run(installSignalHandlers=0) ) the client run > in one thread and the server in an othe

Re: python Noob - basic setup question / problem

2006-12-04 Thread Bjoern Schliessmann
Lilavivat wrote: > /usr/bin/python2: bad interpreter: No such file or directory > > "which python" gives me "/usr/local/bin/python" > > "which python2.4" gives me "/usr/local/bin/python2.4" > > But /usr/bin/python is symlinked to python2.4 "python -> > python2.4" Try to understand what "which"

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Bjoern Schliessmann
Paul Melis wrote: > I've always been using the has_key() method to test if a > dictionary contains a certain key. Recently I tried the same using > 'in', e.g. > > d = { ... } > if k in d: > ... Wouldn't be "if k in d.keys()" be the exact replacement? Regards, Björn -- BOFH excuse #17:

Re: len() and PEP 3000

2006-12-06 Thread Bjoern Schliessmann
Thomas Guettler wrote: > I suggest that at least lists, tupples, sets, dictionaries and > strings get a len() method. Why? > I think the len function can stay, removing it would break to much > code. But adding the method, would bu usefull. > > Yes, I know, that I can call .__len__() but that

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Bjoern Schliessmann
Peter Otten wrote: > No, 'k in d' is equivalent to 'd.has_key(k)', only with less > (constant) overhead for the function call. Ah, thx. Thought the "x in d" syntax might search in d.values() too. Regards, Björn -- BOFH excuse #12: dry joints on cable plug -- http://mail.python.org/mailma

Re: len() and PEP 3000

2006-12-06 Thread Bjoern Schliessmann
Kay Schluehr wrote: > Pro: Because it makes the API more monotonous and more aligned > with all other OO languages that exist now and in future. It also > helps any written and unwritten IDE providing a method by means of > autocompletion. It ends endless debates with Java/C++/C# etc. and > newbie

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Bjoern Schliessmann
Paul Melis wrote: > I don't think it does Thanks for trying, I was too lazy ;) Regards, Björn -- BOFH excuse #52: Smell from unhygienic janitorial staff wrecked the tape heads -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-08 Thread Bjoern Schliessmann
Alex Mizrahi wrote: > hell no, lisp's syntax is much easier than python's since it's > homogenous Can you give an example? I cannot imagine how homogenity always results in easiness. > (and certainly lisp was invented much 30 years before > Python, so that's Python uses Lisp features) I think

Re: merits of Lisp vs Python

2006-12-08 Thread Bjoern Schliessmann
Bill Atkins wrote: > Um, so does that mean that Python couldn't have borrowed other > features? No, but he used this point in direct conjunction with the syntax. At least by my understanding. Regards, Björn Xpost cll,clp -- BOFH excuse #61: not approved by the FCC -- http://mail.python.o

Re: merits of Lisp vs Python

2006-12-08 Thread Bjoern Schliessmann
Petter Gustad wrote: > Bjoern Schliessmann <[EMAIL PROTECTED]> >> Can you give an example? I cannot imagine how homogenity always >> results in easiness. > CL-USER> (+ 1 2 3 4 5 6 7 8 9 10) > 55 > > CL-USER> (< 1 2 3 4 5 6 7 8 9 10) > T > C

Re: merits of Lisp vs Python

2006-12-08 Thread Bjoern Schliessmann
Alex Mizrahi wrote: > (message (Hello 'Bjoern) >> BS> Can you give an example? I cannot imagine how homogenity >> always BS> results in easiness. > homogenity means that i can cut any expression and paste in any > other expression, and as long as lexical variables are ok, i'll > get correct re

Re: merits of Lisp vs Python

2006-12-09 Thread Bjoern Schliessmann
samantha wrote: > What are you? A pointy haired boss? What are you? A 12 year old that has just learned to use Google Groups? 8) Regards, Björn Xpost cll,clp Fup2 poster -- BOFH excuse #211: Lightning strikes. -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-09 Thread Bjoern Schliessmann
Ken Tilton wrote: > Note also that after any amount of dicing I simply hit a magic key > combo and the editor reindents everything. In a sense, Lisp is the > language that handles indentation best. Erm ... because there's an editor for it that indents automatically? Or did I miss the point? Rega

Re: Error: unbound method in Tkinter class

2006-12-09 Thread Bjoern Schliessmann
Kevin Walzer wrote: > I am trying to structure a Tkinter application with classes > instead of just with simple functions, but I'm not sure how to > call methods from my main class. > > My main class is packetstreamApp(). I don't think so -- packetstreamApp() would be an (unbound) instance. pack

Re: merits of Lisp vs Python

2006-12-09 Thread Bjoern Schliessmann
Timofei Shatrov wrote: > Says a person with a 13-line sig. Who? Mine was exactly three lines long. Hint: What's "-- "? Shrugging Regards, Björn Fup2p -- BOFH excuse #88: Boss' kid fucked up the machine -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython: Icon aus base64 decoded Image

2006-12-11 Thread Bjoern Schliessmann
Roland Rickborn wrote: > Wo ist der Fehler und was muss ich machen, damit das Icon > angezeigt wird? I'm sorry that I can't help you, but you'll probably get more answers if you write again in English (this is comp.lang.python). Grüße, Björn -- BOFH excuse #126: it has Intel Inside -- htt

Re: merits of Lisp vs Python

2006-12-12 Thread Bjoern Schliessmann
Robert Uhl wrote: > Because it's the language for which indentation is automatically > determinable. That is, one can copy/paste a chunk of code, hit a > key and suddenly everything is nicely indented. Cool, so in other languages I need to set block marks like () and {} and also indent the code

Re: How to manage two (different) sockets without using threads?

2006-12-13 Thread Bjoern Schliessmann
billie wrote: > I'm (re)writing an FTP server application by using > asyncore/asynchat modules. > FTP tipically got two different channels: command and data. > I'm succesfully managing command channel through asynchat > framework, but I'm not sure about how to manage data channel > without using a

Re: merits of Lisp vs Python

2006-12-14 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > What it isn't is some kind of miraculous invention that saves > programmers from ever making mistakes that are common in other > languages, or that reduces effort in copy-paste, as Bjoern seemed > to be claiming. I didn't. I just stated that the Python way is less work

Re: removing the header from a gzip'd string

2006-12-21 Thread Bjoern Schliessmann
Rajarshi wrote: > Does anybody know how I can remove the header portion of the > compressed bytes, such that I only have the compressed data > remaining? (Obviously I do not intend to perform the > decompression!) Just curious: What's your goal? :) A home made hash function? Regards, Björn --

Re: removing the header from a gzip'd string

2006-12-23 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Actually I was implementing the use of the normalized compression > distance to evaluate molecular similarity as described in an > article in J.Chem.Inf.Model (http://dx.doi.org/10.1021/ci600384z, > subscriber access only, unfortunately). Interesting. Thanks for the rep

Re: Are all classes new-style classes in 2.4+?

2006-12-31 Thread Bjoern Schliessmann
Isaac Rodriguez wrote: > This is probably a very basic question, but I've been playing with > new style classes, and I cannot see any difference in behavior > when a declare a class as: > > class NewStyleClass(object): > > or > > class NewStyleClass: Try multiple inheritance (the order of supe

Re: list/dictionary as case statement ?

2007-01-03 Thread Bjoern Schliessmann
Tom Plunket wrote: > Often (always?) RISC architectures' instruction+operand lengths > are fixed to the word size of the machine. E.g. the MIPS 3000 and > 4000 were 32 bits for every instruction, and PC was always a ^^ > multiple of four. Intels are

Re: list/dictionary as case statement ?

2007-01-03 Thread Bjoern Schliessmann
MRAB wrote: > I think that "PC" referred to the CPU's Program Counter. Argh, thanks. :) > The x86 CPUs if typical Windows PCs aren't RISC but Intel also > manufacture X-Scale (ARM core) processors which are. Okay, sorry for lack of precision. I was referring to x86. Regards, Björn -- BOF

Re: array of class / code optimization

2007-01-03 Thread Bjoern Schliessmann
mm wrote: > But I was looking for a "struct" equivalent like in c/c++. > And/or "union". I can't find it. class Honk(object): pass test = Honk() test.spam = 4 test.eggs = "Yum" Is it this what you're looking for? > Maybe you know a source (URL) "Python for c/c++ programmers" or > things li

Re: Best way to implement a timed queue?

2007-01-04 Thread Bjoern Schliessmann
Thomas Ploch wrote: > I am having troubles with implementing a timed queue. I am using > the 'Queue' module to manage several queues. But I want a timed > access, i.e. only 2 fetches per second max. I am horribly stuck on > even how I actually could write it. Has somebody done that before? > And w

Re: help: code formatter?

2007-01-08 Thread Bjoern Schliessmann
siggi wrote: > as a newbie I have problems with formatting code of downloaded > programs, because IDLE's reformatting capabilities are limited . > Incorrect indentation, mixing of TAB with BLANKs or eol are often > very nasty to correct. > Is there a simple code formatter that first removes all >

Re: Bizarre floating-point output

2007-01-08 Thread Bjoern Schliessmann
Nick Maclaren wrote: > Ah! That explains it. I would call that reason intermediate > between rational and an artifact of the way the code has evolved! Which code has evolved? Those precision problems are inherent problems of the way floats are stored in memory. Regards, Björn -- BOFH excus

Re: multi-threaded webcam with SimpleAsyncHTTPServer.py

2007-01-08 Thread Bjoern Schliessmann
Ray Schumacher wrote: > I'll be trying implementing some streaming next. > Question, though: how can I unblock asyncore.loop(), Not at all. That's the way event loops work. > or at least be able to interrupt it? Sorry for the stupid question, but why would you want to do that? > Other suggesti

Re: Books,resources..

2007-01-08 Thread Bjoern Schliessmann
Tarique wrote: > so can you please suggest some standard references for python > considering that i have some programming experience I like "Learning Python" by Mark Lutz and David Ascher. They refer to C/C++ many times. Also try "Dive into Python" for a more fast-paced introduction and "Python

  1   2   3   4   5   6   >