Re: What is different with Python ?

2005-06-12 Thread George Sakkis
"Andrea Griffini" wrote: > I think that if you don't understand memory, > addresses and allocation and deallocation, or > (roughly) how an hard disk works and what's > the difference between hard disks and RAM then > you're going to be a horrible programmer. > > There's no way you will remember wh

Re: What is different with Python ?

2005-06-12 Thread Steven D'Aprano
On Sun, 12 Jun 2005 20:22:28 -0400, Roy Smith wrote: > At some point, you need to draw a line in the sand (so to speak) and say, > "I understand everything down to *here* and can do cool stuff with that > knowledge. Below that, I'm willing to take on faith". I suspect you would > agree that's

Re: What is different with Python ?

2005-06-12 Thread Andrea Griffini
On Sun, 12 Jun 2005 21:52:12 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >I'm curious how you learned to program. An HP RPN calculator, later TI-57. Later Apple ][. With Apple ][ after about one afternoon spent typing in a basic program from a magazine I gave up with basic and started with 650

Re: What is different with Python ?

2005-06-12 Thread Claudio Grondi
> They're things that can be IMO genuinely accept > as "obvious". Even "counting" is not the lowest > level in mathematic... there is the mathematic > philosohy direction. I am personally highly interested in become aware of the very bottom, the fundaments all our knownledge is build on. Trying to

Re: What is different with Python ?

2005-06-12 Thread Andrea Griffini
On Sun, 12 Jun 2005 19:53:29 -0500, Mike Meyer <[EMAIL PROTECTED]> wrote: >Andrea Griffini <[EMAIL PROTECTED]> writes: >> On Sat, 11 Jun 2005 21:52:57 -0400, Peter Hansen <[EMAIL PROTECTED]> >> wrote: >> Also concrete->abstract shows a clear path; starting >> in the middle and looking both up (to

Re: count string replace occurances

2005-06-12 Thread George Sakkis
"Jeff Epler" wrote: > On Sun, Jun 12, 2005 at 04:55:38PM -0700, Xah Lee wrote: > > if i have > > mytext.replace(a,b) > > how to find out many many occurances has been replaced? > > The count isn't returned by the replace method. You'll have to count > and then replace. > > def count_replace(a, b,

Re: What is different with Python ?

2005-06-12 Thread Andrea Griffini
On Sun, 12 Jun 2005 20:22:28 -0400, Roy Smith <[EMAIL PROTECTED]> wrote: >How far down do you have to go? What makes bytes of memory, data busses, >and CPUs the right level of abstraction? They're things that can be IMO genuinely accept as "obvious". Even "counting" is not the lowest level in m

Re: searching for IDE

2005-06-12 Thread Chris Spencer
jean-marc wrote: > if you are familiar with eclipse, you could use the PyDev python > plugin. > > jm Thanks for that reference. I had been using SPE for my Python editing, but it's gone unmaintained as of late, so I've been looking for an alternative. Aside from an autocomplete bug (which I've

Re: How to use 8bit character sets?

2005-06-12 Thread =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
copx wrote: > For some reason Python (on Windows) doesn't use the system's default > character set and that's a serious problem for me. I very much doubt this statement: Python does "use" the system's default character set on Windows. What makes you think it doesn't? > Is it possible to tell Pyt

Re: How to get/set class attributes in Python

2005-06-12 Thread Axel Straschil
Hello! > You can 'hide' you getsetters using a property attribute[1]: For me, the property attribute is a beast: class A(object): def getP(self): return 'A' p = property(getP) class A2(A): def getP(self): return 'A2' a = A() a2 = A2() print a.getP(), a2.getP() print a.p,

Re: tree functions daily exercise: Range

2005-06-12 Thread lqf
thank -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use 8bit character sets?

2005-06-12 Thread John Machin
copx wrote: > For some reason Python (on Windows) doesn't use the system's default > character set and that's a serious problem for me. > I need to process German textfiles (containing umlauts and other > 7bit > ASCII characters) and generally work with strings which need to be processed > using

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

2005-06-12 Thread erinhouston
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 can do this with the win32aip module found in win32all Home page http://starship.pyt

Re: How to use 8bit character sets?

2005-06-12 Thread copx
"Chris Curvey" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Check out sitecustomize.py. > > http://diveintopython.org/xml_processing/unicode.html Thanks but I'm looking for a way to do this on application level (i.e. I want my app to run in an unmodified interpreter envirom

Re: Annoying behaviour of the != operator

2005-06-12 Thread pmaupin
If a behavior change is possible at all, I think a more reasonable behavior would be: if any rich comparison methods are defined, always use rich comparisons (and throw an exception if the required rich comparison method is not available). This would at least have the benefit of letting users kno

Re: What is different with Python ?

2005-06-12 Thread George Sakkis
"Mike Meyer" wrote: > Andrea Griffini <[EMAIL PROTECTED]> writes: > > On Sat, 11 Jun 2005 21:52:57 -0400, Peter Hansen <[EMAIL PROTECTED]> > > wrote: > > Also concrete->abstract shows a clear path; starting > > in the middle and looking both up (to higher > > abstractions) and down (to the impleme

Re: searching for IDE

2005-06-12 Thread Grumman
alexrait1 wrote: > 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... > The ActiveState python editor (pythonwin?) do

Re: BBC R&D White Paper on Kamaelia Published (Essentially a framework using communicating python generators)

2005-06-12 Thread pmaupin
> I'm posting a link to this since I hope it's of interest to people here :) > > I've written up the talk I gave at ACCU Python UK on the Kamaelia Framework, > and it's been published as a BBC R&D White Paper and is available here: > >* http://www.bbc.co.uk/rd/pubs/whp/whp113.shtml I enjoyed

RE: inactive Spambayes w/ Outlook

2005-06-12 Thread Tony Meyer
> I had installed spambayes with outlook 2003 a while ago and > it worked great. Then I did who know what it stopped working. If Peter's link doesn't help, I suggest you try the spambayes mailing list: =Tony.Meyer -- http://mail.python.org/

Re: case/switch statement?

2005-06-12 Thread Peter Hansen
Chinook wrote: > On Sun, 12 Jun 2005 17:19:06 -0400, Peter Hansen wrote: >>Case statements are actually more suitable in many cases even when >>performance is not a goal for reasons of *readability*. >> >>When reading an if statement, you have to scan down through effective >>each statement attem

Re: case/switch statement?

2005-06-12 Thread Raymond Hettinger
[Joe Stevenson] > > 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. [deelan] > topic already beated to death It's not dead yet. It has excellent use cases and an open PEP, http://www.pyt

Re: Get drives and partitions list (Linux)

2005-06-12 Thread Peter Hansen
cantabile wrote: > Hi, I'd like to get drives and partitions (and their size too) with > python under Linux. So far, I thought of reading /proc/partitions but > maybe i could use fdsik also ? > How would I do that in python ? Somebody else posted a very similar question quite recently. A Google

Re: how to operate the excel by python?

2005-06-12 Thread Tim Roberts
John Machin <[EMAIL PROTECTED]> wrote: >Rune Strand wrote: >> The key is Python for Windows : >> http://starship.python.net/crew/mhammond/win32/ >> >> See here for an Excel dispatch example: >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/325735 >> >> When doing such operations, I gen

Re: What is different with Python ?

2005-06-12 Thread Peter Hansen
Andrea Griffini wrote: > On Sat, 11 Jun 2005 21:52:57 -0400, Peter Hansen <[EMAIL PROTECTED]> > wrote: >>I think new CS students have more than enough to learn with their >>*first* language without having to discover the trials and tribulations >>of memory management (or those other things that P

Re: Get drives and partitions list (Linux)

2005-06-12 Thread Jeff Epler
Using /proc/partitions is probably preferable because any user can read it, not just people who can be trusted with read access to drives, and because the format of /proc/partitions is probably simpler and more stable over time. That said, what you do is import commands fdisk_output = comm

Re: What is different with Python ?

2005-06-12 Thread Peter Hansen
Mike Meyer wrote: > Andrea Griffini <[EMAIL PROTECTED]> writes: >>Also concrete->abstract shows a clear path; starting >>in the middle and looking both up (to higher >>abstractions) and down (to the implementation >>details) is IMO much more confusing. > > So you're arguing that a CS major should

Re: Learning more about "The Python Way"

2005-06-12 Thread Robert Kern
Kalle Anke wrote: > So, I'm looking for advice/information on: > > + How to write "proper" python code instead of > Java/Perl/C/C++/Pascal/Modula-2/etc inspired code Read other people's Python code especially that from the standard library. Extend the functionality of those projects to fit y

Re: count string replace occurances

2005-06-12 Thread Jeff Epler
On Sun, Jun 12, 2005 at 04:55:38PM -0700, Xah Lee wrote: > if i have > mytext.replace(a,b) > how to find out many many occurances has been replaced? The count isn't returned by the replace method. You'll have to count and then replace. def count_replace(a, b, c): count = a.count(b) retur

Re: Following the white rabbit (was "The Python Way")

2005-06-12 Thread Christopher Subich
Claudio Grondi wrote: >> Just follow the white rabbit. > > > This triggers in me the temptation to start > a thread asking: > > What (in your opinion) can a good programmer > learn from watching all of the Matrix movies? > Which part, one, two or three deals most with > the philosophy of

Re: Sending mail from 'current user' in Python

2005-06-12 Thread Mike Meyer
Marcus Alanen <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>>Finally, if at all possible I'd also like to get this working on >>>Windows, so I'd rather stick with the standard smtplib if I can. >> smtplib needs an SMTP server to connect to. For unix systems, this is >> typically localhost. What

Re: Learning more about "The Python Way"

2005-06-12 Thread George Sakkis
"Kalle Anke" wrote: > [snipped] > > So, I'm looking for advice/information on: > > + How to write "proper" python code instead of > Java/Perl/C/C++/Pascal/Modula-2/etc inspired code > > + The more advanced parts/uses of Python > > + Discussions about the ideas behind different Python > constru

Re: changing how instances are "created"

2005-06-12 Thread John Roth
"newseater" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> > class Creator >> > def createInstance(cls, *args, **kwargs): >> > anewinstance = cls.__new__(cls, *args, **kwargs) >> > anewinstance.__init__(*args, **kwargs) >> > >> > return anewinstance >> > createInstance = staticmet

Re: What is different with Python ?

2005-06-12 Thread Mike Meyer
Andrea Griffini <[EMAIL PROTECTED]> writes: > On Sat, 11 Jun 2005 21:52:57 -0400, Peter Hansen <[EMAIL PROTECTED]> > wrote: > Also concrete->abstract shows a clear path; starting > in the middle and looking both up (to higher > abstractions) and down (to the implementation > details) is IMO much mo

Re: case/switch statement?

2005-06-12 Thread Chinook
On Sun, 12 Jun 2005 17:19:06 -0400, Peter Hansen wrote (in article <[EMAIL PROTECTED]>): > Steven D'Aprano wrote: >> 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.

Re: What is different with Python ?

2005-06-12 Thread Roy Smith
Andrea Griffini <[EMAIL PROTECTED]> wrote: > I think that for a programmer skipping the > understanding of the implementation is just > impossible: if you don't understand how a > computer works you're going to write pretty > silly programs. Note that I'm not saying that > one should understand eve

Re: How to receive events (eg. user mouse clicks) from IE

2005-06-12 Thread Roger Upole
Each frame acts as a separate document. You should be able catch document events from a frame using something like win32com.client.DispatchWithEvents(ie.Document.frames().document, ) Roger <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Resurrecting an old thread.. > It

OSCON: Volunteer for Python?

2005-06-12 Thread Aahz
I'm trying to organize a group of people to run a Python booth at OSCON so that people will see an alternative to Perl. ;-) I'd like at least ten or twelve volunteers so that nobody has to pull a long shift. If you're interested, please subscribe to the OSCON mailing list: http://mail.python.or

Get drives and partitions list (Linux)

2005-06-12 Thread cantabile
Hi, I'd like to get drives and partitions (and their size too) with python under Linux. So far, I thought of reading /proc/partitions but maybe i could use fdsik also ? How would I do that in python ? Thanks for your help (newbie here :) ) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use 8bit character sets?

2005-06-12 Thread Chris Curvey
Check out sitecustomize.py. http://diveintopython.org/xml_processing/unicode.html -- http://mail.python.org/mailman/listinfo/python-list

Re: changing how instances are "created"

2005-06-12 Thread newseater
> > A staticmethod does not take a cls argument. It is essentially just a > function that is attached to a class. yes i know of that difference... but one cannot easily override a class method in a supclass.. as calling super then make the cls variable point to the super class class rather than th

Re: changing how instances are "created"

2005-06-12 Thread newseater
> > class Creator > > def createInstance(cls, *args, **kwargs): > > anewinstance = cls.__new__(cls, *args, **kwargs) > > anewinstance.__init__(*args, **kwargs) > > > > return anewinstance > > createInstance = staticmethod(createInstance) > > > > > > can anyone help?? > > __new__ is the proper way t

count string replace occurances

2005-06-12 Thread Xah Lee
if i have mytext.replace(a,b) how to find out many many occurances has been replaced? Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: changing how instances are "created"

2005-06-12 Thread Robert Kern
newseater wrote: > > Robert Kern wrote: > >>newseater wrote: >> >>>Hello. I need to be able to control how objects are created. Sometimes >>>when creating an object, i want to reuse another object instead. I've >>>searched for factory method implementations and singleton >>>implementations. They

Re: changing how instances are "created"

2005-06-12 Thread John Roth
"newseater" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello. I need to be able to control how objects are created. Sometimes > when creating an object, i want to reuse another object instead. I've > searched for factory method implementations and singleton > implementations. Th

Re: changing how instances are "created"

2005-06-12 Thread newseater
Robert Kern wrote: > newseater wrote: > > Hello. I need to be able to control how objects are created. Sometimes > > when creating an object, i want to reuse another object instead. I've > > searched for factory method implementations and singleton > > implementations. They were too much of a hac

RE: Controlling a generator the pythonic way

2005-06-12 Thread Delaney, Timothy C (Timothy)
Thomas Lotze wrote: > call. The picture might fit better (IMO) if it didn't look so much > like working around the fact that the next() call can't take > parameters for some technical reason. You might want to take a look at PEP 342 . Doesn't help you no

Re: How to get/set class attributes in Python

2005-06-12 Thread Chris Spencer
Peter Dembinski wrote: > Chris Spencer <[EMAIL PROTECTED]> writes: > > >>Peter Dembinski wrote: >> >>Of course, in that Python is dynamically typed as opposed to the >>static typing of Java or C++. Please excuse my previous mis-wording :) > > > Mis-wording? I previously said Python was "untype

Re: changing how instances are "created"

2005-06-12 Thread Robert Kern
newseater wrote: > Hello. I need to be able to control how objects are created. Sometimes > when creating an object, i want to reuse another object instead. I've > searched for factory method implementations and singleton > implementations. They were too much of a hack! > > My first attempt of doi

changing how instances are "created"

2005-06-12 Thread newseater
Hello. I need to be able to control how objects are created. Sometimes when creating an object, i want to reuse another object instead. I've searched for factory method implementations and singleton implementations. They were too much of a hack! My first attempt of doing this was to play around wi

Re: What is different with Python ?

2005-06-12 Thread Andrea Griffini
On Sat, 11 Jun 2005 21:52:57 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >I think new CS students have more than enough to learn with their >*first* language without having to discover the trials and tribulations >of memory management (or those other things that Python hides so well). I'm no

Re: tree functions daily exercise: Table

2005-06-12 Thread Xah Lee
Here's the next tree functions exercise in Python, Perl, Java. Other language solutions welcome. http://xahlee.org/tree/tree.html - Table('exprString', [iMax]) generates a list of iMax copies of value of eval('exprString'), and returns the refence to the list. i.e. [ev

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

2005-06-12 Thread Aahz
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: >[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 i

Following the white rabbit (was "The Python Way")

2005-06-12 Thread Claudio Grondi
> Just follow the white rabbit. This triggers in me the temptation to start a thread asking: What (in your opinion) can a good programmer learn from watching all of the Matrix movies? Which part, one, two or three deals most with the philosophy of programming? Claudio "Jarek Zgoda" <[EMAIL PROTE

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

2005-06-12 Thread Roose
This isn't a good example to test with, since 3 is an immutable object, as is 300 and all ints. It's more meaningful if the objects are mutable. Why do you want to test identity in the first place? Roose <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorry about removing my m

tree functions daily exercise: Range

2005-06-12 Thread Xah Lee
Here's the belated Java solution. import java.util.List; import java.util.ArrayList; import java.lang.Math; class math { public static List range(double n) { return range(1,n,1); } public static List range(double n, double m) { return range(n,m,1); } public s

Re: python bytecode grammar

2005-06-12 Thread Peter Dembinski
"Terry Reedy" <[EMAIL PROTECTED]> writes: > "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

Re: Dealing with marketing types...

2005-06-12 Thread Andrew Dalke
Paul Rubin wrote: > Andrew Dalke <[EMAIL PROTECTED]> writes: ... >> I found more details at >> http://jeremy.zawodny.com/blog/archives/001866.html >> >> It's a bunch of things - Perl, C, MySQL-InnoDB, MyISAM, Akamai, >> memcached. The linked slides say "lots of MySQL usage." 60 servers. > > LM

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

2005-06-12 Thread Skip Montanaro
Neville> # I was expecting a slice of an index file to yield a Neville> # generator so not all the records need to be read from disk Slicing is a feature of sequence types, not mapping types. >>> import string >>> d = dict(zip(string.lowercase, string.uppercase)) >>> d

Re: How to get/set class attributes in Python

2005-06-12 Thread Peter Dembinski
Chris Spencer <[EMAIL PROTECTED]> writes: > 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

How to use 8bit character sets?

2005-06-12 Thread copx
For some reason Python (on Windows) doesn't use the system's default character set and that's a serious problem for me. I need to process German textfiles (containing umlauts and other > 7bit ASCII characters) and generally work with strings which need to be processed using the local encoding (I

Re: Learning more about "The Python Way"

2005-06-12 Thread Jarek Zgoda
Kalle Anke napisał(a): > So, I'm looking for advice/information on: > > + How to write "proper" python code instead of > Java/Perl/C/C++/Pascal/Modula-2/etc inspired code Just follow the white rabbit. Rewrite your code in Python, then optimize. -- Jarek Zgoda http://jpa.berlios.de/ | http:

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

2005-06-12 Thread Grant Edwards
On 2005-06-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Fascinating. With small strings, it uses the same object, and with > small numbers like 3. With 300 they were different objects (why, It's purely an implimentation detail. The small integers get used a lot, so Python keeps a pre-creat

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

2005-06-12 Thread Grant Edwards
On 2005-06-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>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 work quite like I expected: > >>foo = 3 >>bar = 3 >>zoo = foo >>foo is zoo > T

Re: case/switch statement?

2005-06-12 Thread Peter Hansen
Steven D'Aprano wrote: > 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. >>It is precisely this behavior that is desired in many situations. > > Agreed. I certainly don't o

Post-EuroPython 2005 PyPy Sprint 1st - 7th July 2005

2005-06-12 Thread Armin Rigo
Post-EuroPython 2005 PyPy Sprint 1st - 7th July 2005 == The next PyPy sprint is scheduled right after EuroPython 2005 in Gothenborg, Sweden. Its main focus is translation to lower level backends but there are also other possible topics. We'll

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

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: 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

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 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 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 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 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 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 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: 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 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: 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: 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: 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 -

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: 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

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: 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: 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

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: 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

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: 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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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

  1   2   >