Re: What language to manipulate text files

2005-06-12 Thread Roose
Why do people keep asking what language to use for certain things in the Python newsgroup? Obviously the answer is going to biased. Not that it's a bad thing because I love Python, but it doesn't make sense if you honestly want an objective opinion. R ross wrote: > I want to do some tricky te

Re: Dealing with marketing types...

2005-06-12 Thread Kay Schluehr
Drazen Gemic wrote: > With Java I depend very little on customers IT staff, sysadmins, etc. If > I need additional functionality in form library, extension, whatever, all > I need is to drop another JAR in, and that does it. Maybe this is for you? http://peak.telecommunity.com/DevCenter/PythonEg

Re: What language to manipulate text files

2005-06-12 Thread Michael Hoffman
ross wrote: > I want to do some tricky text file manipulation on many files, but have > only a little programming knowledge. > > What are the ideal languages for the following examples? > > 1. Starting from a certain folder, look in the subfolders for all > filenames matching *FOOD*.txt Any files

Streaming Data Error in .read() (HTTP/ICY) Possible Bug?

2005-06-12 Thread MyHaz
I playing around with streaming shoutcast mp3s. Here is some sample code: --- import httplib # Put together the headers headers = {"Icy-MetaData":"1"} con = httplib.HTTPConnection('64.142.8.154', 8000) con.request("GET", "/") stream = con.getresponse() print str

Re: What is different with Python ?

2005-06-12 Thread Mike Meyer
John Machin <[EMAIL PROTECTED]> writes: > Roy Smith wrote: >> "Philippe C. Martin" <[EMAIL PROTECTED]> wrote: >>>Yet, many issues that a future software engineer should know are >>>mostly hidden by Python (ex: memory management) and that could be >>>detrimental. >> I know I'm going out on a limb by

Re: Python Developers Handbook - Mistake done and corrected.

2005-06-12 Thread wooks
I am not mistaken at all and the use of hyperbole (2 billion) doesn't make your point . A post that piques the interest of even 50 people in an NG is a valid one. No doubt some people would be annoyed about a job posting of a Python vacancy... others would be interested in it... The original

Re: Streaming Data Error in .read() (HTTP/ICY) Possible Bug?

2005-06-12 Thread gideondominick
I should purhaps mention that i am basically trying to translate this. nc ~= telnet #!/bin/sh nc sc1.liquidviewer.com 9012

Re: Dealing with marketing types...

2005-06-12 Thread Mike Meyer
Andrew Dalke <[EMAIL PROTECTED]> writes: > Paul Rubin replied to me: >> As for "big", hmm, I'd say as production web sites go, 100k users is >> medium sized, Slashdot is "largish", Ebay is "big", Google is huge. > I'ld say that few sites have >100k users, much less > daily users with personalized i

Re: case/switch statement?

2005-06-12 Thread Steven D'Aprano
On Sat, 11 Jun 2005 19:47:58 -0500, Skip Montanaro wrote: > If the case values are constants known to the compiler, it can generate O(1) > code to take the correct branch. (In fact, that could be done by the > compiler for if statements such as in your example today. It just isn't.) > It is prec

subprocess module and blocking

2005-06-12 Thread Robin Becker
I'm using a polling loop in a thread that looks approximately like this while 1: p = find_a_process() rc = p.poll() if rc is not None: out, err = p.communicate() #deal with output etc sleep(1) the process p is opened using p = Popen(cmd, stdin=PIPE, stdout=P

Re: case/switch statement?

2005-06-12 Thread invalidemail
Philippe C. Martin wrote: > Leif K-Brooks wrote: > > > Joe Stevenson wrote: > >> I skimmed through the docs for Python, and I did not find anything like > >> a case or switch statement. I assume there is one and that I just > >> missed it. Can someone please point me to the appropriate document,

Re: Best Web dev language

2005-06-12 Thread Mike Meyer
"John Roth" <[EMAIL PROTECTED]> writes: > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> "Jon Slaughter" <[EMAIL PROTECTED]> writes: >> >> Someone mentioned that you might "require JavaScript on the client >> side". I recommend against that - people and organizations

Re: What language to manipulate text files

2005-06-12 Thread ross
Roose wrote: > Why do people keep asking what language to use for certain things in the > Python newsgroup? Obviously the answer is going to biased. > > Not that it's a bad thing because I love Python, but it doesn't make sense > if you honestly want an objective opinion. > > R What usenet group

How to get/set class attributes in Python

2005-06-12 Thread Kalle Anke
I'm coming to Python from other programming languages. I like to hide all attributes of a class and to only provide access to them via methods. Some of these languages allows me to write something similar to this int age( ) { return theAge } void age( x : int ) { theAge = x } (I usually do m

Re: How to get/set class attributes in Python

2005-06-12 Thread Steve Jorgensen
On Sun, 12 Jun 2005 11:54:52 +0200, Kalle Anke <[EMAIL PROTECTED]> wrote: >I'm coming to Python from other programming languages. I like to >hide all attributes of a class and to only provide access to them >via methods. Some of these languages allows me to write something >similar to this > >int

unittest: collecting tests from many modules?

2005-06-12 Thread Jorgen Grahn
I have a set of tests in different modules: test_foo.py, test_bar.py and so on. All of these use the simplest possible internal layout: a number of classes containing test*() methods, and the good old lines at the end: if __name__ == "__main__": unittest.main() This is great, because each

Re: How to get/set class attributes in Python

2005-06-12 Thread tiissa
Kalle Anke wrote: > I'm coming to Python from other programming languages. I like to > hide all attributes of a class and to only provide access to them > via methods. Some of these languages allows me to write something > similar to this > > int age( ) > { > return theAge > } > > void age( x :

Re: Dealing with marketing types...

2005-06-12 Thread Steve Jorgensen
On Sat, 11 Jun 2005 11:51:02 -0500, tom <[EMAIL PROTECTED]> wrote: ... >Let me add an Item #3 - >If you have some entrepeneurial savvy and can keep your emotions out of >it tou can simply tell them you have decided strike out on your own and >tell them that you will be available. They will be happ

Re: How to get/set class attributes in Python

2005-06-12 Thread Steve Jorgensen
On Sun, 12 Jun 2005 03:15:27 -0700, Steve Jorgensen <[EMAIL PROTECTED]> wrote: ... >>Is this the "Pythonic" way of doing it or should I do it in a different >>way or do I have to use setX/getX (shudder) > >I'm totally new to Python myself, but my understanding is that ... Oops - I thought I cance

Re: What is different with Python ?

2005-06-12 Thread Philippe C. Martin
I guess because I have mostly worked with embedded systems and that, although I have always tried to put abstraction layers between my applications and the hardware, some constraints still remain at the application level: (memory, determinism, re-entrance,...). You will notice that 99% of the embed

Re: How to get/set class attributes in Python

2005-06-12 Thread alex23
Kalle Anke wrote: > I'm coming to Python from other programming languages. I like to > hide all attributes of a class and to only provide access to them > via methods. I'm pretty fond of this format for setting up class properties: class Klass(object): def propname(): def

Re: Sending mail from 'current user' in Python

2005-06-12 Thread Marcus Alanen
Mike Meyer wrote: > BTW, an alternative for the username is the USER environment > variable. I don't know whether or not it exists on Windows. Or LOGNAME. Don't about windows, though. >>I've also tried opening a pipe to sendmail, and feeding the >>message to that instead. This too works great (an

Re: What language to manipulate text files

2005-06-12 Thread beliavsky
ross wrote: > Roose wrote: > > Why do people keep asking what language to use for certain things in the > > Python newsgroup? Obviously the answer is going to biased. > > > > Not that it's a bad thing because I love Python, but it doesn't make sense > > if you honestly want an objective opinion. >

Re: How to get/set class attributes in Python

2005-06-12 Thread deelan
Kalle Anke wrote: > I'm coming to Python from other programming languages. I like to > hide all attributes of a class and to only provide access to them > via methods. (...) > Is this the "Pythonic" way of doing it or should I do it in a different > way or do I have to use setX/getX (shudder) the

Re: What is different with Python ?

2005-06-12 Thread Roy Smith
John Machin <[EMAIL PROTECTED]> wrote: > > I know I'm going out on a limb by asking this, but why do you think future > > software engineers should know about memory management? > > Perhaps we have a terminology problem here i.e. different meanings of > "software engineer". Philippe started tal

Re: Controlling a generator the pythonic way

2005-06-12 Thread Thomas Lotze
Thomas Lotze wrote: > Does anybody here have a third way of dealing with this? Sleeping a night sometimes is an insightful exercise *g* I realized that there is a reason why fiddling with the pointer from outside the generator defeats much of the purpose of using one. The implementation using a

Re: Controlling a generator the pythonic way

2005-06-12 Thread Thomas Lotze
Thomas Lotze wrote: > A related problem is skipping whitespace. Sometimes you don't care about > whitespace tokens, sometimes you do. Using generators, you can either set > a state variable, say on the object the generator is an attribute of, > before each call that requires a deviation from the d

Re: What is different with Python ?

2005-06-12 Thread Tom Anderson
On Sun, 12 Jun 2005, Mike Meyer wrote: > For instance, one problem was "You have two files that have lists of 1 > billion names in them. Print out a list of the names that only occur > in one of the files." > > That's a one-line shell script: "comm -12 <(sort file_one) <(sort file_two)" Incidenta

Re: Controlling a generator the pythonic way

2005-06-12 Thread Kent Johnson
Thomas Lotze wrote: > Mike Meyer wrote: > What worries me about the approach of changing state before making a > next() call instead of doing it at the same time by passing a parameter is > that the state change is meant to affect only a single call. The picture > might fit better (IMO) if it didn'

Re: case/switch statement?

2005-06-12 Thread Dan Sommers
On Sun, 12 Jun 2005 10:35:42 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I don't relish the idea of especially long case statements. > I've never understood why something like: > if x = 5: > do_this > elif x = 6: > do_that > else: > do_something_else > is supposed to be "bad

Re: unittest: collecting tests from many modules?

2005-06-12 Thread John Roth
"Jorgen Grahn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a set of tests in different modules: test_foo.py, test_bar.py and so > on. All of these use the simplest possible internal layout: a number of > classes containing test*() methods, and the good old lines at the end:

Re: How to get/set class attributes in Python

2005-06-12 Thread Kalle Anke
On Sun, 12 Jun 2005 12:20:29 +0200, tiissa wrote (in article <[EMAIL PROTECTED]>): > You can 'hide' you getsetters using a property attribute[1]: > > [1]http://docs.python.org/lib/built-in-funcs.html Thanks, this is exactly what I was looking for -- http://mail.python.org/mailman/listinfo/py

checking for when a file or folder exists, typing problems?

2005-06-12 Thread Bryan Rasmussen
Hi I have a little program that is importing from os.path import exists, join, isdir, normpath, isfile at one point in my program I check if a file exists using if exists("c:\projects"): and that works fine. If I change it to be if exists(thepath): where thepath is a commandline argument it does

Re: TKinter -- '' event executing more than once?

2005-06-12 Thread Jeff Epler
For me, an 'is' test works to find out what widget the event is taking place on. # import Tkinter def display_event(e): print "event received", e.widget, e.widget is t t = Tkinter.Tk() t.bind("", display_event) w = Tkint

Scaling down (was Re: Dealing with marketing types...)

2005-06-12 Thread Aahz
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > >What example? Slashdot? It uses way more hardware than it needs to, >at least ten servers and I think a lot more. If LJ is using 6x as >many servers and taking 20x (?) as much traffic as Slashdot, then LJ >is doing

Slicing an IXMLDOMNodeList

2005-06-12 Thread marcel . vandendungen
Hi, I'm using MSXML to select elements from a XML document and want to slice off the last part of an IXMLDOMNodeList. >>> import win32com.client >>> xmldoc = win32com.client.Dispatch('msxml.DOMDocument') >>> xmldoc.load('file.xml') True >>> rgelem = xmldoc.selectNodes('/root/elem') >>> if rgelem.

Re: How to get/set class attributes in Python

2005-06-12 Thread Kalle Anke
On Sun, 12 Jun 2005 13:59:27 +0200, deelan wrote (in article <[EMAIL PROTECTED]>): > the pythonic way is to use "property" (as others have already explained) > only when is *stricly necessary*. this may clarify things up: Thanks for the link (although Java was only one of the languages I was thi

Re: How to get/set class attributes in Python

2005-06-12 Thread John Machin
Kalle Anke wrote: > On Sun, 12 Jun 2005 12:20:29 +0200, tiissa wrote > (in article <[EMAIL PROTECTED]>): > > > >>You can 'hide' you getsetters using a property attribute[1]: >> >>[1]http://docs.python.org/lib/built-in-funcs.html > > > Thanks, this is exactly what I was looking for > > OTOH,

Re: How to get/set class attributes in Python

2005-06-12 Thread Kalle Anke
On Sun, 12 Jun 2005 15:35:15 +0200, John Machin wrote (in article <[EMAIL PROTECTED]>): > OTOH, I beseech you to consider an attitude transplant :-) ;-) > I.e. put your effort into writing code that allows people to do useful > things, rather than opaque guff full of __blahblah__ that stops the

ElementTree Namespace Prefixes

2005-06-12 Thread Chris Spencer
Does anyone know how to make ElementTree preserve namespace prefixes in parsed xml files? The default behavior is to strip a document of all prefixes and then replace them autogenerated prefixes like ns0, ns1, etc. The correct behavior should be to write the file in the form that it was read, w

Re: How to get/set class attributes in Python

2005-06-12 Thread Dan Sommers
On Sun, 12 Jun 2005 15:35:46 +0200, Kalle Anke <[EMAIL PROTECTED]> wrote: > In learning Python I've understood that I should write code in such a > way that it can handle different data and this is fine with me. But > what if I have a class where different attributes should only have > values of a

Re: How to get/set class attributes in Python

2005-06-12 Thread George Sakkis
"alex23" wrote: > Kalle Anke wrote: > > I'm coming to Python from other programming languages. I like to > > hide all attributes of a class and to only provide access to them > > via methods. > > I'm pretty fond of this format for setting up class properties: > > class Klass(object): > def pro

Re: How to get/set class attributes in Python

2005-06-12 Thread Chris Spencer
Kalle Anke wrote: > On Sun, 12 Jun 2005 13:59:27 +0200, deelan wrote > (in article <[EMAIL PROTECTED]>): > > void doSomething( data : SomeClass ){ ... } > > and I would be sure at compile time that I would only get SomeClass objects > as parameters into the method. Being an untyped language, Py

Code documentation tool similar to what Ruby (on Rails?) uses

2005-06-12 Thread Ksenia Marasanova
Hi, I wonder if there is a tool for generation Python API documentation that can include source code into HTML output. Example: http://api.rubyonrails.com/ I really like the possibility to click on "show source" link and read the source of the method! AFAIK it is not possible with Epydoc and Pydo

Re: unittest: collecting tests from many modules?

2005-06-12 Thread George Sakkis
"Jorgen Grahn" wrote: > I have a set of tests in different modules: test_foo.py, test_bar.py and so > on. All of these use the simplest possible internal layout: a number of > classes containing test*() methods, and the good old lines at the end: > > if __name__ == "__main__": > unittest.m

Re: Code documentation tool similar to what Ruby (on Rails?) uses

2005-06-12 Thread Michele Simionato
What about doing it yourself? >>> import inspect, os >>> print "%s" % inspect.getsource(os.makedirs) def makedirs(name, mode=0777): """makedirs(path [, mode=0777]) Super-mkdir; create a leaf directory and all intermediate ones. Works like mkdir, except that any intermediate path segme

Re: case/switch statement?

2005-06-12 Thread Steven D'Aprano
On Sun, 12 Jun 2005 08:33:32 -0400, Dan Sommers wrote: >> I've never understood why something like: > >> if x = 5: >> do_this >> elif x = 6: >> do_that >> else: >> do_something_else > >> is supposed to be "bad", but > >> case of: >> x = 5: >> do_this >> x = 6: >>

Re: How to get/set class attributes in Python

2005-06-12 Thread Steven D'Aprano
On Sun, 12 Jun 2005 14:40:26 +, Chris Spencer wrote: > Being an untyped language, Python does not require you to enforce types. > However, for those that require such functionality, you can get away > with using the "assert" statement. Assuming that Python isn't executed with the optimize s

how to startup the default web browser to open a url?

2005-06-12 Thread flyaflya
I want to startup the default web browser(ie...) to open a url, "execl" can open a process, but when the process exit, the other process will exit too, has any why to deal this problem? -- http://mail.python.org/mailman/listinfo/python-list

Re: What language to manipulate text files

2005-06-12 Thread Brian
Hi Roose, Actually, it is a good thing because it allows those who know the Python language to be able to show the benefits and weaknesses of the language. Sure, the attitude here will be "Yes, it's a great language." Yet, at the same time, it also enables the poster to be able to see potent

Re: checking for when a file or folder exists, typing problems?

2005-06-12 Thread Brian
Hi Bryan, Here's a potential idea. Try converting the variable to a string by using the following syntax: thePath = str(thePathArg) This will convert the current variable type to a string, which follows the data type syntax that you have specified at the beginning of your message. Hope

Re: how to startup the default web browser to open a url?

2005-06-12 Thread Will McGugan
flyaflya wrote: > I want to startup the default web browser(ie...) to open a url, "execl" > can open a process, but when the process exit, the other process will > exit too, has any why to deal this problem? You want the 'webbrowser' module. http://docs.python.org/lib/module-webbrowser.html Wi

Re: python bytecode grammar

2005-06-12 Thread Peter Dembinski
"Terry Reedy" <[EMAIL PROTECTED]> writes: > "M1st0" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> where I can find the grammar of python bytecode ? ( better if is in >> BCF > > I believe the top-level production is something like > BYTECODE := (OPCODE ARGS)* ROTFL :) -- http:

Capture close window button in Tkinter

2005-06-12 Thread William Gill
I am trying to make a simple data editor in Tkinter where each data element has a corresponding Entry widget. I have tried to use the FocusIn/FocusOut events to set a 'hasChanged' flag (if a record has not changed, the db doesn’t need updating). This seems to work fine except that when the

Re: How to get/set class attributes in Python

2005-06-12 Thread Peter Dembinski
Kalle Anke <[EMAIL PROTECTED]> writes: [snap] >> sys.maxint = -12345 > > I don't really understand what you're meaning. He meant None = 1 :> -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree Namespace Prefixes

2005-06-12 Thread Andrew Dalke
On Sun, 12 Jun 2005 15:06:18 +, Chris Spencer wrote: > Does anyone know how to make ElementTree preserve namespace prefixes in > parsed xml files? See the recent c.l.python thread titled "ElemenTree and namespaces" and started "May 16 2:03pm". One archive is at http://groups-beta.google.co

Re: unittest: collecting tests from many modules?

2005-06-12 Thread Scott David Daniels
Jorgen Grahn wrote: > I have a set of tests in different modules: test_foo.py, test_bar.py and so > on. All of these use the simplest possible internal layout: a number of > classes containing test*() methods, and the good old lines at the end: > if __name__ == "__main__": > unittest.main()

Re: How to get/set class attributes in Python

2005-06-12 Thread vincent wehren
"Peter Dembinski" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] | Kalle Anke <[EMAIL PROTECTED]> writes: | | [snap] | | >> sys.maxint = -12345 | > | > I don't really understand what you're meaning. | | He meant None = 1 :> I'm sure you know that has become a no-no in Python 2

Re: checking for when a file or folder exists, typing problems?

2005-06-12 Thread Scott David Daniels
Bryan Rasmussen wrote: > ... at one point in my program I check if a file exists using > if exists("c:\projects"): You should not be using a backslash in non-raw-string source to mean anything but "escape the next character." The above should either be written as: if exists(r"c:\projects

Re: TKinter -- '' event executing more than once?

2005-06-12 Thread Christopher Subich
Jeff Epler wrote: > For me, an 'is' test works to find out what widget the event is taking > place on. ... yes, I am apparently as stupid as I look. In my test code, I was trying "if event is widget," and I just now saw that. Thanks! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get/set class attributes in Python

2005-06-12 Thread Steven D'Aprano
On Sun, 12 Jun 2005 15:35:46 +0200, Kalle Anke wrote: > Anyway, I got another "problem" (read: being used to do it like this in other > languages). I'm used to use statically typed languages and for me one of the > advantages is that I can be sure that a parameter is of a certain type. So in >

Re: How to get/set class attributes in Python

2005-06-12 Thread Peter Dembinski
"vincent wehren" <[EMAIL PROTECTED]> writes: > "Peter Dembinski" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > news:[EMAIL PROTECTED] > | Kalle Anke <[EMAIL PROTECTED]> writes: > | > | [snap] > | > | >> sys.maxint = -12345 > | > > | > I don't really understand what you're meaning. > | > | He meant

Re: Capture close window button in Tkinter

2005-06-12 Thread Jonathan Ellis
William Gill wrote: > I am trying to make a simple data editor in Tkinter where each data > element has a corresponding Entry widget. I have tried to use the > FocusIn/FocusOut events to set a 'hasChanged' flag (if a record has not > changed, the db doesn't need updating). This seems to work fi

How to receve user events from IE on objects within frames

2005-06-12 Thread cal_2pac
Resurrecting a month old thread.. (listed at http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/2f4e50e1e316eef4/5924203f822f7f4b?q=cal_2pac&rnum=3#5924203f822f7f4b) Somehow - responses to that thread are not being brought up in chronological order. Thus the creation of ano

Re: Dealing with marketing types...

2005-06-12 Thread Terry Reedy
"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message news:[EMAIL PROTECTED] > Andrew Dalke <[EMAIL PROTECTED]> writes: >> If that's indeed the case then I'll also argue that each of >> them is going to have app-specific choke points which are best >> hand-optimized and not framework opt

Re: Code documentation tool similar to what Ruby (on Rails?) uses

2005-06-12 Thread Ksenia Marasanova
12 Jun 2005 08:12:14 -0700, Michele Simionato <[EMAIL PROTECTED]>: > What about doing it yourself? > > >>> import inspect, os > >>> print "%s" % inspect.getsource(os.makedirs) That's easy, thanks! I guess I'll submit a patch for Epydoc with the functionality I've mentioned :) -- Ksenia -- htt

Re: How to get/set class attributes in Python

2005-06-12 Thread Bruno Desthuilliers
Chris Spencer a écrit : > Kalle Anke wrote: > >> On Sun, 12 Jun 2005 13:59:27 +0200, deelan wrote >> (in article <[EMAIL PROTECTED]>): >> >> void doSomething( data : SomeClass ){ ... } >> >> and I would be sure at compile time that I would only get SomeClass >> objects as parameters into the meth

Re: Custom type: PyObject_IS_GC access violation

2005-06-12 Thread =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
Bue Krogh Vedel-Larsen wrote: > But if I call > > SA_PyVector_Type.tp_new = PyType_GenericNew; > PyType_Ready( &SA_PyVector_Type ); > > then, when Py_Finalize is called, PyObject_IS_GC(op) in visit_decref() in > gcmodule.c causes an access violation. If I don't call PyType_Ready, then > the ac

Re: What is different with Python ?

2005-06-12 Thread Steven D'Aprano
On Sun, 12 Jun 2005 08:11:47 -0400, Roy Smith wrote: > The point I was trying to make was that as computer science progresses, > stuff that was really important to know a lot about becomes more and more > taken for granted. This is how we make progress. > > I used to worry about memory busses

Re: ElementTree Namespace Prefixes

2005-06-12 Thread Chris Spencer
Andrew Dalke wrote: > On Sun, 12 Jun 2005 15:06:18 +, Chris Spencer wrote: > > >>Does anyone know how to make ElementTree preserve namespace prefixes in >>parsed xml files? > > > See the recent c.l.python thread titled "ElemenTree and namespaces" > and started "May 16 2:03pm". One archive

RE: Dealing with marketing types...

2005-06-12 Thread bruce
just out of curiosity.. where'd you read the 150,000-200,000 servers... i've never seen guesses that high.. i've seen somewhere as high as possible 100K... but the author stated that he was purely guessing... -bruce -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Be

Re: Controlling a generator the pythonic way

2005-06-12 Thread Terry Reedy
"news:[EMAIL PROTECTED] > Thomas Lotze <[EMAIL PROTECTED]> writes: >> A related problem is skipping whitespace. Sometimes you don't care about >> whitespace tokens, sometimes you do. Using generators, you can either >> set >> a state variable, say on the object the generator is an attribute of, >

Re: How to get/set class attributes in Python

2005-06-12 Thread Chris Spencer
Bruno Desthuilliers wrote: > And *this* is highly unpythonic. And un-OO too, since it makes foo() > dependant on *class* Bar, when it should most probably be enough that it > only depends on (probably part of) the *interface* of class Bar. I was providing the original poster with a simple way t

Re: Scaling down (was Re: Dealing with marketing types...)

2005-06-12 Thread Paul Rubin
[EMAIL PROTECTED] (Aahz) writes: > So what? I think you're missing the real point of the article: using > LAMP scales *DOWN* in a way that enterprise systems don't. Getting your > first prototype up and running is far more important than sheer > scalability, There comes a day when your first pro

Re: Capture close window button in Tkinter

2005-06-12 Thread William Gill
Jonathan Ellis wrote: > William Gill wrote: > >>I am trying to make a simple data editor in Tkinter where each data >>element has a corresponding Entry widget. I have tried to use the >>FocusIn/FocusOut events to set a 'hasChanged' flag (if a record has not >>changed, the db doesn't need updati

slicing a bsddb table, eg. for rec in bsddb["AArdvark":"zebra"]: print rec

2005-06-12 Thread Neville C. Dempsey
#!/bin/env python import bsddb test=bsddb.btopen("test.tbl") for m in "JFMATQPHSOND": test[m]="Profit for month "+m+" $1B" def subyear_report(record_selection): for data in record_selection.iteritems(): print data # I was expecting a slice of an index file to yield a # generator so not all

Re: checking for when a file or folder exists, typing

2005-06-12 Thread Bryan Rasmussen
>Hi Bryan, >Here's a potential idea. Try converting the variable to a string by >using the following syntax: > thePath = str(thePathArg) Actually it was a stupid thing, what happened was I was looping through the commandline to build a file path in cases where there was more than one comman

Re: Python Developers Handbook - Mistake done and corrected.

2005-06-12 Thread wooks
Arsenal v Spurs in baseball that translates to Red Sox v Yankees. -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree Namespace Prefixes

2005-06-12 Thread Jarek Zgoda
Chris Spencer napisał(a): > Given xml with no namespaces, Elementtree works perfectly. However, if > you give the root tag an xmlns attribute, Elementtree relabels all child > nodes with it's own prefix, completely defeating the purpose of the > default namespace. In my opinion, this is unaccep

searching for IDE

2005-06-12 Thread alexrait1
I need an IDE for python that has the ability to show the filds of a class when I write "." Just the way it works in eclipse/JBuilder with java or visual studio with c++ For now I treid eric3 and IDLE they don't do this... -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-12 Thread Philippe C. Martin
Taking stuff for granted in unrelated to progress. I agree that the "trade" of software engineering evolves and that, thanks to hardware advances, we _usually_ can now "object orient" our software, add billions of abstraction layers, and consume memory without a second thought. But the trade evolv

Re: How to get/set class attributes in Python

2005-06-12 Thread Peter Dembinski
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: [snap] >> Being an untyped language, Python does not require you to enforce >> types. > > Nope. Python *is* typed. But it doesnt confuse implementation > with semantic. Python is typed. And its type system may look strange for anyone who did only

Re: searching for IDE

2005-06-12 Thread jean-marc
if you are familiar with eclipse, you could use the PyDev python plugin. jm -- http://mail.python.org/mailman/listinfo/python-list

Re: searching for IDE

2005-06-12 Thread Rob
Try ActiveState Komodo. It costs $30 for a personal license, and is well worth it. If you like visual studio you will like it. Like many other people, I have looked far and wide for a Python IDE and this is what I've found. The free solutions don't cut it, at least without spending many many

How to test if an object IS another object?

2005-06-12 Thread dan . eloff
If two objects are of equal value you can compare them with ==. What I want to do is find out if two objects are actually just references to the same object, how can I do this in Python? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if an object IS another object?

2005-06-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > If two objects are of equal value you can compare them with ==. What I > want to do is find out if two objects are actually just references to > the same object, how can I do this in Python? The most obvious way (as usual ?): if obj1 is obj2: // your code here -

Re: What language to manipulate text files

2005-06-12 Thread Dan Christensen
ross <[EMAIL PROTECTED]> writes: > What are the ideal languages for the following examples? > > 1. Starting from a certain folder, look in the subfolders for all > filenames matching *FOOD*.txt Any files matching in each folder should > be copied to a new subfolder within the current folder called

Re: What is different with Python ?

2005-06-12 Thread Peter Dembinski
Steven D'Aprano <[EMAIL PROTECTED]> writes: [snap] > new_text = "" > for word in text: > new_text = new_text + process(word) new_text = "".join(map(process, text)) (I couldn't resist) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get/set class attributes in Python

2005-06-12 Thread Bruno Desthuilliers
Chris Spencer a écrit : > Bruno Desthuilliers wrote: > >> And *this* is highly unpythonic. And un-OO too, since it makes foo() >> dependant on *class* Bar, when it should most probably be enough that >> it only depends on (probably part of) the *interface* of class Bar. > > I was providing the

Re: python bytecode grammar

2005-06-12 Thread Terry Reedy
"Peter Dembinski" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Terry Reedy" <[EMAIL PROTECTED]> writes: >> I believe the top-level production is something like >> BYTECODE := (OPCODE ARGS)* > > ROTFL :) Glad to make your day ;-) I am aware that since ARGS depends on OPCODE, th

Re: How to test if an object IS another object?

2005-06-12 Thread eloff777
Sorry about removing my message, I posted with the wrong google account, I don't really want my email where those irritating spam bots can find it. >The most obvious way (as usual ?): > >if obj1 is obj2: > // your code here I immediately thought of is, and tested it in the console, but it didn't

Re: How to test if an object IS another object?

2005-06-12 Thread Paul Rubin
[EMAIL PROTECTED] writes: > >foo = 3 > >bar = 3 > clearly foo and bar have the same value but they are different objects > aren't they? No, they're the same object. Now try it with 300 instead of 3 ;-). -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if an object IS another object?

2005-06-12 Thread [EMAIL PROTECTED]
You can use the id() function to test equality of objects: [EMAIL PROTECTED]:~$ python Python 2.4.1 (#2, Mar 30 2005, 21:51:10) [GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> a = 3 >>> b = 3 >>> id(a) 135585176 >>> id(b) 1

Re: How to test if an object IS another object?

2005-06-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Sorry about removing my message, I posted with the wrong google > account, I don't really want my email where those irritating spam bots > can find it. > > >>The most obvious way (as usual ?): >> >>if obj1 is obj2: >> // your code here > > > I immediately thought o

Re: How to overcome automatic cyrillic-to-/hex convert

2005-06-12 Thread Florian Diesch
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: > But when I enter some Bulgarian (actually cyrillic) text as a string, > it > seems that Python automatically converts it to '\x00..\x00 ' and once > converted that way I can't get it back into its original look. The only > way to get it right is usin

Re: How to test if an object IS another object?

2005-06-12 Thread eloff777
Fascinating. With small strings, it uses the same object, and with small numbers like 3. With 300 they were different objects (why, shouldn't they both be ints still?) Mutable objects functioned differently as you suggested: >>>foo = [] >>>bar = [] >>>foo == bar True >>>foo is bar False Tuples (

Re: How to get/set class attributes in Python

2005-06-12 Thread Chris Spencer
Bruno Desthuilliers wrote: > Chris Spencer a écrit : > >> I was providing the original poster with a simple way to ensure >> appropriate type. > > > s/appropriate type/specific implementation/ > > Hint : the appropriate type for print >> XXX is "whatever has a > 'write(anything_that_can_be_co

Re: How to get/set class attributes in Python

2005-06-12 Thread Chris Spencer
Peter Dembinski wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >>Nope. Python *is* typed. But it doesnt confuse implementation >>with semantic. > > > Python is typed. And its type system may look strange for anyone who > did only Java or C++ programming before :> Of course, in tha

Learning more about "The Python Way"

2005-06-12 Thread Kalle Anke
Those who have read my posts today have probably understood that I'm not a "true" Python programmer ... but I want to learn more (I think that Python is rather fun). I've read "Learning Python" pretty thoroughly, I've looked at some of the tutorials, some of online documentation, etc. But I sti

Re: Code documentation tool similar to what Ruby (on Rails?) uses

2005-06-12 Thread Andrew Dalke
Ksenia Marasanova responsded to Michele Simionato >> >>> print "%s" % inspect.getsource(os.makedirs) > > That's easy, thanks! I guess I'll submit a patch for Epydoc with the > functionality I've mentioned :) Before doing that, add a "cgi.escape()" to the text. Otherwise embedded [<>&] characters

  1   2   >