Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
You might like programming in XML then: http://www.meta-language.net/ Actually, the samples are hard to find, they are here: http://www.meta-language.net/sample.html Programming in XML makes Perl and PHP look like the cleanest languages ever invented. -- http://mail.python.org/mailman/listinfo/pyt

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Daniel Bickett wrote: In my (brief) experience with YAML, it seemed like there were several different ways of doing things, and I saw this as one of it's failures (since we're all comparing it to XML). However I maintain, in spite of all of that, that it can easily boil down to the fact that, for s

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Steve Holden wrote: Yet again I will interject that XML was only ever intended to be wriiten by programs. Hence its moronic stupidity and excellent uniformity. Neither was HTML, neither were URLs, neither were many things used the way they were intended. YAML, however, is specifically designed t

Re: [OT] XML design intent [was Re: What YAML engine do you use?]

2005-01-22 Thread Doug Holton
Peter Hansen wrote: Good question. The point is that an XML document is sometimes a file, sometimes a record in a relational database, sometimes an object delivered by an Object Request Broker, and sometimes a stream of bytes arriving at a network socket. These can all be described a

Re: default value in a list

2005-01-22 Thread Reinhold Birkenfeld
Nick Coghlan wrote: > Reinhold Birkenfeld wrote: >>>Why not put these together and put it in itertools, since the requirement >>>seems >>>to crop up every other week? >>> >>> >>> line = "A:B:C".split(":") >>> ... >>> >>> def ipad(N,iterable, default = None): >>> ... return it.islice(it.ch

Re: finding name of instances created

2005-01-22 Thread Nick Coghlan
André wrote: So, students will be able to write: pete = CreateRobot(2, 3) pete.move() learning about objects and methods. As for things like for robot in robots: do stuff that will be for my use only: drawing robots on the screen, updating the 'world' when robots pick stuff up, etc. My intention i

Re: finding name of instances created

2005-01-22 Thread Nick Coghlan
André wrote: I have tried this exact example (using Python 2.3 if it makes any difference) and what I got was: robot None moved robot None moved I checked what I wrote, used cut & paste on your code, removing the leading "junk", tried it again ... to no avail. :-( Worked exactly as written for me,

Re: list unpack trick?

2005-01-22 Thread Fredrik Lundh
Nick Coghlan wrote: >> I am think more in the line of string.ljust(). So if we have a >> list.ljust(length, filler), we >> can do something like >> >> name, value = s.split('=',1).ljust(2,'') > > Eh? > > Py> s.split('=',1).ljust(2,'') > Traceback (most recent call last): > File "", line 1,

Re: Unbinding multiple variables

2005-01-22 Thread Nick Coghlan
Bengt Richter wrote: (OTOH, deletions of actual local bindings do seem to propagate back into a previously bound value of locals on exit, and a new call to locals() seems to return the same identical object as before, so I'm not sure I believe the , unless it has a special slot and it is automat

RE: Python Scripting

2005-01-22 Thread Robert Brewer
Ali Polatel wrote: > I want to ask you a question about python scripting. > I want to know if I can design web-pages with python Yes. > or at least write html files with python. Yes. > and if I write html files with python and some CGI scripts > and upload them to the web-page .. does the peopl

Re: embedding jython in CPython...

2005-01-22 Thread Jim Hargrave
> I am curious to know what makes your Jython code incompatible with > CPython. If it is only because it uses Java classes, it might > not be too > difficult to port them to CPython+Jpype. CPython+Jpype may indeed be the way to go in the long run - it's only my ignorance stoping me at this point :

Re: embedding jython in CPython...

2005-01-22 Thread Steve Menard
Jim Hargrave wrote: Sorry - should have given more detail. That's what I get for posting at 1:00AM. What I want to do us write scripts in CPython that access Windows ActiveX such as Word and IE. Obviously Jython can't do this (easily at least). I also have Jython scripts that provide a high le

JPype and classpath (Was Re: embedding jython in CPython... )

2005-01-22 Thread Steve Menard
While we are on topic, I am having some trouble understanding JPype classpath. How do I init the JVM with the folder in which the Python program is located included in the classpath? I tried t = JPackage('.').test That did not work. My environment variable includes current folder in the classpath I

Re: default value in a list

2005-01-22 Thread Nick Coghlan
Reinhold Birkenfeld wrote: Why not put these together and put it in itertools, since the requirement seems to crop up every other week? >>> line = "A:B:C".split(":") ... >>> def ipad(N,iterable, default = None): ... return it.islice(it.chain(iterable, it.repeat(default)), N) ... >>> a,b

Re: list unpack trick?

2005-01-22 Thread Nick Coghlan
aurora wrote: I am think more in the line of string.ljust(). So if we have a list.ljust(length, filler), we can do something like name, value = s.split('=',1).ljust(2,'') Eh? Py> s.split('=',1).ljust(2,'') Traceback (most recent call last): File "", line 1, in ? AttributeError: 'list' object

Re: dynamic call of a function

2005-01-22 Thread Nick Coghlan
kishore wrote: Hi Luigi Ballabio, Thankyou very much for your reply, it worked well. It does work in most cases, but "getattr(self, methodName)" is generally to be preferred over "vars(self.__class__)[methodName]", as the latter does not use Python's standard attribute lookup scheme. The semanti

Re: getting file size

2005-01-22 Thread Tim Roberts
Bob Smith <[EMAIL PROTECTED]> wrote: >Are these the same: > >1. f_size = os.path.getsize(file_name) > >2. fp1 = file(file_name, 'r') >data = fp1.readlines() >last_byte = fp1.tell() > >I always get the same value when doing 1. or 2. Is there a reason I >should do both? When reading to the

Re: Zen of Python

2005-01-22 Thread Tim Peters
[Tim Peters] >> But at that time, Python didn't have lexical scoping, and it wasn't >> clear that it ever would. So what's the bigger wart? Making >> listcomps exactly equivalent to an easily-explained Python for-loop >> nest, or introducing a notion of lexical scope unique to listcomps, >> hard

Re: specifying constants for a function (WAS: generator expressions: performance anomaly?)

2005-01-22 Thread Bengt Richter
On Sat, 22 Jan 2005 16:22:33 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >Steven Bethard wrote: >> I wrote: >> > If you really want locals that don't contribute to arguments, I'd be >> > much happier with something like a decorator, e.g.[1]: >> > >> > @with_consts(i=1, deftime=time.ctime())

Re: What YAML engine do you use?

2005-01-22 Thread Steve Holden
Doug Holton wrote: Fredrik Lundh wrote: and trust me, when things are hard to get right for developers, users will suffer too. That is exactly why YAML can be improved. But XML proves that getting it "right" for developers has little to do with getting it right for users (or for saving bandwid

Re: [OT] XML design intent ... further musings

2005-01-22 Thread Paul Rubin
Stephen Waterbury <[EMAIL PROTECTED]> writes: > I should note that I have to deal with XML a lot, but always > kicking and screaming (though much less now because of Fredrik's > Elementtree package ;). Thanks, Fredrik and Peter, for the > references. ;) I love this old rant about XML: http://gr

Re: What YAML engine do you use?

2005-01-22 Thread Leif K-Brooks
Bengt Richter wrote: I thought XML was a good idea, but IMO requiring quotes around even integer attribute values was an unfortunate decision. I think it helps guard against incompetent authors who wouldn't understand when they're required to use quotes and when they're not. I see HTML pages all

Re: embedding jython in CPython...

2005-01-22 Thread Jim Hargrave
Sorry - should have given more detail. That's what I get for posting at 1:00AM. What I want to do us write scripts in CPython that access Windows ActiveX such as Word and IE. Obviously Jython can't do this (easily at least). I also have Jython scripts that provide a high level layer on top of

Re: problems with duplicating and slicing an array

2005-01-22 Thread David Isaac
Yun Mao wrote: >a[ [1,0], [0,1] ] , which should give me >[[4, 5], [1,2]] Numeric: take(take(a,[1,0]),[0,1],1) fwiw, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] XML design intent ... further musings

2005-01-22 Thread Stephen Waterbury
Peter Hansen wrote: If merely thinking about the purpose of XML doesn't make it clear where Steve got that idea ... I meant no disparagement of Steve, and it is quite clear where he got that (correct!) idea ... It's also clear that the XML user community sees that as part of *their* purpose in appl

Re: What's so funny? WAS Re: rotor replacement

2005-01-22 Thread Paul Rubin
Brian van den Broek <[EMAIL PROTECTED]> writes: > no Python expert, just a hobbyist. But, I think I can take this one on: > > Fredrik's contributed a lot to Python. The Standard Library book, > several well know tools, and, I'd wager a finger, a fair bit of code > in the standard lib. I don't thin

Re: embedding jython in CPython...

2005-01-22 Thread johng2001
> As for using JPype ... well it depends on what you want to script. if > you Java code is the main app, I'd eschew CPython completely and use > Jython to script. If you main app is in Python, and the Java code is > "simply" libraries you wish to use, then I'f go with CPython + Jpype. It > is very

What's so funny? WAS Re: rotor replacement

2005-01-22 Thread Brian van den Broek
Paul Rubin said unto the world upon 2005-01-22 20:16: "Fredrik Lundh" <[EMAIL PROTECTED]> writes: You're not making any bloody sense. oh, I make perfect sense, and I think most people here understand why I found your little "lecture" so funny. if you still don't get it, maybe some- one can explain

Re: [OT] XML design intent [was Re: What YAML engine do you use?]

2005-01-22 Thread Peter Hansen
Stephen Waterbury wrote: it's interesting to note that the intent Steve Holden imputed to it earlier is not explicitly among them: Steve Holden wrote: It seems to me the misunderstanding here is that XML was ever intended to be generated directly by typing in a text editor. It was rather intended

Re: rotor replacement

2005-01-22 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > > You're not making any bloody sense. > > oh, I make perfect sense, and I think most people here understand > why I found your little "lecture" so funny. if you still don't get > it, maybe some- one can explain it to you. I would appreciate it if som

debugging xmlrpc servers

2005-01-22 Thread alan dot ezust at gmail dot com
Problems with XMLRPC I have an xmlrpc server with a method called results() which returns an XML message. I've been able to use this function without problems when I had only one client talking to one server. I have recently introduced a P2P aspect to this process and now I have servers calling e

Python Scripting

2005-01-22 Thread Ali Polatel
  Hi Dear Python programmers,   I want to ask you a question about python scripting.I want to know if I can design web-pages with python or at least write html files with python. and if I write html files with python and some CGI scripts and upload them to the web-page .. does the people who view t

Re: rotor replacement

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: >> you really don't have a fucking clue about anything, do you? > > You're not making any bloody sense. oh, I make perfect sense, and I think most people here understand why I found your little "lecture" so funny. if you still don't get it, maybe some- one can explain it to you

[OT] XML design intent [was Re: What YAML engine do you use?]

2005-01-22 Thread Stephen Waterbury
Fredrik Lundh wrote: Stephen Waterbury wrote: The premise that XML had a coherent design intent stetches my credulity beyond its elastic limit. the design goals are listed in section 1.1 of the specification. see tim bray's annotated spec for additional comments by one of the team members: http

Re: finding name of instances created

2005-01-22 Thread André
Steven Bethard wrote: > If you have access to the user module's text, something like this might > be a nicer solution: > > py> class Robot(object): > ... def __init__(self): > ... self.name = None > ... def move(self): > ... print "robot %r moved" % self.name > ... > py> cl

Re: rotor replacement

2005-01-22 Thread Paul Rubin
"A.M. Kuchling" <[EMAIL PROTECTED]> writes: > It was discussed in this thread: > http://mail.python.org/pipermail/python-dev/2003-April/034959.html In that thread, you wrote: > Rubin wanted to come up with a nice interface for the module, and > has posted some notes toward it. I have an existing

Re: What YAML engine do you use?

2005-01-22 Thread Tim Parkin
Doug Holton wrote: > That is exactly why YAML can be improved. But XML proves that getting > it "right" for developers has little to do with getting it right for > users (or for saving bandwidth). What's right for developers is what > requires the least amount of work. The problem is, that's

Re: need help on need help on generator...

2005-01-22 Thread Terry Reedy
"Francis Girard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >If I understand correctly, Almost... > a "generator" produce something over which you can > iterate with the help of an "iterator". To be exact, the producer is a generator function, a function whose body contains

Re: debugging process

2005-01-22 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > I think that this must have something to do with python expecting > itself to by in a TTY? Can anyone give any idea of where I should be > going with this? http://pexpect.sourceforge.net/ Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] 20050121 file reading & writing

2005-01-22 Thread Bob Smith
Xah Lee wrote: # reading entire file as a list, of lines # mylist = f.readlines() To do this efficiently on a large file (dozens or hundreds of megs), you should use the 'sizehint' parameter so as not to use too much memory: sizehint = 0 mylist = f.readlines(sizehint) -- http://mail.python.org

RFC: Python bindings to Linux i2c-dev

2005-01-22 Thread Mark M. Hoffman
SMBus [3]. [1] http://members.dca.net/mhoffman/sensors/python/20050122/ [2] http://archives.andrew.net.au/lm-sensors/msg28792.html [3] http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/doc/useful_addresses.html Thanks and regards, -- Mark M. Hoffman [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: rotor replacement

2005-01-22 Thread Paul Rubin
[EMAIL PROTECTED] (John J. Lee) writes: > > Building larger ones seems to > > have complexity exponential in the number of bits, which is not too > > Why? The way I understand it, that 7-qubit computer was based on embedding the qubits on atoms in a large molecule, then running the computation pr

Re: What YAML engine do you use?

2005-01-22 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > I wonder, however, if, as an even "toyer" exercise, one might not > already do it easily -- by first checking each token (as generated by > tokenize.generate_tokens) to ensure it's safe, and THEN eval _iff_ no > unsafe tokens were found in the check. I d

Re: rotor replacement

2005-01-22 Thread John J. Lee
Paul Rubin <"http://phr.cx"@NOSPAM.invalid> writes: [...] > Building larger ones seems to > have complexity exponential in the number of bits, which is not too [...] Why? > It's not even known in theory whether quantum computing is > possible on a significant scale. Discuss. (I don't mean I'm

debugging process

2005-01-22 Thread jimbo
Hi, I am trying to create a separate process that will launch python and then can be used to step through a script programmatically. I have tried something like: (input, output) = os.popen2(cmd="python") Then I expected I could select over the two handles input and output, make sure they aren't

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
Alex Martelli wrote: >>[1, 2, 'Joe Smith', 8237972883334L, # comment >> {'Favorite fruits': ['apple', 'banana', 'pear']}, # another comment >> 'xyzzy', [3, 5, [3.14159, 2.71828, [ >> >> I don't see what YAML accomplishes that something like the above wouldn't. >> >> Note tha

Re: What YAML engine do you use?

2005-01-22 Thread Michael Spencer
Paul Rubin wrote: YAML looks to me to be completely insane, even compared to Python lists. I think it would be great if the Python library exposed an interface for parsing constant list and dict expressions, e.g.: [1, 2, 'Joe Smith', 8237972883334L, # comment {'Favorite fruits': ['apple

Re: What YAML engine do you use?

2005-01-22 Thread Alex Martelli
Paul Rubin wrote: ... > lists. I think it would be great if the Python library exposed an > interface for parsing constant list and dict expressions, e.g.: > >[1, 2, 'Joe Smith', 8237972883334L, # comment > {'Favorite fruits': ['apple', 'banana', 'pear']}

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
Stephen Waterbury wrote: > The premise that XML had a coherent design intent > stetches my credulity beyond its elastic limit. the design goals are listed in section 1.1 of the specification. see tim bray's annotated spec for additional comments by one of the team members: http://www.xml.co

Re: What YAML engine do you use?

2005-01-22 Thread rm
Doug Holton wrote: rm wrote: this implementation of their idea. But I'd love to see a generic, pythonic data format. That's a good idea. But really Python is already close to that. A lot of times it is easier to just write out a python dictionary than using a DB or XML or whatever. Python is

Re: What YAML engine do you use?

2005-01-22 Thread Stephen Waterbury
Steve Holden wrote: It seems to me the misunderstanding here is that XML was ever intended to be generated directly by typing in a text editor. It was rather intended (unless I'm mistaken) as a process-to-process data interchange metalanguage that would be *human_readable*. The premise that XML

Re: What YAML engine do you use?

2005-01-22 Thread Paul Rubin
Daniel Bickett <[EMAIL PROTECTED]> writes: > In my (brief) experience with YAML, it seemed like there were several > different ways of doing things, and I saw this as one of it's failures > (since we're all comparing it to XML). YAML looks to me to be completely insane, even compared to Python lis

Re: getting file size

2005-01-22 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Bob Smith wrote: > Are these the same: > > 1. f_size = os.path.getsize(file_name) > > 2. fp1 = file(file_name, 'r') > data = fp1.readlines() > last_byte = fp1.tell() > > I always get the same value when doing 1. or 2. Is there a reason I > should do both? When r

Re: IDLE Problem in Windows XP

2005-01-22 Thread Josiah Carlson
Branden Smith <[EMAIL PROTECTED]> wrote: > > Hi, > > I am a teaching assistant for an introductory course at Georgia Tech > which uses Python, and I have a student who has been unable to start > IDLE on her Windows XP Home Edition machine. Clicking on the shortcut > (or the program executable) c

Re: What YAML engine do you use?

2005-01-22 Thread Daniel Bickett
Doug Holton wrote: > What do you expect? YAML is designed for humans to use, XML is not. > YAML also hasn't had the backing and huge community behind it like XML. > XML sucks for people to have to write in, but is straightforward to > parse. The consequence is hordes of invalid XML files, leading

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
"rm" <[EMAIL PROTECTED]> wrote: > furthermore, "users will suffer too", I'm suffering if I have to use C++, > with all its exceptions > and special cases. and when you suffer, your users will suffer. in the C++ case, they're likely to suffer from spurious program crashes, massively delayed dev

Re: rotor replacement

2005-01-22 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > > Excellent. I hope you will re-read it several times a day. Doing > > that might improve your attitude. > > you really don't have a fucking clue about anything, do you? You're not making any bloody sense. I explained to you why I wasn't interested

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
rm wrote: this implementation of their idea. But I'd love to see a generic, pythonic data format. That's a good idea. But really Python is already close to that. A lot of times it is easier to just write out a python dictionary than using a DB or XML or whatever. Python is already close to YA

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Fredrik Lundh wrote: and trust me, when things are hard to get right for developers, users will suffer too. That is exactly why YAML can be improved. But XML proves that getting it "right" for developers has little to do with getting it right for users (or for saving bandwidth). What's right fo

Re: What YAML engine do you use?

2005-01-22 Thread rm
Fredrik Lundh wrote: "rm" <[EMAIL PROTECTED]> wrote: 100% right on, stuff (like this)? should be easy on the users, and if possible, on the developers, not the other way around. I guess you both stopped reading before you got to the second paragraph in my post. YAML (at least the version descri

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
"rm" <[EMAIL PROTECTED]> wrote: > 100% right on, stuff (like this)? should be easy on the users, and if > possible, on the developers, > not the other way around. I guess you both stopped reading before you got to the second paragraph in my post. YAML (at least the version described in that sp

Re: default value in a list

2005-01-22 Thread Reinhold Birkenfeld
Michael Spencer wrote: > Alex Martelli wrote: > [explanation and the following code:] > >> >>> a, b, c = it.islice( >> ... it.chain( >> ... line.split(':'), >> ... it.repeat(some_default), >> ... ), >> ... 3) >> ...

Re: default value in a list

2005-01-22 Thread Michael Spencer
Alex Martelli wrote: [explanation and the following code:] >>> a, b, c = it.islice( ... it.chain( ... line.split(':'), ... it.repeat(some_default), ... ), ... 3) ... ... >>> def pad_with_default(N, iter

Re: What YAML engine do you use?

2005-01-22 Thread rm
Doug Holton wrote: What do you expect? YAML is designed for humans to use, XML is not. YAML also hasn't had the backing and huge community behind it like XML. XML sucks for people to have to write in, but is straightforward to parse. The consequence is hordes of invalid XML files, leading to n

Re: default value in a list

2005-01-22 Thread Nick Craig-Wood
Alex Martelli <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > ... > > Or this version if you want something other than "" as the default > > > > a, b, b = (line.split(':') + 3*[None])[:3] > > Either you mean a, b, c -- or you're being subtler than I'm > grasping

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Fredrik Lundh wrote: A.M. Kuchling wrote: IMHO that's a bit extreme. Specifications are written to be detailed, so consequently they're torture to read. Seen the ReStructured Text spec lately? I've read many specs; YAML (both the spec and the format) is easily among the worst ten-or-so specs I'

Re: rotor replacement

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: > Excellent. I hope you will re-read it several times a day. Doing > that might improve your attitude. you really don't have a fucking clue about anything, do you? -- http://mail.python.org/mailman/listinfo/python-list

Re: rotor replacement

2005-01-22 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > "lack of understanding of how Python is used" > > wonderful. I'm going to make a poster of your post, and put it on my > office wall. Excellent. I hope you will re-read it several times a day. Doing that might improve your attitude. -- http://mail

Re: embedding jython in CPython...

2005-01-22 Thread Steve Menard
Jim Hargrave wrote: I've read that it is possible to compile jython to native code using GCJ. PyLucene uses this approach, they then use SWIG to create a Python wrapper around the natively compiled (java) Lucene. Has this been done before for with jython? Another approach would be to use JPype

Re: Class introspection and dynamically determining function arguments

2005-01-22 Thread Mike C. Fletcher
Bengt Richter wrote: On Fri, 21 Jan 2005 20:23:58 -0500, "Mike C. Fletcher" <[EMAIL PROTECTED]> wrote: On Thu, 20 Jan 2005 11:24:12 -, "Mark English" <[EMAIL PROTECTED]> wrote: ... Does the BasicProperty base class effectively register itself as an observer of subclass properties and

Re: rotor replacement

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: > 2. "Would anyone except me have any use for this?" shows a lack of > understanding of how Python is used. Some users (call them > "application users" or AU's) use Python to run Python applications for > whatever purpose. Some other users (call them "developers") use > Python

Re: list unpack trick?

2005-01-22 Thread aurora
Thanks. I'm just trying to see if there is some concise syntax available without getting into obscurity. As for my purpose Siegmund's suggestion works quite well. The few forms you have suggested works. But as they refer to list multiple times, it need a separate assignment statement like

Re: [OT] Good C++ book for a Python programmer

2005-01-22 Thread Ville Vainio
> "Rick" == rick [EMAIL PROTECTED] com <[EMAIL PROTECTED]> writes: Rick> I was wondering whether anyone could recommend a good C++ Rick> book, with "good" being defined from the perspective of a Rick> Python programmer. I A good C++ book from the perspective of a Python programmer

Re: finding name of instances created

2005-01-22 Thread Scott David Daniels
Andrà Roberge wrote: Craig Ringer wrote: On Fri, 2005-01-21 at 16:13 -0800, Andrà wrote: Short version of what I am looking for: Given a class "public_class" which is instantiated a few times e.g. a = public_class() b = public_class() c = public_class() I would like to find out the name of the inst

Re: Zen of Python

2005-01-22 Thread Paul Rubin
"Andrew Koenig" <[EMAIL PROTECTED]> writes: > Actually, I don't think so. If you intend for it to be impossible for "z = > x" to refer to the x in the list comprehension, you shouldn't mind putting > in "from __future__ import lexical_comprehensions." If you don't intend for > it to be impossi

Re: Reload Tricks

2005-01-22 Thread Michael Spencer
Kamilche wrote: I want my program to be able to reload its code dynamically. I have a large hierarchy of objects in memory. The inheritance hierarchy of these objects are scattered over several files. Michael Spencer wrote: An alternative approach (with some pros and cons) is to modify the class in

Re: Zen of Python

2005-01-22 Thread Andrew Koenig
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > It's not obvious to me how the compiler can tell. Consider: > >x = 3 >if frob(): > frobbed = True > squares = [x*x for x in range(9)] >if blob(): > z = x > > Should the compiler issue

Re: Zen of Python

2005-01-22 Thread Paul Rubin
"Andrew Koenig" <[EMAIL PROTECTED]> writes: > In this case, I think the right solution to the problem is two-fold: > > 1) from __future__ import lexical_comprehensions > > 2) If you don't import the feature, and you write a program that depends > on a list-comprehension variable rema

Re: Zen of Python

2005-01-22 Thread Andrew Koenig
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > It's really irrelevant whether anyone is using a feature or not. If > the feature is documented as being available, it means that removing > it is an incompatible change that can break existing code which > current

Re: Zen of Python

2005-01-22 Thread Andrew Koenig
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > in some early C++ compilers, the scope for "x" was limited to the scope > containing the for loop, not the for loop itself. some commercial > compilers > still default to that behaviour. Indeed--and the standards com

Re: rotor replacement

2005-01-22 Thread Paul Rubin
"A.M. Kuchling" <[EMAIL PROTECTED]> writes: > It was discussed in this thread: > http://mail.python.org/pipermail/python-dev/2003-April/034959.html > > Guido and M.-A. Lemburg were leaning against including crypto; everyone else > was positive. But Guido's the BDFL, so I interpreted his vote as b

Re: rotor replacement

2005-01-22 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > "I'll only work on stuff if I'm sure it's going right into the core" > isn't exactly a great way to develop good Python software. I > recommend the "would anyone except me have any use for this?" > approach. 1. Crypto is an important "battery" for man

Re: What YAML engine do you use?

2005-01-22 Thread Steve Holden
Bengt Richter wrote: On Fri, 21 Jan 2005 12:04:10 -0600, "A.M. Kuchling" <[EMAIL PROTECTED]> wrote: On Fri, 21 Jan 2005 18:30:47 +0100, rm <[EMAIL PROTECTED]> wrote: Nowadays, people are trying to create binary XML, XML databases, graphics in XML (btw, I'm quite impressed by SVG), you have XSL

Re: Zen of Python

2005-01-22 Thread Arthur
On 21 Jan 2005 20:32:46 -0800, Paul Rubin wrote: >Of course in that case, since the absence of lexical scope was a wart >in its own right, fixing it had to have been on the radar. So turning >the persistent listcomp loop var into a documented feature, instead of >descri

Re: rotor replacement

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: > Martin, do you know more about this? I remember being disappointed > about the decisions since I had done some work on a new block cipher > API and I had wanted to submit an implementation to the distro. But > when I heard there was no hope of including it, I stopped working

Re: rotor replacement

2005-01-22 Thread A.M. Kuchling
On 22 Jan 2005 04:50:30 -0800, Paul Rubin wrote: > Martin, do you know more about this? I remember being disappointed > about the decisions since I had done some work on a new block cipher It was discussed in this thread: http://mail.python.org/pipermail/python-dev/2003-April/034959.htm

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
Reinhold Birkenfeld wrote: > Agreed. If you just want to use it, you don't need the spec anyway. but the guy who wrote the parser you're using had to read it, and understand it. judging from the number of crash reports you see in this thread, chances are that he didn't. -- http://mail.pyt

Re: Zen of Python

2005-01-22 Thread Fredrik Lundh
Alex Martelli wrote: >> I do remember seeing some cute tricks (i.e. capable of becoming >> idioms) that depend on the leakage. > > Sure, ``if [mo for mo in [myre.search(line)] if mo]: use(mo)`` and the > like, used to simulate assign-and-test. here's an old favourite: lambda x: ([d for d in

Re: default value in a list

2005-01-22 Thread Bengt Richter
On Fri, 21 Jan 2005 17:04:11 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote: >TB wrote: > >> Hi, >> >> Is there an elegant way to assign to a list from a list of unknown >> size? For example, how could you do something like: >> >> > a, b, c = (line.split(':')) >> >> if line could have less

Re: Zen of Python

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: >> > Some languages let you say things like: >> > for (var x = 0; x < 10; x++) >> > do_something(x); >> > and that limits the scope of x to the for loop. >> >> depending on the compiler version, compiler switches, IDE settings, etc. > > Huh? I'm not sure what you're talki

Re: Zen of Python

2005-01-22 Thread Alex Martelli
Paul Rubin wrote: > Dave Benjamin <[EMAIL PROTECTED]> writes: > > Can we get a show of hands for all of those who have written or are > > currently maintaining code that uses the leaky listcomp "feature"? > > It's really irrelevant whether anyone is using a feature or n

Re: Zen of Python

2005-01-22 Thread Alex Martelli
Paul Rubin wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > If it changed the semantics of for-loops in general, that would be quite > > inconvenient to me -- once in a while I do rely on Python's semantics > > (maintaining the loop control variable after a break;

Re: [perl-python] 20050121 file reading & writing

2005-01-22 Thread Gian Mario Tagliaretti
Xah Lee wrote: > # the second argument of open can be > # 'w' for write (overwrite exsiting file) > # 'a' for append (ditto) > # 'r' or read only are you sure you didn't forget something? > # reading the one line > # line = f.realine() wrong > [...] Maybe you didn't get the fact the you won't

Re: Zen of Python

2005-01-22 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > > Some languages let you say things like: > > for (var x = 0; x < 10; x++) > > do_something(x); > > and that limits the scope of x to the for loop. > > depending on the compiler version, compiler switches, IDE settings, etc. Huh? I'm not sure

Re: rotor replacement

2005-01-22 Thread Paul Rubin
Nick Craig-Wood <[EMAIL PROTECTED]> writes: > > No, unfortunately; the python-dev consensus was that encryption raised > > export control issues, and the existing rotor module is now on its way to > > being removed. > > I'm sure thats wrong now-a-days. Here are some examples of open > source soft

Re: Zen of Python

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: > Some languages let you say things like: > for (var x = 0; x < 10; x++) > do_something(x); > and that limits the scope of x to the for loop. depending on the compiler version, compiler switches, IDE settings, etc. -- http://mail.python.org/mailman/listinfo/python-

Re: Zen of Python

2005-01-22 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > If it changed the semantics of for-loops in general, that would be quite > inconvenient to me -- once in a while I do rely on Python's semantics > (maintaining the loop control variable after a break; I don't recall if > I ever used the fact that the vari

Re: finding name of instances created

2005-01-22 Thread André
Jeremy Bowers wrote: > On Fri, 21 Jan 2005 21:01:00 -0400, André Roberge wrote: > > etc. Since I want the user to learn Python's syntax, I don't want to > > require him/her to write > > alex = CreateRobot(name = 'alex') > > to then be able to do > > alex.move() > > This is just my opinion, but I'v

Re: Zen of Python

2005-01-22 Thread Paul Rubin
Dave Benjamin <[EMAIL PROTECTED]> writes: > Can we get a show of hands for all of those who have written or are > currently maintaining code that uses the leaky listcomp "feature"? It's really irrelevant whether anyone is using a feature or not. If the feature is documented as being available, it

Re: Unbinding multiple variables

2005-01-22 Thread Bengt Richter
On 21 Jan 2005 11:13:20 -0800, "Johnny Lin" <[EMAIL PROTECTED]> wrote: >thanks everyone for the replies! > >John Hunter, yep, this is Johnny Lin in geosci :). > >re using return: the problem i have is somewhere in my code there's a >memory leak. i realize return is supposed to unbind all the loc

  1   2   >