Re: wxPython before MainLoop

2007-08-09 Thread Bjoern Schliessmann
[david] wrote: > I'd like to refresh the display before I start the main loop. > [...] > I'd like to just make app.Show() finish correctly before running > long_slow_init. IMHO, this will bring no gain. If you see an inresponsive user interface or not is quite meaningless. > Or is there a better

Re: Querying Graphics Card Name

2007-08-09 Thread Bjoern Schliessmann
Benjamin Goldenberg wrote: > I would like to find out the name of the graphics card of the > machine my program is running on. I have looked into the pyopengl > module, and using them to query the card, but it seems like there > ought to be a simpler way to find this out without setting up a > glco

Re: wxPython before MainLoop

2007-08-10 Thread Bjoern Schliessmann
[david] wrote: > I'm disappointed that I didn't get a wxPython solution. > > If the only way to get wxPython to correctly handle > this simple task is to code around it, LOL -- did you try coding this app with native windows means, like MFC? You will have *exactly* the same problem, and *exactl

Re: The Future of Python Threading

2007-08-10 Thread Bjoern Schliessmann
Justin T. wrote: > The detrimental effects of the GIL have been discussed several > times and nobody has ever done anything about it. Also it has been discussed that dropping the GIL concept requires very fine locking mechanisms inside the interpreter to keep data serialised. The overhead managi

Re: The Future of Python Threading

2007-08-10 Thread Bjoern Schliessmann
Nick Craig-Wood wrote: [GIL] > That is certainly true. However the point being is that running > on 2 CPUs at once at 95% efficiency is much better than running on > only 1 at 99%... How do you define this percent efficiency? >>> The truth is that the future (and present reality) of almost >>>

Re: wxPython - drawing without paint event

2007-08-11 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > On a related topic, it seems like it would be nice to do *all* > drawing in > response to paint events. When I get an event from the timer, I > would just tell wx that part of the window needs redrawing, and > depend on it to give me a paint even when nothing of higher

Re: Who told str() to round my int()'s!!!

2007-08-11 Thread Bjoern Schliessmann
Adam W. wrote: > Why in the world does str() have any business rounding my numbers, You are at the floating point numbers precision limit. Using str, numbers are rounded to your machine's float precision in decimal notation. Since floats are internally represented in binary notation of constant p

Re: Public Telnet Server?

2007-08-11 Thread Bjoern Schliessmann
Dave wrote: > Hi there. I'm a beginner at Python and I'm writing my first Python > script. It's a text adventure about coffee and mixing drinks and > being crazy and such. I keep updating it and want my friends to > beta test it for me, but some of them don't have the right version > of Python or

Re: python 2.5 bug

2007-08-11 Thread Bjoern Schliessmann
Thorsten Kampe wrote: > Yeah. Did the Original Poster mention any details about his > problem. Like - for instance - that he's using Windows? Don't you know the empiric law of platforms? :) "Users who ask about OS specific problems and not state their platform are Windows users." Regards, Björ

Re: The Future of Python Threading

2007-08-11 Thread Bjoern Schliessmann
Nick Craig-Wood wrote: > Bjoern Schliessmann <[EMAIL PROTECTED]> >> So, how much performance gain would you get? Again, managing >> fine-grained locking can be much more work than one simple lock. > > Assuming that you are not IO bound, but compute bound and that

Re: wxPython - drawing without paint event

2007-08-12 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Okay, but how do I tell wx that it needs to send me a paint event? It will send it on its own. You just need to bind your OnPaint (or similar) method to it like 7stud demonstrates. I really recommend reading "wxPython in Action", or at least the tutorial. Regards,

Re: wxPython - drawing without paint event

2007-08-12 Thread Bjoern Schliessmann
7stud wrote: > I don't. "wxPython in Action" is by far the worst computer book > I've ever purchased. It's poorly organized, poorly written, and > full of mistakes--and it's expensive. The fact that the authors > foist that piece of junk on unsuspecting newbies is a crime. Your opinion (I've se

Re: wxPython - drawing without paint event

2007-08-12 Thread Bjoern Schliessmann
7stud wrote: > On Aug 12, 2:20 pm, Bjoern Schliessmann > But any suggestions what's >> better for a beginner? The (incomplete) tutorial surely not. > Another GUI toolkit. So it seems your dislike is not for the book, but for the toolkit. Regards, Björn -- BOFH e

Re: python + XUL

2007-08-13 Thread Bjoern Schliessmann
Madhu Alagu wrote: > Has anyone had any success in getting XUL to work with python? Yes. http://www.google.de/search?q=xul+python http://en.wikipedia.org/wiki/Search_engine Björn -- BOFH excuse #74: You're out of memory -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators - more than just syntactic sugar

2007-08-13 Thread Bjoern Schliessmann
BJörn Lindqvist wrote: > unpedagogically not separated from ordinary functions. Decorators _are_ ordinary functions. Remember the "syntactic sugar" in this thread? Regards, Björn -- BOFH excuse #338: old inkjet cartridges emanate barium-based fumes -- http://mail.python.org/mailman/listin

Re: wxPython - drawing without paint event

2007-08-13 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > While the book does have issues, it is better (in my opinion) than > the only published Tkinter book, although both books are now > outdated. Outdated to a certain limit. It's quite a bit more recent than those many tutorials around still today using "from wxpython.w

Re: chmod g+ Equivalent

2007-08-13 Thread Bjoern Schliessmann
milan_sanremo wrote: > I've read the documentation on os.chmod() and can implement all > the standard commands, but what is the syntax for the equivalent > of chmod g + to set the group id? Group ID is set using os.chown. Regards, Björn -- BOFH excuse #190: Proprietary Information. -- htt

Re: wxPython - drawing without paint event

2007-08-13 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I guess I haven't looked up any wxPython tutorials. I typically > use a combination of the wxPython wiki, the demo and the WIA book > for my work. Me too (except the mailing list, occasionally), and it works quite well. Regards, Björn -- BOFH excuse #306: CPU-ang

Re: chmod g+ Equivalent

2007-08-14 Thread Bjoern Schliessmann
milan_sanremo wrote: > The group ownership is set by chown, Yes -- by storing a group's gid (group ID) in the file metadata. The group ID is an int from /etc/group. > but the group id (setgid bit) is set by chmod. "group id" is not "setgid bit". The "setgid bit" is one bit in the file metadata

Re: wxPython before MainLoop

2007-08-14 Thread Bjoern Schliessmann
[david] wrote: > Well yes, I have tried this app with native windows, > and I know how to do it. Then I wonder why you complained about concurrency problems (solved by using a worker thread, or using wx.Yield) in the first place. Windows has the same solutions, just as about every GUI framework.

Re: wxPython before MainLoop

2007-08-14 Thread Bjoern Schliessmann
[david] wrote: > Steve, it wasn't me that raised the comparison > with MFC. If you don't think that's a helpful > comparison, why not reply to that post instead? It _was_ a comparison, saying that they follow similar principles. You twisted this comparison by saying wxPython was an imitation of MF

Re: What does r"""any text""" mean ?

2007-08-15 Thread Bjoern Schliessmann
Alexander Eisenhuth wrote: > ... as you can find in os.py at line 1 ? Please don't split your request between subject and body. String literals enclosed in triple quotes are multiline strings. String literals prefixed by "r" are raw strings. http://docs.python.org/ref/strings.html Regards, B

Re: Coroutines and argument tupling

2007-08-15 Thread Bjoern Schliessmann
Marshall T. Vandegrift wrote: > I'm trying to write a decorator which allows one to produce simple > coroutines by just writing a function as a generator expression > which re-receives it's arguments as a tuple from each yield. May I ask why? Passing it the same arguments over and over is no use

Re: Changing button preferences after beeing pressed

2007-08-16 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I'm using wxPython to consruct a GUI and want to change a button > label => wx.Button.SetLabel (also have a look at the button examples) > and event handler to change after the button have been > pressed. I'm not sure if those bindings can easily be changed at runt

Re: Coroutines and argument tupling

2007-08-16 Thread Bjoern Schliessmann
Marshall T. Vandegrift wrote: > Without the decorator that becomes: > > gen = nextn(2) > print gen.next() # => [0, 1] > print gen.send(3) # => [2, 3, 4] > print gen.send(1) # => [5] > > The former is just that smidgen nicer, and allows you to continue > to make use of argument de

Re: Coroutines and argument tupling

2007-08-16 Thread Bjoern Schliessmann
Marshall T. Vandegrift wrote: > I'd seen the consumer decorator, and it certainly is cleaner than > just using a generator. I don't like how it hides the parameter > signature in the middle of the consumer function though, and it > also doesn't provide for argument default values. Mh, that may

Re: Can python threads take advantage of use dual core ?

2007-08-17 Thread Bjoern Schliessmann
nikhilketkar wrote: > What are the implications of the Global Interpreter Lock in Python > ? Please have a look at the archives. This topic is brought up anew every few weeks. > Does this mean that Python threads cannot exploit a dual core > processor and the only advantage of using threads is

Re: Hot subject: a good python editor and/or IDE?

2007-08-19 Thread Bjoern Schliessmann
Sébastien wrote: > I am currently using Eclipse+PyDev when developping Python > projects but I lack a fast, simple editor for tiny bit of scripts. > So here is my question: what is, for you, the current best ( but > still kind of light! ) Python editor/IDE ? vim BTW, this is an FAQ. Please look t

Re: Development for dual core machine

2007-08-19 Thread Bjoern Schliessmann
Andy wrote: > I'm going to develop a software package that includes a web server > (and PHP code) , a database, and some Python code of course. I am > being strongly suggested to make it to work on a dual- or > multi-core computer, No problem. CPython will work on any dual core CPU. > but I'm

Re: How to make a module function visible only inside the module?

2007-08-19 Thread Bjoern Schliessmann
beginner wrote: > Thanks a lot. I was using two underscores, __module_method() as my > static method convention, and then I had some problems calling > them from inside class methods. *Please* do yourself and other people that sometime may have to read your code a favor and write code at least lo

Re: Hot subject: a good python editor and/or IDE?

2007-08-19 Thread Bjoern Schliessmann
Buchoux Sébastien wrote: > Yeah, I know this is a FAQ, but, as you mention, there is a whole > bunch of editors, every one of them being updated constantly (+ > the new ones getting out). Are you really sure that you know the meaning of the word "frequently"? > So I am quite sure that looking th

Re: Development for dual core machine

2007-08-19 Thread Bjoern Schliessmann
samwyse wrote: > The Python interpreter is not multi-cpu aware, so using Python > threads won't work on multiple CPUs. Are you sure about this? Regards, Björn -- BOFH excuse #12: dry joints on cable plug -- http://mail.python.org/mailman/listinfo/python-list

Re: Development for dual core machine

2007-08-19 Thread Bjoern Schliessmann
Paul Rubin wrote: > Python threading doesn't support multiple CPU's because of the > GIL. :s/support/take full advantage of/ Regards, Björn -- BOFH excuse #46: waste water tank overflowed onto computer -- http://mail.python.org/mailman/listinfo/python-list

Re: How to make a module function visible only inside the module?

2007-08-19 Thread Bjoern Schliessmann
beginner wrote: > I just started learning the language. I wasn't aware of the PEP. Mh, two postings before Lawrence already mentioned it. I suggest looking through the BeginnersGuide. http://wiki.python.org/moin/BeginnersGuide Regards, Björn -- BOFH excuse #203: Write-only-memory subsyste

Re: Any advice on ways for sharing a small Python application with the world?

2007-08-20 Thread Bjoern Schliessmann
Bert Heymans wrote: > does anyone know of other ways to share something that might just > be too small for a sourceforge project but too big to be a > snippet? You could submit it to . Regards, Björn -- BOFH excuse #271: The kernel license has expired -- http://m

Re: The folder a script is executed in

2007-08-21 Thread Bjoern Schliessmann
Ant wrote: > Do you mean the folder containing the script? Or the current > working directory? > > If the former, then look at os.path.split(sys.argv[0])[0] test.py: | #!/usr/bin/env python | import sys,os | print os.path.split(sys.argv[0])[0] $ cd tmp ~/tmp$ ../test.py .. ~/tmp$ That's rath

Re: The folder a script is executed in

2007-08-21 Thread Bjoern Schliessmann
Ant wrote: > Fair point. On Win32 sys.argv[0] always seems to give the full > path rather than the relative path Strange. > - hadn't realised it was different for linux (?). Yes, I used GNU/Linux for the example. Regards, Björn -- BOFH excuse #148: Insert coin for new game -- http://ma

Re: Newbie: List file system roots

2007-08-24 Thread Bjoern Schliessmann
"Einar W. Høst" wrote: > How would you list the file system roots in Python? That is, I'm > looking for a way to list all connected drives (C:, D: etc) on a > Windows box, or all /root, /tmp etc on a *nix box. /root and /tmp are no "roots", but normal directories. glob.glob("/*") will give you al

Re: GUI and distrubution

2007-08-24 Thread Bjoern Schliessmann
James Stroud wrote: > One of these days, someone needs to write a tutorial on > distributing for the Big 3 (Linux, OSX, and Amiga--or was that > last one supposed to be M$?). I think the last one was Wintendo ;) Regards, Björn -- BOFH excuse #221: The mainframe needs to rest. It's getting

Re: pySerial in a daemon process

2007-08-26 Thread Bjoern Schliessmann
paul wrote: > If I put these back in and try to run the daemon, the script fails > when I try to connect to the serial port, with this error: > serial.serialutil.SerialException: Could not open port: [Errno 13] > Permission denied: '/dev/ttyS0' Did you check the permissions on this file? Often yo

Re: "Try:" which only encompasses head of compound statement

2007-08-27 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I have: > > try: > for line in open(myFileName): > count += 1 > except IOError: > print "Can't open myfile" > > (I know, this is bad, I never close the file, but its just for > illustration). But then I change it to: > > try: > for line in open(myF

Re: extending of adding method?

2007-08-28 Thread Bjoern Schliessmann
Gerardo Herzig wrote: > Hi all. I have a question about design. The general question would > be: Where is the line beteween extending a class and adding new > methods to that class? What do you mean by "extending"? The Java "extends", which is really inheritance? > And the particular case im in

Re: localhost, ?!

2007-08-28 Thread Bjoern Schliessmann
Boris Ozegovic wrote: > At job: > urllib2.urlopen("http://localhost";) > raise BadStatusLine(line), after half a minute. Looks like name resolving problems. > urllib2.urlopen("http://127.0.0.1";) > HTTP Error 503: Service Unavailable, immediately. Definitely a problem with the web server (503

Re: localhost, ?!

2007-08-28 Thread Bjoern Schliessmann
Boris Ozegovic wrote: > Bjoern Schliessmann wrote: >> Definitely a problem with the web server (503 means "service >> unavailable"). > > I did try on two servers, Apache and simple python server. There > was identically error on both servers. Also try to l

Re: strange list comprehension on generator

2007-08-29 Thread Bjoern Schliessmann
No greeting, no text? Pity. Roland Puntaier wrote: > def changeOne(aa,idx): > aa[idx]=not aa[idx] > yield aa > for i in range(idx): > for x in changeOne(aa,i): > yield x > > def changeOneOrder(aa): > yield aa > for i in range(len(aa)): > for x in changeOne(aa,i): >

Re: How best to dynamically define methods (and functions)?

2007-09-02 Thread Bjoern Schliessmann
Kenneth McDonald wrote: > I can see an obvious but hacky way to define a Python function at > runtime. What way is this? All Python function definitions in your code are executed at runtime. > In case it's of interest in the context of the question, I need to > define a largish set of functions

Re: 400 Bad Request calling urllib2.urlopen()

2007-09-03 Thread Bjoern Schliessmann
Achim Domma wrote: > urllib2.HTTPError: HTTP Error 400: Bad Request > > I'm using Python 2.5.1 and Google did not help. Any hint on how to > fix or debug this problem? Use e. g. wireshark to look at the raw stream data and check if the request is malformed. Regards, Björn -- BOFH excuse #12

Re: Text processing and file creation

2007-09-05 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I would use a counter in a for loop using the readline method to > iterate over the 20,000 line file. file objects are iterables themselves, so there's no need to do that by using a method. > Reset the counter every 5 lines/ iterations and close the file. I'd use a

Re: So what exactly is a complex number?

2007-09-05 Thread Bjoern Schliessmann
Grzegorz S?odkowicz wrote: > In fact, a proper vector in physics has 4 features: point of > application, magnitude, direction and sense. No -- a vector has the properties "magnitude" and direction. Although not everything that has magnitude and direction is a vector. It's very unusual to have a

Re: So what exactly is a complex number?

2007-09-05 Thread Bjoern Schliessmann
Grzegorz S?odkowicz wrote: > I believe vectors can only be added if they have the same point of > application. That may be true in physical observations, but doesn't make "point of application" a vector property. If you had it as property, you could never say that in a force field the force was e

Re: So what exactly is a complex number?

2007-09-07 Thread Bjoern Schliessmann
Grzegorz S?odkowicz wrote: > Interesting. It appears that we are ran into a mathematical > cultural difference. Were I come from vectors *are* defined as > having four properties that I enumerated. After some research I > found that English sources (Wikipedia) indeed give the definition > you suppl

Re: Python syntax wart

2007-09-09 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > Not possible: > > for \ > Link \ > in \ > GetEachRecord \ > ( > "links", > ("from_episode",), > "to_episode = %s", > [EpisodeID], > "order by when_created" > ) \ >

Re: Python syntax wart

2007-09-09 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > But then you can no longer use indentation to display the > two-dimensional structure of the statement. How can a statement be two-dimensional? Like a two-dimensional Turing Machine? Regards, Björn -- BOFH excuse #156: Zombie processes haunting the computer --

Re: Enum class with ToString functionality

2007-09-10 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I have the following class - > > class TestOutcomes: > PASSED = 0 > FAILED = 1 > ABORTED = 2 > > plus the following code - > > testResult = TestOutcomes.PASSED > > testResultAsString > if testResult == TestOutcomes.PASSED: > testResultAsString = "Pas

Re: python 2.5 problems

2007-09-10 Thread Bjoern Schliessmann
Brian wrote: > Finally deleted 2.2 and loaded 2.5 (see below), using > the msi, on my XP partition. Having intermittent system > crashes. The probability that this is not a coincidence is IMHO very, very low. Looks like a deeper software or even hardware problem. Regards, Björn -- BOFH excu

Re: less obvious "super"

2007-09-10 Thread Bjoern Schliessmann
Nagarajan wrote: > class A : > def __init__( self ): > self.x = 0 > > class B ( A ): > def __init__( self, something ): > # Use "super" construct here so that I can "inherit" x of > # A > self.y = something > > How should I use "super" so that I could acc

Re: Python syntax wart

2007-09-10 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Bjoern >> What's wrong with this: >> >> for Link in GetEachRecord( > > Then you're no longer showing the syntax structure in two > dimensions. Why should I want to? :) BTW, this is the first time I read about "two dimensional syntax

Re: Python syntax wart

2007-09-10 Thread Bjoern Schliessmann
Gabriel Genellina wrote: > Do you know the Befunge language? Program flow is not lineal but > along a 2D grid. There are variants over toroids and more bizarre > surfaces, even using 3D. Ah, I remember. Once read about it. Really cool idea :) Regards, Björn -- BOFH excuse #149: Dew on the te

Re: Python syntax wart

2007-09-10 Thread Bjoern Schliessmann
TheFlyingDutchman wrote: > It may be that a language that doesn't have a statement terminator > (which can be end-of-line) needs a statement continuation symbol. Which language could that be? I can hardly imagine making a complex program out of one statement. Regards, Björn -- BOFH excuse #1

Re: Python syntax wart

2007-09-10 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Marc 'BlackJack' >> I see a tree structure here ... > > Good, you're improving. Tree structures can't, IMHO, be called two-dimensional. Although, you can represent them with a two-dimensional graph. If the tree gets more complex this c

Re: cpython list __str__ method for floats

2007-09-11 Thread Bjoern Schliessmann
[david] wrote: > returns poorly formatted values: Please explain. > >>>str(13.3) > '13.3' > >>>str([13.3]) > '[13.301]' This is quite a FAQ. str of a float returns the float, rounded to decimal precision. str of a list returns a square brackets enclosed enumeration of the content

Re: mod_python and pysvn

2007-09-11 Thread Bjoern Schliessmann
Tim Golden wrote: > Sjoerd wrote: >> ClientError: Unable to open an ra_local session to URL >> Unable to open repository 'file:///P:/tools/builds/repository' >> >> does anyone know how I can fix this? > > Usually means that the process which Apache is running under > (may well be LocalSystem) do

Re: Compiler Python

2007-09-11 Thread Bjoern Schliessmann
anton a wrote: > Someone knows since as I can obtain the information detailed about > the compiler of Python? (Table of tokens, lists of productions of > the syntactic one , semantic restrictions...) I'm not really about the syntax of your question, but I'd try looking at the source code. Regards

Re: Python 3K or Python 2.9?

2007-09-12 Thread Bjoern Schliessmann
Ivan Voras wrote: > What does "self" have to do with an object model? It's an > function/method argument that might as well be hidden in the > compiler without ever touching the role it has (if not, why?). I > agree that it's needless noise in a language. If this was needless, why do C++ and Java

Re: Compiler Python

2007-09-12 Thread Bjoern Schliessmann
Bruno Desthuilliers wrote: > Bjoern Schliessmann a écrit : >> I'm not really about the syntax of your question, ^(sure) > > lol !-) ;) It wasn't mean ironically, I really forgot the "sure". Regards, Björn -- BOFH excuse #322: Your

Re: cpython list __str__ method for floats

2007-09-12 Thread Bjoern Schliessmann
[david] wrote: > Leaving aside the question of why str should return repr, str doesn't "return" repr. str returns a "nice string representation" of an object. This "nice string representation" of a list is the opening square bracket, the repr of its contents seperated by comma, and the closing sq

Re: struct is saving 4 bytes instead of 2

2007-09-12 Thread Bjoern Schliessmann
TonyB wrote: > When I inspect the file with a hex editor it show that the > variable is being saved as 4 bytes. How can I make it save the > value as 2 bytes? Use an aligment specifier in the format string (you want "standard" alignment). See: http://docs.python.org/lib/module-struct.html Rega

Re: pythonesque constructs for c++

2007-09-12 Thread Bjoern Schliessmann
Josh wrote: > Does anyone know of analagous c++ libraries? It seems to me that > most of the functionality of these modules could easily be > replicated in c++. Sure, there are many. Apart from the already named, also widget libraries often bring their own tools for this. wxWidgets and Qt do, fo

Re: Python 3K or Python 2.9?

2007-09-12 Thread Bjoern Schliessmann
TheFlyingDutchman wrote: > In C++ and Java I don't believe "this" is ever referred to as an > implicit function parameter. Oh yes, it is. All methods use it as a base address into instances. Implicitly though. > It is a (sometimes necessary) way to reference the object inside > one if it's meth

Re: Python 3K or Python 2.9?

2007-09-12 Thread Bjoern Schliessmann
Stefan Behnel wrote: > Bjoern Schliessmann wrote: >> If this was needless, why do C++ and Java have the "this" >> pointer? > > Be careful when you use the word "needless" in the context of > Java. Umm, why? I didn't introduce it. Regards, Bjö

Re: struct is saving 4 bytes instead of 2

2007-09-13 Thread Bjoern Schliessmann
TonyB wrote: > I tried > > f.write(struct.pack('=h',thevariable)) > > and it works. Great! :) Regards, Björn -- BOFH excuse #45: virus attack, luser responsible -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3K or Python 2.9?

2007-09-13 Thread Bjoern Schliessmann
TheFlyingDutchman wrote: > I am not talking about how the implementation of a C++ or Java > compiler uses the this pointer/this reference internally. I am > talking about how an author describes in English the "this" > pointer/reference in their book on programming C++ or Java. Ah, okay. > I do

Re: newbie: self.member syntax seems /really/ annoying

2007-09-13 Thread Bjoern Schliessmann
OKB (not okblacke) wrote: What kind of name is this? > No, but the point being made is that it would be better IN > THIS CASE. It wouldn't. IMHO, rewriting the code to two or three lines would be better. No need to scream, BTW. Regards, Björn -- BOFH excuse #447: According to Microsoft, it

Re: Python 3K or Python 2.9?

2007-09-13 Thread Bjoern Schliessmann
TheFlyingDutchman wrote: > Here's a FAQ item where they refer to it as I think Python should > have done it - a special predefined variable: Maybe. Personally, I like it the way it is in Python. Why don't you make a preprocessor which accepts method declarations without "self" and fixes them? Re

Re: class declaration shortcut

2007-03-02 Thread Bjoern Schliessmann
Steven D'Aprano wrote: > Overkill? Storage of a single attribute holding a (usually short) > string is overkill? No, but storing the first name a class is bound to in it is a bit of, IMHO. > When you do that, you wouldn't expect the __name__ of > some.module.function to change to f, and it does

Re: Sorting strings containing special characters (german 'Umlaute')

2007-03-02 Thread Bjoern Schliessmann
Hallvard B Furuseth wrote: > [EMAIL PROTECTED] writes: >> For sorting the letter "Ä" is supposed to be treated like "Ae", >> therefore sorting this list should yield >> l = ["Aber, "Ärger", "Beere"] > > Are you sure? Maybe I'm thinking of another language, I thought Ä > shold be sorted together

Re: Sort with extra variables

2007-03-02 Thread Bjoern Schliessmann
Thomas Dybdahl Ahle wrote: > However I'd really like not to use the lambda, as it slows down > the code. Did you check how much the slowdown is? Regards, Björn -- BOFH excuse #65: system needs to be rebooted -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting strings containing special characters (german 'Umlaute')

2007-03-02 Thread Bjoern Schliessmann
Robin Becker wrote: > Björn, in one of our projects we are sorting in javascript in > several languages English, German, Scandinavian languages, > Japanese; from somewhere (I cannot actually remember) we got this > sort spelling function for scandic languages > > a > .replace(/\u00C4/g,'A~') //A

Re: class declaration shortcut

2007-03-02 Thread Bjoern Schliessmann
Arnaud Delobelle wrote: > Don't see it as the first name a class is bound to, but rather as > the name a class is defined as. > If class_object.__name__ == 'Foo' it means that somewhere in your > code there is a class definition: > > class Foo: > # stuff > > Same for function: if function_ob

Re: Perl and Python, a practical side-by-side example.

2007-03-02 Thread Bjoern Schliessmann
Bruno Desthuilliers wrote: > Shawn Milo a écrit : >> if recs.has_key(piid) is False: > > 'is' is the identity operator - practically, in CPython, it > compares memory addresses. You *dont* want to use it here. It's recommended to use "is None"; why not "is False"? Are there multiple False in

Re: Problem with returning prime number in a simple calculation program

2007-03-03 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > [reformatted indentation] > def prime(): > num = input("Number ") > i = num - 1 > divcounter = 0 > while i > 1: > if num % i != 0 > divcounter += 1 > i -= 1 > if divcounter == num - 2: > print num, "is a prime n

Re: transfer data from one machine to another

2007-03-04 Thread Bjoern Schliessmann
bahoo wrote: > I have ssh access to two linux machines (both WITHOUT root > account), and I'd like to copy data from one to another. > Since the directory structure is different, I want to specify in a > script (ideally in python, because that's what I want to learn) > what to copy over like this:

Re: New to Python

2007-03-05 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I am trying to get a program to add up input from the user to get > to the number 100 using a loop. However, I am having some issues. Please, if you have a problem post the exact error symptoms. > Here is what I have so far. I know I am just trying to hard, but > I

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread Bjoern Schliessmann
John Nagle wrote: > True. It would make sense to disallow mutable values as > initial values for optional arguments. The present behavior > is silly. Why? You're free to only use immutables. Regards, Björn -- BOFH excuse #42: spaghetti cable cause packet failure -- http://mail.pytho

Re: pylint: don't warn about tabs

2007-03-08 Thread Bjoern Schliessmann
Alan Isaac wrote: > I am brand new to pylint. > As a tab user, I want the tabs warning turned off. > How? Advice: Don't. IIRC it's planned in future Python versions that TABs aren't supported for indentation. Regards, Björn -- BOFH excuse #401: Sales staff sold a product we don't offer. --

Re: pylint: don't warn about tabs

2007-03-08 Thread Bjoern Schliessmann
Ben Finney wrote: > Bjoern Schliessmann <[EMAIL PROTECTED]> >> IIRC it's planned in future Python versions that TABs aren't >> supported for indentation. > > I've not seen such plans, can you support that? No ... 8) > If you're thinking of t

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Of course I'll still argue that the WIP character would be a more > elegant, speedy and versatile alternative. I don't think so. Those characters have no syntactical meaning and would, IMHO, make the language "dirty". Regards, Björn -- BOFH excuse #73: Daemons did

Re: C++ and Python

2007-03-09 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I'm considering about generating some Python Bindings for C++ > libraries. What are considered the best tools for doing something > like this? I know that there are SWIG, SIP, Boost.Python, and > GCC_XML. Please excuse me for asking the following stupid question ... I'

Python in a Nutshell v2.5 shortcomings (was: Python books?)

2007-03-09 Thread Bjoern Schliessmann
Alex Martelli wrote: > I do know that the 2nd edition of Python in a Nutshell tries to do > so, but falls quite a bit short on a number of important new > additions to the library Which, if I may ask? Regards, Björn -- BOFH excuse #221: The mainframe needs to rest. It's getting old, you kn

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: >> Those characters have no syntactical meaning... > > ? > Neither does # until you give it syntactical meaning. I must be > missing what you mean. Yes, it has. It says "disregard the following characters until EOL". If you remove it, the following code will be interprete

Re: number generator

2007-03-09 Thread Bjoern Schliessmann
cesco wrote: > On Mar 9, 3:51 pm, Paul Rubin >> "cesco" <[EMAIL PROTECTED]> writes: >>> I have to generate a list of N random numbers (integer) whose >>> sum is equal to M. If, for example, I have to generate 5 random >>> numbers whose sum is 50 a possible solution could

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > But # is 'only a comment sign' as well, and equally meaningless to > the interpreter. No! "#" means "disregard everything until EOL" to the interpreter. Your proposed highlighting character means exactly nothing to the interpreter. Get the difference? > But it's still

Re: pylint: don't warn about tabs

2007-03-10 Thread Bjoern Schliessmann
Alan Isaac wrote: > What ambiguity? > Tabs are *less* ambiguous. > One tab character is one level of indentation. > > I have never seen this violated. Not quite a proof ... > Users of spaces cannot even count > on shared code being 4 rather than 8 spaces. You also can't count on proper TAB cod

Re: distributed queue?

2007-03-10 Thread Bjoern Schliessmann
Paul Rubin wrote: > Does anyone have an implementation of a distributed queue? I.e. I > have a long running computation f(x) and I'd like to be able to > evaluate it (for different values of x) on a bunch of different > computers simultaneously, the usual "worker thread" pattern except > distrib

Re: How to test if a key in a dictionary exists?

2007-03-10 Thread Bjoern Schliessmann
Frank wrote: > does anyone know how one can test if, e.g., a dictionary 'name' > has a key called 'name_key'? Yes. It's already posted; next time have a look at the concise library reference: http://docs.python.org/lib/typesmapping.html > This would be possible: > > keys_of_names = names.keys

Re: Help

2007-03-10 Thread Bjoern Schliessmann
Clement wrote: > how to use Python/C API http://www.catb.org/~esr/faqs/smart-questions.html#intro HTH Björn -- BOFH excuse #235: The new frame relay network hasn't bedded down the software loop transmitter yet. -- http://mail.python.org/mailman/listinfo/python-l

Re: unsigned integer?

2007-03-10 Thread Bjoern Schliessmann
Paul Rubin wrote: > The OP specified that the expected result was 3. But that's not what he'd get with his C conversion ;) Regards, Björn -- BOFH excuse #348: We're on Token Ring, and it looks like the token got loose. -- http://mail.python.org/mailman/listinfo/python-list

Re: unsigned integer?

2007-03-10 Thread Bjoern Schliessmann
hg wrote: > Dan Bishop wrote: >> def unsigned(n): >> return n & 0x > > or abs(-1) ? Nah! Bitwise operators are cool. ;) Though ANDing won't make the int unsigned. Regards, Björn -- BOFH excuse #23: improperly oriented keyboard -- http://mail.python.org/mailman/listinfo/pytho

Re: a better solution for GUI in python

2007-03-11 Thread Bjoern Schliessmann
ce wrote: > My question is which solution would be better for the GUI (and > easier to implement)? I knew there are something like wxidgets, (wxWidgets. It's the C++ lib, its Python bindings are wxPython) > QT (same as above, it's called pyQt. Check licensing, it's not as liberal as the others'

Re: a better solution for GUI in python

2007-03-11 Thread Bjoern Schliessmann
StD wrote: > I'd recommend pyGTK. It's easy to use, delivers astonishing > results and is perfectly portable as far as I know. And how does it look on Windows? :) > I'm working with it myself, having the goal of simplicity as well > as portability and I got to say, it works! Hope that was helpf

<    1   2   3   4   5   6   >