Re: tkinter for my python program !!

2008-07-22 Thread karthikbalaguru
On Jul 22, 7:11 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > karthikbalaguru wrote: > > On Jul 22, 6:32 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> karthikbalaguru wrote: > >> > Hi, > > >> > One of my python program needs tkinter to be installed to run > >> > successfully. > >> >

Re: xpathEval fails for large files

2008-07-22 Thread Stefan Behnel
Kanch wrote: > Original file was 18MB, and contained 288328 element attributes for > the particular path. You didn't say how many elements there are in total, but I wouldn't expect that to be a problem, unless you have very little free memory (say, way below 256MB). I just tried with lxml 2.1 and

Proper way to query user and group database on a Unix host?

2008-07-22 Thread Mike MacCana
Hi folks, What's the proper way to query the passwd and group database on a Unix host? I'd like to fetch the users in a group (obviously from name services), but my many varied searches can't find any reference of someone ever looking up users on a Unix system, just NT. Weird, I know. Currently

Re: xpathEval fails for large files

2008-07-22 Thread Kanch
On Jul 23, 2:03 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > Kanchana wrote: > > >> I tried to extract some data with xpathEval. Path contain more than > >> 100,000 elements. > > >> doc = libxml2.parseFile("test.xml") > >> ctxt = doc.xpathNewContext() > >> result = ctxt.x

Re: Python Written in C?

2008-07-22 Thread Tim Roberts
Larry Bates <[EMAIL PROTECTED]> wrote: > >I just learned something I did not know. I was under the impression that they >translated directly to machine code without ever actually generating Assembler >text files. Some do, some don't. It's an implementation chioce. gcc generates a text file

Re: interpreter vs. compiled

2008-07-22 Thread Tim Roberts
castironpi <[EMAIL PROTECTED]> wrote: > >You're saying the VM can't compile code. That makes sense, it's not a >compiler. I wouldn't say "can't". The current CPython VM does not compile code. It COULD. The C#/.NET VM does. IronPython, for example, is an implementation of Python that uses .NET

How to replace the values with keys ?

2008-07-22 Thread Graps Graps
Hi all, I am a newbie to python... I have two text files text1 and text2. Text1 is a tabbed separated file, say like a b a c a d a g b c b d b h c d c h... and so on.. Text2 is a python dictionary containing data as {0: 'a', 1: 'b', 2: 'c'...} now I want the data in text1 to be replaced with t

Re: Question about inheritence

2008-07-22 Thread Scott David Daniels
Fredrik Lundh wrote: Catherine Heathcote wrote: If I create a new class inherited from another with a constructor, what happens with the new class's constructer? Python doesn't really have constructors; when you create an object, Python first creates the object and then calls the __init__ meth

Re: Python Written in C?

2008-07-22 Thread Grant Edwards
On 2008-07-23, Larry Bates <[EMAIL PROTECTED]> wrote: >> Since you probably need an assembler anyway, generating >> assembly-language in the compiler prevents you from having to >> duplicate a bunch of object-code-generation code in two places. > > I'm not sure I understand what you mean here. Th

Re: fromfile error on windows, not mac

2008-07-22 Thread Scott David Daniels
jadamwil wrote: On Jul 22, 2:05 am, Uwe Schmitt <[EMAIL PROTECTED]> wrote: jadamwil schrieb: Hello, I am using the numpy fromfile function to read binary data from a file on disk. The problem is that the program runs fine on a Mac, but gives an error or warning on windows when trying to read

Re: Python Written in C?

2008-07-22 Thread Larry Bates
Marc 'BlackJack' Rintsch wrote: On Mon, 21 Jul 2008 18:12:54 +0200, mk wrote: Seriously, though, would there be any advantage in re-implementing Python in e.g. C++? Not that current implementation is bad, anything but, but if you're not careful, the fact that lists are implemented as C array

Re: Python Written in C?

2008-07-22 Thread Larry Bates
Grant Edwards wrote: On 2008-07-22, Larry Bates <[EMAIL PROTECTED]> wrote: Grant Edwards wrote: On 2008-07-22, Larry Bates <[EMAIL PROTECTED]> wrote: You talk about "writing it in assembly language for each MPU chip". Actually it is even better than that. We now have these modern inventions

Re: sys.stderr.write returns string length in Python 3

2008-07-22 Thread Alan G Isaac
Benjamin wrote: http://www.python.org/dev/peps/pep-3116/. Thanks. Can you give me an example of using the returned value? Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a valid use of 'import'?

2008-07-22 Thread Benjamin
On Jul 22, 12:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > > *Python2 has a built-in reload function, but in 3.0 it is removed > because it almost never did what people wanted or expected and thus lead > to surprising bugs.  You can delete a module from sys.modules and > re-import it, but the mo

Re: sys.stderr.write returns string length in Python 3

2008-07-22 Thread Benjamin
Alan G Isaac wrote: > Is this new behavior intentional? :: Yes, it's in the PEP http://www.python.org/dev/peps/pep-3116/. > > >>> sys.stderr.write("thisisatest\n") > thisisatest > 12 > > Here is the reason for it: > > >>> help(sys.stderr.write) > Help on method writ

OT: OT posts [was Re: proliferation of computer languages]

2008-07-22 Thread Joshua Cranmer
[EMAIL PROTECTED] wrote: • many says i'm posting off topic posts. In recent years they start to say i'm posting tangentially relevant posts. That's not correct. In fact, there are huge number of blatantly off-topics posts by regulars that spawn off from threads, happens regularly. The topics va

Re: Python Embedding Thread

2008-07-22 Thread Jaimy Azle
<[EMAIL PROTECTED]> wrote: > I fixed the code. This code snippet runs in a seperate thread: > > > PyObject *dict=NULL; > PyGILState_STATE state = PyGILState_Ensure(); > dict = CreateMyGlobalDictionary(); > > PyRun_String(, Py_file_input, dict, dict); > > ReleaseGlobalDictionary(dict); > > But it s

Re: fromfile error on windows, not mac

2008-07-22 Thread jadamwil
On Jul 22, 8:35 am, jadamwil <[EMAIL PROTECTED]> wrote: > On Jul 22, 2:05 am, Uwe Schmitt <[EMAIL PROTECTED]> > wrote: > > > > > jadamwil schrieb: > > > > Hello, > > > I am using the numpy fromfile function to read binary data from a file > > > on disk. The problem is that the program runs fine on

Re: How do I compare files?

2008-07-22 Thread Larry Bates
Clay Hobbs wrote: I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this done? -- Ratfink Use md5 to calculate checksum: import md5 md5file1 = md5.md5(open(fi

Re: proliferation of computer languages

2008-07-22 Thread [EMAIL PROTECTED]
over the past 5 years there are some negative remarks on me or my posts. I have almost never responded to any of them. Here i want to clarify a few things. • I seldomly write off-topic posts. For example, any argument about netiquette, i consider off-topic, including defense such as what i'm doi

Re: Function editing with Vim throws IndentError

2008-07-22 Thread Asun Friere
On Jul 23, 7:02 am, ptn <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I have a weird problem. Say I have a .py file with some functions in > it, like this: > > # (...) > def foo(): > print("bar") > > When I open it and add a line to one of the functions, > > # (...) > def

Re: Python Written in C?

2008-07-22 Thread Scott David Daniels
Erik Max Francis wrote: Ethan Furman wrote: Iain King wrote: The story of a Real Programmer: http://www.pbm.com/~lindahl/mel.html Iain Wow. Awesome story. If my google-fu is up to snuff, these are "screenshots" (scans of printouts) of the actual blackjack game in operation: http://

Re: Python Written in C?

2008-07-22 Thread Michiel Overtoom
giveitawhril2008 wrote... > I think someone should write a compiler, "Revenge of BASIC." Your remark made an immediate association with me with the following soundtrack: http://www.empire-of-the-claw.com/files/Empire%20of%20The%20Claw%20-%20Tranc e%20of%20the%2080's%20Arcade.mp3 "A creature for

Re: software engineering foundations?

2008-07-22 Thread Skip Montanaro
> just get McConnell's "Code Complete": > > http://www.cc2e.com/ Thanks Fredrik. It looks interesting. I just bought a copy online and will skim it myself before passing it along to Chris. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I compare files?

2008-07-22 Thread Matimus
On Jul 22, 4:27 pm, Clay Hobbs <[EMAIL PROTECTED]> wrote: > I am making a program that (with urllib) that downloads two jpeg files > and, if they are different, displays the new one.  I need to find a way > to compare two files in Python.  How is this done? > > -- Ratfink Do you just want to check

Re: How do I compare files?

2008-07-22 Thread norseman
Timothy Grant wrote: On Tue, Jul 22, 2008 at 4:27 PM, Clay Hobbs <[EMAIL PROTECTED]> wrote: I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this done? -- Ratf

Re: How do I compare files?

2008-07-22 Thread GHZ
On Jul 23, 1:27 am, Clay Hobbs <[EMAIL PROTECTED]> wrote: > I am making a program that (with urllib) that downloads two jpeg files > and, if they are different, displays the new one.  I need to find a way > to compare two files in Python.  How is this done? > > -- Ratfink import hashlib file = op

Re: How do I compare files?

2008-07-22 Thread Timothy Grant
On Tue, Jul 22, 2008 at 4:27 PM, Clay Hobbs <[EMAIL PROTECTED]> wrote: > I am making a program that (with urllib) that downloads two jpeg files > and, if they are different, displays the new one. I need to find a way > to compare two files in Python. How is this done? > > -- Ratfink > > -- > htt

How do I compare files?

2008-07-22 Thread Clay Hobbs
I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this done? -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list

http server class that lets me open socket?

2008-07-22 Thread mh
I'm writing a select-based server, and some of the client connections will want to send an xml-rpc request. Is there a class in the http hierarchy that will allow me to manage a socket, and allow me to instantiate the class like myhttpserver = SomeHTTPServer(mysocket) and then let me call so

Re: How to match word boundary?

2008-07-22 Thread Fredrik Lundh
Peng Yu wrote: I would like to match "a::" in "a::b", but not in "a:: b". That is, the character after "::" should be a alphanumeric character. sounds like a look-ahead assertion is what you need: >>> import re >>> re.match("\w::(?=\w)", "a::b") <_sre.SRE_Match object at 0x01442138> >>> _.gro

How to match word boundary?

2008-07-22 Thread Peng Yu
Hi, I use r"\ba\b" to match "a". However, I can not use "\ba::\b" to match "a::b". I would like to match "a::" in "a::b", but not in "a:: b". That is, the character after "::" should be a alphanumeric character. Could you let me know how to do it and why "\b" would not work? Thanks, Peng -- http

Re: proliferation of computer languages

2008-07-22 Thread szr
Grant Edwards wrote: > On 2008-07-22, szr <[EMAIL PROTECTED]> wrote: >> J?rgen Exner wrote: >>> Chris Rathman <[EMAIL PROTECTED]> wrote: >>> I can't say that I see any particular point to the essay. >>> >>> You must be new here. There never is any particular point to >>> Xah Lee's rantings exc

Re: Bidirectional Generators

2008-07-22 Thread Paddy
On Jul 22, 10:07 pm, william tanksley <[EMAIL PROTECTED]> wrote: > Okay, I'm almost finished with my first bidirectional generator. By > "almost finished" I mean both that it's almost working, and that I'm > almost about to replace it with a class that works a bit more like > what I currently under

Re: Function editing with Vim throws IndentError

2008-07-22 Thread Timothy Grant
On Tue, Jul 22, 2008 at 2:02 PM, ptn <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I have a weird problem. Say I have a .py file with some functions in > it, like this: > ># (...) >def foo(): >print("bar") > > When I open it and add a line to one of the functions, > ># (...)

Re: Iterating Through List or Tuple

2008-07-22 Thread Samir
Fredrik, Marc, Larry -- Thank you all for your very fast and informative replies. I had not come across "itertools" in my search. This group is a great resource. Samir -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating Through List or Tuple

2008-07-22 Thread Larry Bates
Samir wrote: Is there a way to loop or iterate through a list/tuple in such a way that when you reach the end, you start over at the beginning? For example, suppose I define a list "daysOfWeek" such that: daysOfWeek = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturda

Re: Iterating Through List or Tuple

2008-07-22 Thread Marc 'BlackJack' Rintsch
On Tue, 22 Jul 2008 14:43:10 -0700, Samir wrote: > Is there a way to loop or iterate through a list/tuple in such a way > that when you reach the end, you start over at the beginning? For > example, suppose I define a list "daysOfWeek" such that: > daysOfWeek = ['sunday', 'monday', 'tuesday

Re: Iterating Through List or Tuple

2008-07-22 Thread Fredrik Lundh
Samir wrote: Is there a way to loop or iterate through a list/tuple in such a way that when you reach the end, you start over at the beginning? For example, suppose I define a list "daysOfWeek" such that: daysOfWeek = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturd

Iterating Through List or Tuple

2008-07-22 Thread Samir
Is there a way to loop or iterate through a list/tuple in such a way that when you reach the end, you start over at the beginning? For example, suppose I define a list "daysOfWeek" such that: >>> daysOfWeek = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', >>> 'friday', 'saturday'] If

Re: Python Written in C?

2008-07-22 Thread Erik Max Francis
Ethan Furman wrote: Iain King wrote: On Jul 21, 6:58 am, "Krishnakant Mane" <[EMAIL PROTECTED]> wrote: First off all c# is absolute rubbish waist of time. if I need to learn it then I better lern java or pythonfor that matter. and by the way what is a "real programmer?" The story of a Rea

Bidirectional Generators

2008-07-22 Thread william tanksley
Okay, I'm almost finished with my first bidirectional generator. By "almost finished" I mean both that it's almost working, and that I'm almost about to replace it with a class that works a bit more like what I currently understand. Surely some other people have worked with this feature... Are the

Re: xpathEval fails for large files

2008-07-22 Thread Stefan Behnel
Fredrik Lundh wrote: > Kanchana wrote: > >> I tried to extract some data with xpathEval. Path contain more than >> 100,000 elements. >> >> doc = libxml2.parseFile("test.xml") >> ctxt = doc.xpathNewContext() >> result = ctxt.xpathEval('//src_ref/@editions') >> doc.freeDoc() >> ctxt.xpathFreeContext

Function editing with Vim throws IndentError

2008-07-22 Thread ptn
Hi everybody, I have a weird problem. Say I have a .py file with some functions in it, like this: # (...) def foo(): print("bar") When I open it and add a line to one of the functions, # (...) def foo(): troz = "bar" print(troz) I get the following trac

Re: software engineering foundations?

2008-07-22 Thread Fredrik Lundh
Paddy wrote: This course is an intensive introduction to basic software development practices for scientists and engineers that can reduce the time they spend programming by 20-25%. Judging from the table of contents and a quick sampling of a few lectures, that's mostly about programming (wit

Re: proliferation of computer languages

2008-07-22 Thread Grant Edwards
On 2008-07-22, szr <[EMAIL PROTECTED]> wrote: > J?rgen Exner wrote: >> Chris Rathman <[EMAIL PROTECTED]> wrote: >> >>> I can't say that I see any particular point to the essay. >> >> You must be new here. There never is any particular point to >> Xah Lee's rantings except to cross-post borderline t

Re: software engineering foundations?

2008-07-22 Thread Paddy
On Jul 22, 7:52 pm, [EMAIL PROTECTED] wrote: > Sorry for the off-topic-ish post.  My son (a fairly junior sysadmin type) > mentioned to me today that he was looking for online courses for Perl.  (I > don't hold that against him.  Perl is still a lingua franca in the sysadmin > realm.)  In my work I

Re: regarding SWIG

2008-07-22 Thread Stefaan Himpe
Hi.. I'm new to SWIG and need to create Wrapper for C code, so, I have installed the SWIG already but doesnot know how to run it for generating Interface file... As far as I understand, SWIG will not generate an interface file for you. You have to write it yourself, to tell SWIG what parts of y

Re: The Importance of Terminology's Quality

2008-07-22 Thread John W Kennedy
Rob Warnock wrote: Thunks were something used by Algol 60 *compiler writers* in the code generated by their compilers to implement the semantics of Algol 60 call-by-name, but were not visible to users at all [except that they allowed call-by-name to "work right"]. ...unless you were a system pr

Re: proliferation of computer languages

2008-07-22 Thread cartercc
On Jul 18, 1:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Today, i took sometime to list some major or talked-about langs that > arose in recent years. You missed PowerShell and ActionScript. Languages are just tools. It may have escaped your notice, but it's a remarkable fact that no

Re: The Importance of Terminology's Quality

2008-07-22 Thread John W Kennedy
Martin Gregorie wrote: I used Algol 60 on an Elliott 503 and the ICL 1900 series back when it was a current language. The term "thunking" did not appear in either compiler manual nor in any Algol 60 language definition I've seen. It doesn't have to; Algol 60 thunks are not part of the language.

Re: software engineering foundations?

2008-07-22 Thread Fredrik Lundh
Fredrik Lundh wrote: just get McDonnell's "Code Complete": http://www.cc2e.com/ McConnell, that is. McConnell. sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: software engineering foundations?

2008-07-22 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Sorry for the off-topic-ish post. My son (a fairly junior sysadmin type) mentioned to me today that he was looking for online courses for Perl. (I don't hold that against him. Perl is still a lingua franca in the sysadmin realm.) In my work I have from time-to-time h

Re: scanf in python

2008-07-22 Thread AMD
AMD wrote: I had seen this pure python implementation, but it is not as fast or as elegant as would be an implementation written in C directly within python with no need for import. maybe you should wait with disparaging comments about how Python is not what you want it to be until you've

Re: CPython VM internals - Wiki page

2008-07-22 Thread Martin v. Löwis
> That's interesting. It's dumber than I thought. All temporaries > on the stack are "boxed" as PyObjects. That's simple and portable, > but slow. Not only that - Python does not ever have the concept of unboxed values, except for local variables in the C implementations of arithmetic operat

Re: proliferation of computer languages

2008-07-22 Thread szr
Jürgen Exner wrote: > Chris Rathman <[EMAIL PROTECTED]> wrote: > >> I can't say that I see any particular point to the essay. > > You must be new here. There never is any particular point to Xah > Lee's rantings except to cross-post borderline topics to borderline > relevant NGs and then lay back

software engineering foundations?

2008-07-22 Thread skip
Sorry for the off-topic-ish post. My son (a fairly junior sysadmin type) mentioned to me today that he was looking for online courses for Perl. (I don't hold that against him. Perl is still a lingua franca in the sysadmin realm.) In my work I have from time-to-time had to pick up and maintain

Re: CPython VM internals - Wiki page

2008-07-22 Thread John Nagle
Terry Reedy wrote: Various people have asked on c.l.p about documentation of CPython's virtual machine internals. The usual answers have been to see the dis module doc for bytecodes and 'read the code' for more. Jakob Sievers did so and posted his notes, with additions from Martin v. Löwis, a

CPython VM internals - Wiki page

2008-07-22 Thread Terry Reedy
Various people have asked on c.l.p about documentation of CPython's virtual machine internals. The usual answers have been to see the dis module doc for bytecodes and 'read the code' for more. Jakob Sievers did so and posted his notes, with additions from Martin v. Löwis, as http://wiki.pyth

sys.stderr.write returns string length in Python 3

2008-07-22 Thread Alan G Isaac
Is this new behavior intentional? :: >>> sys.stderr.write("thisisatest\n") thisisatest 12 Here is the reason for it: >>> help(sys.stderr.write) Help on method write in module io: write(self, s: str) method of io.TextIOWrapper instance Thank you,

Re: The Importance of Terminology's Quality

2008-07-22 Thread Grant Edwards
On 2008-07-22, Steve Schafer <[EMAIL PROTECTED]> wrote: > On Tue, 22 Jul 2008 10:21:50 +0100, Martin Gregorie ><[EMAIL PROTECTED]> wrote: > >>The first time I ran across the term "thunking" was when Windows 3 >>introduced the Win32S shim and hence the need to switch addressing between >>16 bit and

Re: Authentication for XML-RPC Calls

2008-07-22 Thread Larry Bates
whitemice wrote: The only documentation regarding doing authentication for XML-RPC I can find is - "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP Basic Authentication: http://user:[EMAIL PROTECTED]:port/path. The user:pass portion will be base64-encoded as an HTTP

Re: Question about admin rights and IDLE

2008-07-22 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Hi All, Apologies in advance for a potentially redundant posting -- I sent a similar question to the help box yesterday. I have a Geographic Info System (GIS) user that is having problems editing with Python IDLE on a WindowsXP machine unless she has admin rights. I

Re: Hello,who can help me!

2008-07-22 Thread James Matthews
I would recommended on asking on the pywin32 mailing list. On Tue, Jul 22, 2008 at 2:26 AM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > I have implemented a C++ COM,which contains two interface in one > > coclass. > > when i use this COM in python: > > dll=win32co

Re: Not entirely serious: recursive lambda?

2008-07-22 Thread Paul McGuire
On Jul 22, 11:52 am, Michael Tobis <[EMAIL PROTECTED]> wrote: > Thanks all! What a remarkable set of answers, intelligent, thought > provoking and informative without exception. > > Of course, now I can't use Paul's version; it hardly counts as a japh > if someone else wrote it! It is probably the

Authentication for XML-RPC Calls

2008-07-22 Thread whitemice
The only documentation regarding doing authentication for XML-RPC I can find is - "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP Basic Authentication: http://user:[EMAIL PROTECTED]:port/path. The user:pass portion will be base64-encoded as an HTTP `Authorization' hea

Re: Is this a valid use of 'import'?

2008-07-22 Thread Terry Reedy
Frank Millman wrote: I know that when a module is imported the first time, it is 'executed'. This normally entails setting up constants, classes, functions, etc, that you want to make available to the importer. And every time thereafter, the module code is not executed*. So module code sho

Re: Importing different versions of a module

2008-07-22 Thread Fredrik Lundh
mercado mercado wrote: It seems that you can specify the name of the module to be imported at runtime using the following syntax: X = __import__('X') (from http://effbot.org/zone/import-confusion.htm) Of course, I would rather specify the path to the module at runtime, not the module name i

Re: Importing different versions of a module

2008-07-22 Thread mercado mercado
It seems that you can specify the name of the module to be imported at runtime using the following syntax: X = __import__('X') (from http://effbot.org/zone/import-confusion.htm) Of course, I would rather specify the path to the module at runtime, not the module name itself, but at least this is

Re: Not entirely serious: recursive lambda?

2008-07-22 Thread Michael Tobis
Thanks all! What a remarkable set of answers, intelligent, thought provoking and informative without exception. Of course, now I can't use Paul's version; it hardly counts as a japh if someone else wrote it! It is probably the closest to my original vision, alas. Miles' second suggestion was the o

Re: Question about inheritence

2008-07-22 Thread Fredrik Lundh
Catherine Heathcote wrote: If I create a new class inherited from another with a constructor, what happens with the new class's constructer? assuming that you mean "is it called or not?": Python doesn't really have constructors; when you create an object, Python first creates the object and

Re: Question about inheritence

2008-07-22 Thread Jordan
On Jul 22, 12:26 pm, Catherine Heathcote <[EMAIL PROTECTED]> wrote: > If I create a new class inherited from another with a constructor, what > happens with the new class's constructer? > Thanks for your time. Well, the __init__ method of the subclass is called, and from within it you can call the

Re: Question about inheritence

2008-07-22 Thread Catherine Heathcote
On Tue, 22 Jul 2008 09:35:58 -0700, Matimus wrote: > On Jul 22, 9:26 am, Catherine Heathcote > <[EMAIL PROTECTED]> wrote: >> If I create a new class inherited from another with a constructor, what >> happens with the new class's constructer? >> Thanks for your time. > > Nothing, unless you call i

Re: Question about inheritence

2008-07-22 Thread Matimus
On Jul 22, 9:26 am, Catherine Heathcote <[EMAIL PROTECTED]> wrote: > If I create a new class inherited from another with a constructor, what > happens with the new class's constructer? > Thanks for your time. Nothing, unless you call it in your constructor. class Base(object): def __init__(self)

Re: The Importance of Terminology's Quality

2008-07-22 Thread Steve Schafer
On Tue, 22 Jul 2008 10:21:50 +0100, Martin Gregorie <[EMAIL PROTECTED]> wrote: >The first time I ran across the term "thunking" was when Windows 3 >introduced the Win32S shim and hence the need to switch addressing between >16 bit and 32 bit modes across call interfaces. That was called "thunking"

Question about inheritence

2008-07-22 Thread Catherine Heathcote
If I create a new class inherited from another with a constructor, what happens with the new class's constructer? Thanks for your time. -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatically loading and initialising objects from a plugins directory

2008-07-22 Thread Fredrik Lundh
Dave Challis wrote: Thanks for that, it helped as a starting point. I had some trouble with using issubclass though (issubclass(Plugin, Plugin) returns true), which was complicating things. I modified your code to the following instead (which may well have it's own pitfalls I'm not aware of!):

Re: string[i:j:k]

2008-07-22 Thread Terry Reedy
konstantin wrote: Hello, I'm not a newbie in python, but recently faced a problem in simple expression: some_string[i:j:k] What does it mean? I believe this grammar (http://docs.python.org/ref/ slicings.html) describes the syntax. But I can't grasp it. When you post a link, please put it on

Re: convert list of lists to list

2008-07-22 Thread Raymond Hettinger
On Jul 22, 8:25 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > if there's only one level of recursion, and the lists aren't too long, > you can simply do: > >      sum(list_of_lists, []) > > (this has quadratic performance, so don't use it for large structures) For linear performance, you can use

Re: Automatically loading and initialising objects from a plugins directory

2008-07-22 Thread Dave Challis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Diez B. Roggisch wrote: > Dave Challis wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> I'm trying to write some code which: >> 1. Finds all modules in a plugin directory >> 2. Imports those modules >> 3. Creates an instance of each

Re: convert list of lists to list

2008-07-22 Thread Bruno Desthuilliers
antar2 a écrit : Is there a way to convert list_of_listsA to list_of_listsB, where one list in listof lists A is one element of listB? list_of_listsA: [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['koe'], ['arm*', '*', '*(haar)'], ['groei*', '*', '*', '*', '*']] listB: ['klas* * *', 'mooi* *

Re: DB Pool

2008-07-22 Thread John Nagle
bcurtu wrote: Hi, I use MySQLdb lib to access my DB, because I want to optimize my SQL queries. The application I'm working on has quite a few traffic load, so I want to minimize the time of creating/destroying cursors: My typical code is sth like: cursor=con.cursor() cursor.ex

Re: convert list of lists to list

2008-07-22 Thread Fredrik Lundh
Fredrik Lundh wrote: ['klas* * *', 'mooi* * * *, 'koe', 'arm* * * (haar)', 'groei* * * * *'] if there's only one level of recursion, and the lists aren't too long, you can simply do: sum(list_of_lists, []) oops. that's what you get for taking the subject line too literally... -- h

Re: simple question about dictionaries

2008-07-22 Thread Bruno Desthuilliers
skazhy a écrit : hi, i am new to python, so i've a really simple question about dictionaries. if i have a dictionary and I make have an input after it (to input numbers) can i get the key of value that was in input? What if many keys are associated with a same value, ie: d = {'a':100, 'b':200,

Re: convert list of lists to list

2008-07-22 Thread Peter Otten
antar2 wrote: > Is there a way to convert list_of_listsA to list_of_listsB, where one > list in listof lists A is one element of listB? > > list_of_listsA: > [['klas*', '*', '*'], > ['mooi*', '*', '*', '*'], > ['koe'], > ['arm*', '*', '*(haar)'], > ['groei*', '*', '*', '*', '*']] > > listB: > ['

Re: Is this a valid use of 'import'?

2008-07-22 Thread Fredrik Lundh
Frank Millman wrote: I know that when a module is imported the first time, it is 'executed'. This normally entails setting up constants, classes, functions, etc, that you want to make available to the importer. In this particular case, when it is executed, it does a whole lot more. It reads in

Re: Is this a valid use of 'import'?

2008-07-22 Thread Frank Millman
On Jul 22, 5:22 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > Frank Millman wrote: > > In this particular case, when it is executed, it does a whole lot > > more. It reads in some parameters, establishes a socket connection, > > starts a thread, and starts monitoring the socket using select.select. >

Re: Is this a valid use of 'import'?

2008-07-22 Thread Matimus
On Jul 22, 8:12 am, Frank Millman <[EMAIL PROTECTED]> wrote: > Hi all > > I am familiar enough with the normal use of 'import'. However, I have > found a use for it which seems effective, but I have not seen it used > like this before, so I am not sure if there are any downsides. > > I know that wh

Question about admin rights and IDLE

2008-07-22 Thread Murphy . MarkS
Hi All, Apologies in advance for a potentially redundant posting -- I sent a similar question to the help box yesterday. I have a Geographic Info System (GIS) user that is having problems editing with Python IDLE on a WindowsXP machine unless she has admin rights. I had initially thought there

Re: convert list of lists to list

2008-07-22 Thread Stephen Johnson
list_A = [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['koe'], ['arm*', '*', '*(haar)'], ['groei*', '*', '*', '*', '*']] list_B = [] for inner_list in list_A: #join elements of list into a string with separator ' ' list_B.append(' '.join(inner_list)) print list_B Output: ['kl

Re: convert list of lists to list

2008-07-22 Thread Fredrik Lundh
antar2 wrote: Is there a way to convert list_of_listsA to list_of_listsB, where one list in listof lists A is one element of listB? list_of_listsA: [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['koe'], ['arm*', '*', '*(haar)'], ['groei*', '*', '*', '*', '*']] listB: ['klas* * *', 'mooi* *

Re: Is this a valid use of 'import'?

2008-07-22 Thread Tim Golden
Frank Millman wrote: In this particular case, when it is executed, it does a whole lot more. It reads in some parameters, establishes a socket connection, starts a thread, and starts monitoring the socket using select.select. It also exposes some functions that disguise the complexity of reading

Is this a valid use of 'import'?

2008-07-22 Thread Frank Millman
Hi all I am familiar enough with the normal use of 'import'. However, I have found a use for it which seems effective, but I have not seen it used like this before, so I am not sure if there are any downsides. I know that when a module is imported the first time, it is 'executed'. This normally e

convert list of lists to list

2008-07-22 Thread antar2
Is there a way to convert list_of_listsA to list_of_listsB, where one list in listof lists A is one element of listB? list_of_listsA: [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['koe'], ['arm*', '*', '*(haar)'], ['groei*', '*', '*', '*', '*']] listB: ['klas* * *', 'mooi* * * *, 'koe', 'arm*

Re: Best Python packages?

2008-07-22 Thread Ben Sizer
On Jul 19, 5:59 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > In the original post you asked for "hidden gems" and now it seems you > just want to know about Madonna or Justin Timberlake. Not really, and I don't see why you'd say that. > Maybe a look on this collection helps > > http://wiki.pyt

Re: Converting List of String to Integer

2008-07-22 Thread Samir
Wow! Thanks for all of the great additional feedback and responses since I last checked in. The help this group provides is amazing. I'm glad I found it. @Andrew -- Thanks for the clarification on the nested for loop and how to intrepret it. Also, thanks for the information on generators. I ha

Re: tkinter for my python program !!

2008-07-22 Thread Diez B. Roggisch
karthikbalaguru wrote: > On Jul 22, 6:32 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> karthikbalaguru wrote: >> > Hi, >> >> > One of my python program needs tkinter to be installed to run >> > successfully. >> > I am using Redhat 9.0 and hence tried installing by copying the >> > tkinter-2

Re: tkinter for my python program !!

2008-07-22 Thread karthikbalaguru
On Jul 22, 6:32 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > karthikbalaguru wrote: > > Hi, > > > One of my python program needs tkinter to be installed to run > > successfully. > > I am using Redhat 9.0 and hence tried installing by copying the > > tkinter-2.2.2-36.i386.rpm > > alone from t

Re: regarding SWIG

2008-07-22 Thread Hyuga
On Jul 22, 5:34 am, Anish Chapagain <[EMAIL PROTECTED]> wrote: > Hi.. > I'm new to SWIG and need to create Wrapper for C code, > so, I have installed the SWIG already but doesnot know how to run it > for generating Interface file... > My C code is in message.c so what do i need to do the first > st

Re: Python Written in C?

2008-07-22 Thread Ethan Furman
Iain King wrote: On Jul 21, 6:58 am, "Krishnakant Mane" <[EMAIL PROTECTED]> wrote: First off all c# is absolute rubbish waist of time. if I need to learn it then I better lern java or pythonfor that matter. and by the way what is a "real programmer?" The story of a Real Programmer: http://

  1   2   >