Re: threading and iterator crashing interpreter

2007-03-11 Thread Bjoern Schliessmann
Janto Dreijer wrote: > I have been having problems with the Python 2.4 and 2.5 > interpreters on both Linux and Windows crashing on me. I don't understand -- does the interpreter crash (segfault) or is just your program terminating due to unhandled exceptions? Regards, Björn -- BOFH excuse #

Re: distributed queue?

2007-03-11 Thread Bjoern Schliessmann
Paul Rubin wrote: > Bjoern Schliessmann <[EMAIL PROTECTED]> >> (Why does everyone think that "concurrency" equals "usage of >> multiple threads"?) > > Well, it doesn't necessarily, but that's easiest a lot of the > time. I don't

Re: Bitpacked Data

2007-03-11 Thread Bjoern Schliessmann
none wrote: > i need to interface python with a bitpacked data file, > the structure recorded in the file is the following: > > struct { > var_1 4bit > var_2 6bit > var_3 2bit > var_3 4bit > } Strange data types. What language is this? > how can read the struct and convert data into dictionary

Re: Idiom for running compiled python scripts?

2007-03-20 Thread Bjoern Schliessmann
Mark wrote: > E.g. say I have a python script "myprog.py". I could just execute > that directly each time but that means it is "compiled" each time > I run it which is not efficient and adds to startup time. Did you measure the performance hit in your case? > I have one of these stubs for all m

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Bjoern Schliessmann
dmitrey wrote: > it would reduce length of code lines and make them more readable, > + no needs to write annoing charecters. IMHO, it's less readable. I suppose I'm not on my own with this opinion. Regards, Björn -- BOFH excuse #34: (l)user error -- http://mail.python.org/mailman/listinf

Re: Python object overhead?

2007-03-23 Thread Bjoern Schliessmann
Matt Garman wrote: > Since each line corresponds to a record, what I'm trying to do is > create an object from each record. However, it seems that doing > this causes the memory overhead to go up two or three times. (Note that almost everything in Python is an object!) > Example 1: read lines i

Re: Python object overhead?

2007-03-25 Thread Bjoern Schliessmann
Facundo Batista wrote: > "not line" and "len(line) == 0" is the same as long as "line" is a > string. > > He's checking ok, 'cause a "blank line" has a lenght > 0 (because > of newline). Ah, K. Normally, I strip the read line and then test "if not line". His check /is/ okay, but IMHO it's a litt

Re: Python object overhead?

2007-03-25 Thread Bjoern Schliessmann
Felipe Almeida Lessa wrote: > Could you tell me what in Python isn't an object? Difficult ;) All data structures are (CMIIW). Functions and Types are objects, too. > Are you counting old-style classes and instances as "not object"s? No, both are. Regards, Björn -- BOFH excuse #366: ATM c

Re: Python object overhead?

2007-03-26 Thread Bjoern Schliessmann
Matt Garman wrote: > In my case, I know my input data doesn't have any blank lines. 8) I work with a (not self-written) perl script that does funny things with blank lines in input files. Yeah, blank lines "aren't supposed to" be in the input data ... > However, I'm glad you (and others) clarif

Re: about second parameter of signal handler func.

2007-03-26 Thread Bjoern Schliessmann
Marco wrote: > In C, a signal handler function has only one parameter, that is > signal number. But in Python(import signal), a signal handler > function has two parameters, the first is signal number, the > second is "frame"? > > What is "frame", please? Did you bother using help()? >>> help(s

Re: how can I clear a dictionary in python

2007-03-28 Thread Bjoern Schliessmann
Aahz wrote: > Go back and read Christian's post, then post a followup explaning > why his solution is better than yours. Your explanation should > use id(). I wonder how you two seem to know exactly what the OP wants ... Regards, Björn -- BOFH excuse #335: the AA battery in the wallclock

Re: Indentation for code readability

2007-03-30 Thread Bjoern Schliessmann
DE wrote: > The curly brackets have no functional meaning but increase the > readability significantly. Personally, I don't think so. It quite explodes the code. Yes, I also indent "BSD style" in my C++ programs. Regards, Björn -- BOFH excuse #175: OS swapped to disk -- http://mail.pyth

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-03-31 Thread Bjoern Schliessmann
Mark Dufour wrote: > Shed Skin allows for translation of pure (unmodified), implicitly > statically typed Python programs into optimized C++, and hence, ^ > highly optimized machine language. Wow, I bet all C++ com

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-03-31 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Why are you taking potshots at Mark? What suggests that I'm "taking potshots" at Mark? > He's maybe onto something and he's asking for help. If he can > generate efficient C++ code from implicitly statically type Python > it stands to reason that he can take advantag

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-03-31 Thread Bjoern Schliessmann
Luis M. González wrote: > I think he should be taken very seriously. Agreed. Okay, it seems focusing a discussion on one single point is difficult for many people. Next time I'll be mind-bogglingly clear that even the last one understands after reading it one time ... Regards, Björn Fup2 p

Re: Question about text in Python

2007-04-02 Thread Bjoern Schliessmann
Steve wrote: > What I want to add to the program is the abilty to rerun this > process (where the user enteres another line of text) until the > user has had enough and enters a blank line which would then end > the program. Homework? Regards, Björn -- BOFH excuse #106: The electrician didn

Re: Problem with global variables

2007-04-02 Thread Bjoern Schliessmann
Laurent Pointal wrote: > And so the solution to add "global foo" before using it. Didn't you read his final question? | All of a sudden, tiny() can see the global variable "foo". Very | confusing! Why is it that tiny() sometimes can, and sometimes | can't, see the global variable "foo"? I hav

Re: Problem with global variables

2007-04-02 Thread Bjoern Schliessmann
Laurent Pointal wrote: > Yes, and i replies: "which contains a foo assignment. As foo is > not defined "global", it is considered to be local. " > > Maybe my explanation was not clear enough with variable foo to be > considered local because there is an *assignment* to foo. Yep, thanks for the

Re: Question about text in Python

2007-04-03 Thread Bjoern Schliessmann
Steve wrote: > Yes it is. > > Where else to ask for help but here. http://www.catb.org/~esr/faqs/smart-questions.html#homework Regards&Good luck, Björn -- BOFH excuse #247: Due to Federal Budget problems we have been forced to cut back on the number of users able to access the system at on

Re: raw_input just continues anyway?

2007-04-03 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > if __name__ == "__main__": > bucket_name = raw_input('Name of the bucket you wish the files to be > placed into? ') > update_s3() > > Basically, it just asks the question and continues anyway? It reads stdin until a line break. Then it continues. Exactly what

Re: ulimit on open sockets ?

2007-04-09 Thread Bjoern Schliessmann
Maxim Veksler wrote: > I've written this code, the general idea was to listen on all > 65535 port of tcp for connection. Please excuse the question: Why would anyone want to do such a manic thing (instead of, e. g., using raw sockets)? Regards, Björn -- BOFH excuse #326: We need a licensed

Re: wxPython, mac, wx.HSCROLL not working

2007-04-12 Thread Bjoern Schliessmann
7stud wrote: > I'm trying to allow for a horizontal scrollbar on a textarea, but > the scrollbar won't appear when I enter a long string of text(by > leaning on one character on my keyboard): Works for me (Linux, self-built Python 2.5 and wxPython 2.8.3.0). Regards, Björn -- BOFH excuse #285

Re: wxPython, mac, wx.HSCROLL not working

2007-04-12 Thread Bjoern Schliessmann
7stud wrote: > Where is that list? Argh! http://www.wxpython.org/maillist.php Regards, Björn -- BOFH excuse #330: quantum decoherence -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython, mac, wx.HSCROLL not working

2007-04-13 Thread Bjoern Schliessmann
7stud wrote: > Thanks. It looks like someone asked the same question yesterday. No -- it looks like I was a bit stressed and the first google hit or a direct jump to wxpython.org would have provided the solution :) Regards, Björn -- BOFH excuse #14: sounds like a Windows problem, try calli

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > In Visual Basic there is the keyword "with" which allows an > object- name to be declared as governing the following statements. > For example: > > with quitCommandButton > .enabled = true > .default = true > end with > > This is syntactic sugar for: > > quitCommand

Re: wxPython, mac, wx.HSCROLL not working

2007-04-14 Thread Bjoern Schliessmann
7stud wrote: > Huh? Are you saying you found a solution? Yes, the solution to | Where is that list? Regards, Björn -- BOFH excuse #382: Someone was smoking in the computer room and set off the halon systems. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread Bjoern Schliessmann
jamadagni wrote: > Bjoern Schliessmann wrote: >> In more complex modules, when you are >> looking for, e. g., self.myVar and anotherObject.myVar, >> this "using" statement decreases readability and maintainability >> (in full text searching). IMHO. > >

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Bjoern Schliessmann
jamadagni wrote: > OK fine. It is clear that this feature must be implemented if at > all only on a per-module basis. So can we have votes for > per-module implementation of this feature? I don't think it's worth the hassle. BTW, what's, IYHO, the distinct advantage of starting array indices at 1

Re: That might be the case for more complex objects...

2007-04-14 Thread Bjoern Schliessmann
Bart Willems wrote: > I can try this in interactive mode: > >>> a = 5 > >>> b = a > >>> a += 1 > >>> print b > 5 > > So, if /a/ and /b/ where pointing to the *same* "5" in memory, They do: >>> a = 5 >>> b = a >>> a is b True >>> a += 1 >>> a is b False ... but not after a is rebound to a n

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-18 Thread Bjoern Schliessmann
Dustan wrote: > For newbies, it's easier to count starting with 1. It's rather > unintuitive to start at 0. Cool. So Python will become a "newbie language", and everyone that "jumps" from Python to a different language will have to relearn 0-based indices? ;) Regards, Björn -- BOFH excuse #

Re: Python 3K or Python 2.9?

2007-09-13 Thread Bjoern Schliessmann
Bruno Desthuilliers wrote: > Bjoern Schliessmann a écrit : >> Why don't you make a preprocessor which accepts method >> declarations without "self" and fixes them? > > The problem being that there's no such thing as a "method > declaration"

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

2007-09-14 Thread Bjoern Schliessmann
stef mientki wrote: > Indeed, so I wondered why there isn't open source alternative (at > least I didn't find one). Have a look at scilab and octave. Not sure if it's GPL though. Regards, Björn -- BOFH excuse #387: Your computer's union contract is set to expire at midnight. -- http://mail

Re: Python 3K or Python 2.9?

2007-09-14 Thread Bjoern Schliessmann
Bruno Desthuilliers wrote: > A method is a thin wrapper around a function, usually instanciated > and returned by the __get__ method [1] of the function itself when > the function is looked up as an attribute of a class or an > instance: > [...] That's interesting, thank you for the explanation.

Re: Python 3K or Python 2.9?

2007-09-14 Thread Bjoern Schliessmann
Terry Reedy wrote: > No it does not. The method wrapping is done at runtine. The > compiler is ignorant of the wrapping that will be done. Agreed, after reading the docs. dis.dis(f) > 1 0 LOAD_GLOBAL 0 (c) > 3 LOAD_ATTR1 (meth) >

Re: Https conversation - debug?

2007-09-14 Thread Bjoern Schliessmann
Johny wrote: > Is there any good sniffer for https protocol? Yes. > How can be watched https conversation? As a matter of principle, with every working sniffer. I'd use wireshark's "follow TCP stream" function. Regards, Björn -- BOFH excuse #198: Post-it Note Sludge leaked into the monito

Re: Python "with"

2007-09-16 Thread Bjoern Schliessmann
Ivan Voras wrote: > I'm looking for a construct that's similar to (Turbo) Pascal's > "with" statement. Please have a look at the archives -- this is discussed here from time to time. I think last time it was a Visual BASIC fan that asked a similar question. > I know it can be almost always done

Re: A short question about non-ascii characters in list

2007-09-17 Thread Bjoern Schliessmann
js wrote: > That's make sence, but it's also true that > sometimes we want to see the contents of a list in pretty format. That may be true, but most of the time not (at least not me) -- lists are no pretty printing instrument, but a container. > So for now I need to write and use crappy mylist l

Re: Use GUI for Python

2007-09-17 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I am new to python as I have been a VB programmer. I am used to > the GUI interface, and was wondering if I had to choose between a > GUI for Python, which one should I go with? Simple: The one you like most. Since this is an FAQ, I'll just list some popular GUI toolki

Re: I´m trying to desenvolve a site in python

2007-09-17 Thread Bjoern Schliessmann
Andre P.S Duarte wrote: > I´m trying to desenvolve a site in python. What does "desenvolve" mean? By "site", do you mean a web site? Regards, Björn -- BOFH excuse #247: Due to Federal Budget problems we have been forced to cut back on the number of users able to access the system at one tim

Re: executing list of methods (and collecting results)

2007-09-20 Thread Bjoern Schliessmann
Gerardo Herzig wrote: > I want the collect_validators() method is to execute any of the > above methods, and collect their names as items of a list (wich > will be the collect_validators() return value). (inside class definition -- untested) validators = {"is a number": is_really_a_number,

Re: executing list of methods (and collecting results)

2007-09-21 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Haha, no, the actual methods do other kind of things. > Thanks Björn!!! Okay, so I hoped. Glad to be of help. Regards, Björn -- BOFH excuse #233: TCP/IP UDP alarm threshold is set too low. -- http://mail.python.org/mailman/listinfo/python-list

Re: An Editor that Skips to the End of a Def

2007-09-21 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > After two decades of putting up with vi just to ensure > compatibility with every proprietary *nix system I might come > across, let me just say ... > > USE EMACS! Nah. Use vim. > Oh, and > . Esc-Meta-A

Re: An Editor that Skips to the End of a Def

2007-09-21 Thread Bjoern Schliessmann
Stefan Behnel wrote: > Bjoern Schliessmann wrote: >> Lawrence D'Oliveiro wrote: >>> <http://ars.userfriendly.org/cartoons/ >>> ?id=20070910&mode=classic>. >> >> Esc-Meta-Alt-Ctrl-Shift? :) > > Yep, that's five of them. I'd

Re: Writing Object Data to Disk

2007-09-22 Thread Bjoern Schliessmann
Amit Kumar Saha wrote: > I have a Python class with data members, say: > > class Foo: > def __init__(self): > > self.a=7 > self.b[]={1,3,4} ^^ This is invalid syntax. > I would like to know if "Pickling" the class object is the only > way of writing it to disk

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Bjoern Schliessmann
Carl Banks wrote: > On Sat, 22 Sep 2007 05:19:42 +, Grant Edwards wrote: >> I do. > > Your anecdotal evidence is noted and given all the consideration > it's due. Being funny, or being arrogant? Many today's network protocols work with bit flags. It is /not/ anecdotal. >> I do it all the t

Re: An Editor that Skips to the End of a Def

2007-09-25 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > That's like saying, about a program that, when given "2 + 2", > outputs "5", that _of course_ it knows the correct answer is "4", > it just chooses to "modify" the answer before outputting it. No. Which laws say how transitions between modes have to be? Thus, I know la

Re: Tracking memory usage and object life time.

2007-09-26 Thread Bjoern Schliessmann
Berteun Damman wrote: > When I run a test, I disable the garbage collection during the > test run (as is adviced), but just before starting a test I > instruct the garbage collector to collect. Running the test > without disabling the garbage collect doesn't show any difference > though. Did you

Re: An Editor that Skips to the End of a Def

2007-09-26 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > It's strange, but in nearly 30 years of writing code in dozens of > different languages, I've never felt the urge to line up my code > in columns. Never. You definitely used the wrong languages :) http://worsethanfailure.com/Articles/The-Other-Kind-of-RPG.aspx | We

Re: Delete values from a string using the index

2007-09-26 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > How do I delete or remove values from a list or string using the > index. > > If a = [1,2,3,4,5,6,7,8] and I want to get rid of 1 -5, how would > I do that? del a[0:5] Be sure to check out the relevant section of the Python tutorial. http://docs.python.org/tut/node7.

Re: Using closures and partial functions to eliminate redundant code

2007-09-27 Thread Bjoern Schliessmann
Matthew Wilson wrote: > I'm interested to hear how other people deal with really similar > code. > The similarity just bugs me. However, I wonder if using stuff > like closures or partial function application is needlessly showy. ACK -- but not because it's showy, but because it may be more erro

Re: List search

2007-09-29 Thread Bjoern Schliessmann
Kevin Walzer wrote: > I'm having a problem with searching a list. Here's my code: > > mylist = ['x11', 'x11-wm', 'x11-system'] > > for line in mylist: > if 'x11' in line: > print line > > This results in the following output: > > x11 > x11-wm > x11-system > > I'm looking to return

Re: Can you please give me some advice?

2007-09-30 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > And, as someone who has been learning Python from almost no > knowledge of programming, I've found it is not too bad in trying > to keep as reasonably close to a natural language like English > as possible. Sure, your next project should be learning COBOL -- it must be

Re: random keypress bounce in a terminal

2007-10-02 Thread Bjoern Schliessmann
István wrote: > It works fine as long as I hit keys normally, but gives extra > characterts if I keep pressing some key, e.g. up or down arrow > keys. It runs on a Linux system. What's the wrong with it? Nothing. Linux VTs will generate multiple characters for special keys. Regards, Björn --

Re: List Question

2007-10-03 Thread Bjoern Schliessmann
Pablo Ziliani wrote: > > > I always use this full-featured, all-inclusive, rock-solid version > (see the try/except block): > > count = i = 0 > x = 1 > y = [1,2,3,4,5,1,2,3,4,1,2,1] > try: > while count < 3: > if y[i] == x: > count += 1 > i += 1 > except RuntimeE

Re: random keypress bounce in a terminal

2007-10-03 Thread Bjoern Schliessmann
István wrote: > Moreover, I would also state for others: the behavior of this code > is independent of the keyboard repeating rate. Sure, it's not multiple keypresses but a sequence generated by the VT code in the kernel. > But what if it _seems_ to work differently...? > That's the reason of tr

Re: WebBased Vector 2D Graphics

2007-10-05 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Is there any way this web programming can be done in python. Sure. Minimalistic approaches include using CGI (http://docs.python.org/lib/module-cgi.html) or using Apache with mod_python directly. There are also web frameworks for Python, but I don't know much about th

Re: WebBased Vector 2D Graphics

2007-10-05 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > On Oct 5, 11:43 am, Bjoern Schliessmann > The above approaches allow you to directly print to the web page. > > Would this mean I wouldn't be able to have any fancy graphics > outputed such as the rectangles I mentioned before with different >

Re: Segmentation fault..

2007-10-06 Thread Bjoern Schliessmann
Abandoned wrote: > I run a my script and 3-4 minutes later give me an error > "segmentation fault". > What is the reason of this error ? The reason is that the process tries to write to a memory address it outside of its allocated segments. Regards, Björn -- BOFH excuse #20: divide-by-zero e

Re: Problem of Readability of Python

2007-10-07 Thread Bjoern Schliessmann
Licheng Fang wrote: > struct nameval { > char * name; >int val; > } a; > > a.name = ... > a.val = ... > > becomes cryptic > > a[0] = ... > a[1] = ... ?! (1) a = {} a["name"] = ... a["val"] = ... (2) NAME = 0 VAL = 1 a=[] a[NAME] = ... a[VAL] = ... > Python Tutorial says an empty cla

Re: Problem of Readability of Python

2007-10-10 Thread Bjoern Schliessmann
Kevin wrote: > Am I missing something, or am I the only one who explicitly > declares structs in python? Yes -- you missed my posting :) Regards, Björn -- BOFH excuse #209: Only people with names beginning with 'A' are getting mail this week (a la Microsoft) -- http://mail.python.org/mailm

Re: I'm starting to think like a Pythonista

2007-10-10 Thread Bjoern Schliessmann
brad wrote: > low_odds = [1,3,5,7,9] > # make a list containing 10 - 98 evens only > big_evens = big_evens = [x for x in list(xrange(99)) if x % 2 == > 0 and x >8] Why use xrange if you convert it to a full list in place? No advantage there. Regards, Björn -- BOFH excuse #300: Digital Manipu

Re: I'm starting to think like a Pythonista

2007-10-11 Thread Bjoern Schliessmann
brad wrote: > Bjoern Schliessmann wrote: >> Why use xrange if you convert it to a full list in place? No >> advantage there. > > What is the dis-advantage of using xrange over range in this > circumstance? Hardly any, but honestly: Converting it to a list manually

Re: Problem of Readability of Python

2007-10-11 Thread Bjoern Schliessmann
Steven Bethard wrote: > Actually, your posting just used dicts normally. > > Kevin is creating a prototype dict with a certain set of keys, and > then copying that dict and filling in the keys each time he > creates a new instance. It's basically a poor man's OOP. And operatively, IMHO, there is

Re: test if email

2007-10-13 Thread Bjoern Schliessmann
Martin Marcher wrote: > No need to speek of plus addressing or older messaging systems. But don't disallow a plus in the localpart. Many do. Regards, Björn -- BOFH excuse #180: ether leak -- http://mail.python.org/mailman/listinfo/python-list

Re: Normalize a polish L

2007-10-15 Thread Bjoern Schliessmann
Thorsten Kampe wrote: > The 'L' is actually pronounced like the English "w"... '?' originally comes from "L" () and is AFAIK transcribed so. Also, a friend of mine writes himself "Lukas" (pronounced L-) even though in Polish his name is ?ukas (short Wh-). Regard

Re: Normalize a polish L

2007-10-15 Thread Bjoern Schliessmann
Thorsten Kampe wrote: > Why do you try to use characters in a character set that does not > contain these characters? That doesn't make any sense. I thought KNode was smart enough to switch to UTF-8; obviously, it isn't. Regards, Björn -- BOFH excuse #121: halon system went off and killed t

Re: Normalize a polish L

2007-10-15 Thread Bjoern Schliessmann
Thorsten Kampe wrote: > The 'L' is actually pronounced like the English "w"... '?' originally comes from "L" () and is AFAIK transcribed so. Also, a friend of mine writes himself "Lukas" (pronounced L-) even though in Polish his name is Łukas (short Wh-). Regard

Re: IDLE and opening with Python 2.5

2007-10-16 Thread Bjoern Schliessmann
Tony Mullen wrote: > Python itself seems to work. If I click python.exe it runs. > However, it does not appear in my start menu You could create the links yourself. Or reinstall Python 2.5.1. > and I cannot set it as the default application to open .py files. That's a problem of your OS. But

Re: Why does the message send only once?

2007-10-16 Thread Bjoern Schliessmann
danfolkes wrote: > Why does the message send only once? Because your server is designed to only accept one connection, wait forever except there is an exception, and quit thereafter. > def Server(address): > [...] > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > s.bind((HOST

Re: Noob questions about Python

2007-10-17 Thread Bjoern Schliessmann
Ixiaus wrote: > val = 'string' > li = list(val) > print li.reverse() > > returns nothing, but, Yes -- li.reverse() returns None. "print None" prints nothing. > val = 'string' > li = list(val) > li.reverse() > print li > > returns what I want. I'm afraid not. li.reverse() still returns None,

Re: negative base raised to fractional exponent

2007-10-17 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Thank you for this. Now I need to somehow express this as a real > number. For example, I can transform the real and imaginary parts > into a polar coordinate giving me the value I want: > > z = sqrt( real_part**2 + imaj_part**2 ) > > but this is an absolute terms.

Re: vote for Python - PLEASE

2007-10-19 Thread Bjoern Schliessmann
Monty Taylor wrote: > MySQL has put up a poll on http://dev.mysql.com asking what your > primary programming language is. Even if you don't use MySQL - > please go stick in a vote for Python. I'm constantly telling folks > that Python needs more love, but PHP and Java are kicking our > butts... I

Re: write whitespace/tab to a text file

2007-10-19 Thread Bjoern Schliessmann
dirkheld wrote: > f=open('/User/home/Documents/programming/python/test.txt','w') > for x in range(len(names)): > f.write(tags[x]) > f.close() Definitely consider the Python tutorial. Also, please provide working code examples. I don't think yours will work ;) names = ['John','St

Re: Need some help with my first Twisted program

2007-10-20 Thread Bjoern Schliessmann
McCann, Brian wrote: > I posted this to the Twisted list...figured I'd try here too. Didn't you get an answer? The cracks for special topics are usually there. > to work right. Looking through the API docs I found > "connectionLost()", which I put in my protocol class (EchoProtocol > in the ex

Re: vote for Python - PLEASE

2007-10-20 Thread Bjoern Schliessmann
Steven D'Aprano wrote: > It's an Internet poll. By definition, the results are meaningless. Regrettably, there are many people that don't share your definition. Also, why would there be telephone votings in TV if they were meaningless to the default watcher? :) Regards, Björn -- BOFH excuse

Re: vote for Python - PLEASE

2007-10-20 Thread Bjoern Schliessmann
Diez B. Roggisch wrote: > Bjoern Schliessmann schrieb: >> Also, why would there be telephone votings in TV if they were >> meaningless to the default watcher? :) > > Because it costs 50cent to call, which makes a useless and most of > the time heavily biased poll a nice

Re: building a linux executable

2007-10-24 Thread Bjoern Schliessmann
Prateek wrote: > I'm trying to package my python program into a linux executable > using cx_freeze. The goal is that the user should require python > on their system. > > I've managed to make the binaries on Fedora Core 6 and they run > fine. However, when I move to Ubuntu (tested on Ubuntu Serve

Re: Python Windows Installation

2007-10-24 Thread Bjoern Schliessmann
TheFlyingDutchman wrote: > I am trying to install Python 2.5 on Windows XP. It installs into > the root directory on C:\ instead of C:\Python25 BTW, what exactly is behind the idea to install to c:\python25 instead of %PROGRAMFILES%\python25? Regards, Björn -- BOFH excuse #339: manager in t

Re: Better writing in python

2007-10-24 Thread Bjoern Schliessmann
Alexandre Badez wrote: > I'm just wondering, if I could write a in a "better" way this code > [...] > I think there is a better way, but I can't see how... What's "better" for you? Shorter? More performant? More readable? Complying with best practice? Closely following a specific programming parad

Re: building a linux executable

2007-10-24 Thread Bjoern Schliessmann
Paul Boddie wrote: > It's not usually the absence of Python that's the problem. What if > your application uses various extension modules which in turn rely > on various libraries (of the .so or .a kind)? It may be more > convenient to bundle all these libraries instead of working out > the package

Re: building a linux executable

2007-10-25 Thread Bjoern Schliessmann
Paul Boddie wrote: > Any suggestions, then? ;-) Not really; I've got a vaguely similar problem myself -- several Debian systems with Python 2.4 and Python 2.5. But modules I need (wxWidgets 2.8 and Twisted) aren't available as Python 2.5 packages for Debian, so I'm stuck with 2.4. Packages from un

Re: Python Windows Installation

2007-10-25 Thread Bjoern Schliessmann
Dennis Lee Bieber wrote: > Besides preferring an install path that doesn't have spaces... Which I don't understand (works best for me, and is best practice in Windows). > On a proper XP (or later) system, one needs ADMIN privileges to > install/modify the contents of %PROGRAMFILES%. Any user can

Re: Python Windows Installation

2007-10-26 Thread Bjoern Schliessmann
Wildemar Wildenburger wrote: > Bjoern Schliessmann wrote: >> Which I don't understand (works best for me, and is best practice >> in Windows). > > Best practice? Says who? Ok, LOL. So, now you expect me to cite some official source? Despite the fact that the vast majo

Re: Python Windows Installation

2007-10-26 Thread Bjoern Schliessmann
Wildemar Wildenburger wrote: > Of course, but that would constitute "common practice". Ah, okay. That was what I actually meant ;) > "Best practice" in my book is the one that causes the least > trouble, which names-with-whitespace clearly don't. Though by this > day and age, I admit that progr

Re: Python Windows Installation

2007-10-26 Thread Bjoern Schliessmann
Fuzzyman wrote: > However I did once use a machine where Python had been installed > into 'c:\Program Files\Python24'. It caused no end of problems... What, "it"? The machine or the folder? What kinds of problems? Regards, Björn -- BOFH excuse #170: popper unable to process jumbo kernel --

Re: A Python 3000 Question

2007-10-29 Thread Bjoern Schliessmann
brad wrote: > One of the criticisms of Python compared to other OO languages is > that it isn't OO enough or as OO as others or that it is > inconsistent. If OO meant "everything must be a method" then yes, Python wasn't OO. > And little things such as this seem to support those > arguments. No

Re: A Python 3000 Question

2007-10-29 Thread Bjoern Schliessmann
brad wrote: > a_string.list() instead of list(a_string) A string can be stripped, "lowercased" or split, but why should it be able to be "listed"? IMHO, list is a conversion function to make a list from something. >> And to answer the question. In OO programming generic functions >> are no less

Re: py2exe (or other exe builder) on Vista system for Vista/XP install targets.

2007-10-31 Thread Bjoern Schliessmann
Michael wrote: [py2exe on Vista and XP] > When I attempt to run, I get "The procedure entry point > _except_handler4_common could not be located in the dynamic link > library mscvrt.dll." Apparently vista has one more > _except_handler#_common function than XP does. Strange -- it works for me. I

Re: marshal vs pickle

2007-10-31 Thread Bjoern Schliessmann
Evan Klitzke wrote: > Can anyone elaborate more on the difference between marshal and > pickle. In what conditions would using marshal be unsafe? If one > can guarantee that the marshalled objects would be created and > read by the same version of Python, is that enough? Just use pickle. From the

Re: new style class

2007-11-02 Thread Bjoern Schliessmann
Wildemar Wildenburger wrote: > Bjoern Schliessmann wrote: >> No, since everyone's crystal balls are in repair. > > I don't even have crystal balls! Not many are rich *and* impotent. :) Regards, Björn -- BOFH excuse #14: sounds like a Windows problem, try

Re: python newbie

2007-11-02 Thread Bjoern Schliessmann
Please use a more informative subject next time. Jim Hendricks wrote: > 1) global vars - python sets scope to the block a var is declared > (1st set), http://docs.python.org/ref/global.html I'm afraid not. Python only interprets the listed name(s) as globals. > I see the global keyword that al

Re: new style class

2007-11-02 Thread Bjoern Schliessmann
gert wrote: > oops the code is like this but doesn't work For sake of the god of your choice, please always provide runnable code as well as hints to - what you think it should do - what you want it to do - what exact error message(s) you get NOT just "it doesn't work". Regards, Björn --

Re: new style class

2007-11-02 Thread Bjoern Schliessmann
gert wrote: > Could not one of you just say "@staticmethod" for once damnit :) No, since everyone's crystal balls are in repair. Regards, Björn -- BOFH excuse #256: You need to install an RTFM interface. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about compiling.

2007-01-10 Thread Bjoern Schliessmann
Steven W. Orr wrote: > I *just* read the tutorial so please be gentle. I created a file > called fib.py which works very nicely thank you. When I run it it > does what it's supposed to do but I do not get a resulting .pyc > file. .pyc files are created only if you import a .py file. Regards,

Re: Read from database, write to another database, simultaneously

2007-01-10 Thread Bjoern Schliessmann
Sean Davis wrote: > The author of one of the python database clients mentioned that > using one thread to retrieve the data from the oracle database and > another to insert the data into postgresql with something like a > pipe between the two threads might make sense, keeping both IO > streams bus

Re: Learning Python book, new edition?

2007-01-11 Thread Bjoern Schliessmann
Demel, Jeff wrote: > Does anyone know if there's a plan in the works for a new edition > of Learning Python? The current edition (2nd) is a few years old > and looks like it only covers Python 2.3. IIRC, differences to 2.4 are in it, too. > This email is intended only for the individual or enti

Re: What about this?

2007-01-11 Thread Bjoern Schliessmann
new wrote: > www.magicoz.com > amazing Yeah, it *is* really amazing that someone dares to spam for such an unprofessional homepage. Even too stupid to include a doctype ... Björn -- BOFH excuse #61: not approved by the FCC -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the idiom for copy lots of params into self?

2007-01-11 Thread Bjoern Schliessmann
Emin wrote: > Thanks for your suggestions. One issue with using *args or **kw is > that I might no want to copy all the arguments to __init__ into > self. Try prepending something like allowedParms = ("spam", "eggs", "yum") args = dict([key,val for key,val in args.elements() if key in allowedPar

Re: Read from database, write to another database, simultaneously

2007-01-11 Thread Bjoern Schliessmann
Laurent Pointal wrote: > Not so sure, there is low CPU in the Python script, Yes. > but there may be CPU+disk activity on the database sides [with > cache management and other optimizations on disk access]. That's it. So data queues up on the database side and you won't get much value from fake

Re: Read from database, write to another database, simultaneously

2007-01-11 Thread Bjoern Schliessmann
Sean Davis wrote: > I solved this problem by creating a temporary file as an > intermediary, but why wait for Oracle to finish dumping data when > I can potentially be loading into postgres at the same time that > the data is coming in? So, I am actually > looking for a solution to this problem

<    1   2   3   4   5   6   >