Re: Feature request: String-inferred names

2009-11-25 Thread Lie Ryan
Brad wrote: On Nov 25, 10:49 pm, Chris Rebert wrote: On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy wrote: Hello all, I just posted to my blog about a feature that I'd like to see added to Python. Before I go through the trouble of learning how to write a PEP or how to extend the Python inte

Re: Can "self" crush itself?

2009-11-26 Thread Lie Ryan
n00m wrote: Ok ok Of course, it's a local name; -- just my silly slip. And seems it belongs to no dict[]... Just an internal volatile elf Local names are not implemented as dict, but rather as sort of an array in the compiler. The name resolution of locals is compile time and doesn't use dict

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread Lie Ryan
Jean-Michel Pichavant wrote: Peng Yu wrote: There are some assertion code (testing if a condition is false, if it is false, raise an Error object) in my python, which is useful when I test my package. But such case would never occur when in the produce code. If I keep them in if statement, it w

Re: string payload expected: error

2009-11-26 Thread Lie Ryan
Ramdas wrote: Dear all, I believe this is an error which was fixed in Python 2.3 itself. But I am running Python 2,5.2 and error keeps on cropping up. Here is my code to construct emails . It works perfectly when I dont have any attachments. Please find my code at http://dpaste.com/hold/125574

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/19/10 14:57, Steve Howell wrote: > In a more real world example, the intermediate results would be > something like this: > >departments >departments_in_new_york >departments_in_new_york_not_on_bonus_cycle >employees_in_departments_in_new_york_not_on_bonus_cycle >names_of

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Lie Ryan
On 02/20/10 13:32, MattB wrote: > > I'm using the network in my own apartment. Not the campus's. > Moreover, my mac's MAC address is different from the MAC address shown > by my router, but as I said I'm also blocked when using my friend's > wireless router at his apartment. > > So it must be my

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/20/10 17:30, Lawrence D'Oliveiro wrote: > In message , Rhodri James wrote: > >> In classic Pascal, a procedure was distinct from a function in that it had >> no return value. The concept doesn't really apply in Python; there are no >> procedures in that sense, since if a function terminates

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/20/10 18:17, sjdevn...@yahoo.com wrote: > On Feb 20, 1:30 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> In message , Rhodri James wrote: >> >>> In classic Pascal, a procedure was distinct from a function in that it had >>> no return value. The concept doesn't really apply in Py

Re: Can I embedding a (python) console on python program?

2010-02-19 Thread Lie Ryan
On 02/20/10 16:38, Kee K Y CHEN wrote: > HI All, > > Apologize for being a newbie to python area and sorry for my English. > > Actually what I need is embedding a python interactive console(or other > shell console alike module) on my python program for debugging and > controlling purpose during

Re: Capturing errors raised by other scripts ?

2010-02-20 Thread Lie Ryan
On 02/20/10 14:39, northof40 wrote: > On Feb 20, 4:13 pm, MRAB wrote: >> northof40 wrote: >>> I'm using the subroutine module to run run python script A.py from >>> B.py (this is on windows fwiw). >> >>> A.py is not my script and it may raise arbitary errors before exiting. >>> How can I determine

Re: Can't Access ANY url from python (errno 61)

2010-02-20 Thread Lie Ryan
On 02/20/10 19:36, MattB wrote: > On Feb 20, 2:02 am, Lie Ryan wrote: >> On 02/20/10 13:32, MattB wrote: >> >> >> >>> I'm using the network in my own apartment. Not the campus's. >>> Moreover, my mac's MAC address is different from th

Re: Is there a way to continue after an exception ?

2010-02-20 Thread Lie Ryan
> On Sun, Feb 21, 2010 at 12:52 AM, Stef Mientki wrote: >> hello, >> >> I would like my program to continue on the next line after an uncaught >> exception, >> is that possible ? >> >> thanks >> Stef Mientki >> That reminds me of VB's "On Error Resume Next" -- http://mail.python.org/mailman/list

Re: Is there a way to continue after an exception ?

2010-02-20 Thread Lie Ryan
On 02/21/10 12:02, Stef Mientki wrote: > On 21-02-2010 01:21, Lie Ryan wrote: >>> On Sun, Feb 21, 2010 at 12:52 AM, Stef Mientki wrote: >>> >>>> hello, >>>> >>>> I would like my program to continue on the next line after an uncaught

Re: Pure virtual functions in Python?

2010-02-21 Thread Lie Ryan
On 02/21/10 19:27, lallous wrote: > If the base defines the method and it was empty, then my C++ code > would still call the function. This is not optimal because I don't > want to go from C++ to Python if the _derived_ class does not > implement the cb. That sounds like a microoptimization; hav

Re: lists of variables

2010-02-21 Thread Lie Ryan
On 02/21/10 15:21, Steven D'Aprano wrote: >> > So it looks like variables in a list are stored as object references. > Python doesn't store variables in lists, it stores objects, always. > > Even Python variables aren't variables *grin*, although it's really > difficult to avoid using the term. P

Re: Reading a large bz2 textfile exits early

2010-02-22 Thread Lie Ryan
On 02/22/10 19:43, Norman Rieß wrote: > Am 02/22/10 09:02, schrieb Steven D'Aprano: >> On Mon, 22 Feb 2010 07:49:51 +0100, Norman Rieß wrote: >> >> >>> This is the actual code: >>> >>> source_file = bz2.BZ2File(file, "r") >>> for line in source_file: >>> print line.strip() >>> >>> print "E

Re: Signature-based Function Overloading in Python

2010-02-23 Thread Lie Ryan
On 02/24/10 05:25, Michael Rudolf wrote: > Just a quick question about what would be the most pythonic approach in > this. > > In Java, Method Overloading is my best friend, but this won't work in > Python: > So - What would be the most pythonic way to emulate this? > Is there any better Idom tha

Re: Spam from gmail (Was: fascism)

2010-02-23 Thread Lie Ryan
On 02/24/10 11:21, Aahz wrote: > In article , > D'Arcy J.M. Cain wrote: >> On Tue, 23 Feb 2010 02:54:25 -0800 (PST) >> Joan Miller wrote: >>> >>> *Sorry by this message off topic, but this is too important* >> >> Is it just me or has the spew from gmail on this list radically >> increased in the

Re: What's Going on between Python and win7?

2010-02-23 Thread Lie Ryan
On 02/23/10 05:30, W. eWatson wrote: > On 2/22/2010 8:29 AM, Grant Edwards wrote: >> On 2010-02-22, W. eWatson wrote: >> >>> Last night I copied a program from folder A to folder B. >> >> [tail of various windows breakages elided] >> >>> Comments? >> >> Switch to Linux? >> >> Or at least install C

Re: When will Java go mainstream like Python?

2010-02-23 Thread Lie Ryan
On 02/24/10 12:08, Nobody wrote: > On Wed, 24 Feb 2010 12:22:05 +1300, Lawrence D'Oliveiro wrote: > >>> Java - The JVM code been hacked to death by Sun engineers (optimised) >>> Python - The PVM code has seen speed-ups in Unladen or via Pyrex.. >>> ad-infinitum but nowhere as near to JVM >> >> Pyt

Re: Spam from gmail (Was: fascism)

2010-02-23 Thread Lie Ryan
On 02/24/10 12:38, Steven D'Aprano wrote: > On Wed, 24 Feb 2010 00:06:09 +0100, Daniel Fetchinson wrote: > >>> Hmm. I wonder if all the spam is coming from the NG side. I'll have >>> to look at that. One of the reasons that I stopped reading UseNet over >>> ten years ago was because of the dimi

Re: Is this secure?

2010-02-23 Thread Lie Ryan
On 02/24/10 14:09, Robert Kern wrote: > On 2010-02-23 20:43 , Steven D'Aprano wrote: >> On Wed, 24 Feb 2010 02:40:13 +, Steven D'Aprano wrote: >> >>> On Tue, 23 Feb 2010 15:36:02 +0100, mk wrote: >>> The question is: is this secure? That is, can the string generated this way be consid

Re: Can't Access ANY url from python (errno 61)

2010-02-25 Thread Lie Ryan
On 02/24/10 17:07, MattB wrote: > All -- problem solved. Following Lie's suggestions, and the links > from those pages, I went hunting around in my /library/preferences/ > SystemConfiguration/. I opened all of the 6 or 7 files that were in > there, and all looked as if they contained info directl

Re: When will Java go mainstream like Python?

2010-02-25 Thread Lie Ryan
On 02/25/10 07:40, Wanja Gayk wrote: > Am 24.02.2010, 00:22 Uhr, schrieb Lawrence D'Oliveiro > : > >>> Java - The JVM code been hacked to death by Sun engineers (optimised) >>> Python - The PVM code has seen speed-ups in Unladen or via Pyrex.. >>> ad-infinitum but nowhere as near to JVM >> >> Pyth

Re: What's the word on using """ to comment-out?

2010-02-25 Thread Lie Ryan
On 02/25/10 05:18, kj wrote: > I think I remember, early in my learning of Python, coming across > the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT > LINES OF CODE", or something to that effect. But now I can't find > it! I've never heard of it, though I can think of a few reasons

Re: Docstrings considered too complicated

2010-03-01 Thread Lie Ryan
On 03/02/10 00:09, Andreas Waldenburger wrote: > On Mon, 1 Mar 2010 05:01:49 -0800 (PST) alex23 > wrote: > >> Andreas Waldenburger wrote: >>> But as I said: a) I am (we are) not in a position to impose this (We >>> don't work with the code, we just run the software). >> >> I personally believe t

Re: Is this secure?

2010-03-02 Thread Lie Ryan
On 02/25/2010 06:16 AM, mk wrote: > On 2010-02-24 20:01, Robert Kern wrote: >> I will repeat my advice to just use random.SystemRandom.choice() instead >> of trying to interpret the bytes from /dev/urandom directly. > > Out of curiosity: > > def gen_rand_string(length): > prng = random.System

Re: cpan for python?

2010-03-02 Thread Lie Ryan
On 03/03/2010 09:47 AM, TomF wrote: > On 2010-03-02 13:14:50 -0800, R Fritz said: > >> On 2010-02-28 06:31:56 -0800, sstein...@gmail.com said: >>> >>> On Feb 28, 2010, at 9:28 AM, Someone Something wrote: >>> Is there something like cpan for python? I like python's syntax, but Iuse perl

Re: Docstrings considered too complicated

2010-03-03 Thread Lie Ryan
On 03/03/2010 04:48 PM, Steven D'Aprano wrote: > Or one can simply use *reason*: what justification is there for putting > comments in strings at the top of the function? The only one I can see is > if you are writing for an embedded device, you may want to remove doc > strings to save memory --

Re: There should be one-- and preferably only one --obvious way to do it (was "Interest check in some delicious syntactic sugar for "except:pass"")

2010-03-03 Thread Lie Ryan
On 03/03/2010 08:27 PM, Oren Elrad wrote: > Howdy all, longtime appreciative user, first time mailer-inner. > > I'm wondering if there is any support (tepid better than none) for the > following syntactic sugar: > > silence: > . block > > -> > > try: > .b

Re: Asynchronous HTTP client

2010-03-07 Thread Lie Ryan
On 03/07/2010 05:53 PM, Ping wrote: > Hi, > > I'm trying to find a way to create an asynchronous HTTP client so I > can get responses from web servers in a way like > > async_http_open('http://example.com/', callback_func) > # immediately continues, and callback_func is called with response >

Re: to pass self or not to pass self

2010-03-16 Thread Lie Ryan
On 03/17/2010 05:59 AM, Jason Tackaberry wrote: > On Tue, 2010-03-16 at 10:04 +0100, Bruno Desthuilliers wrote: >> Answer here: >> >> http://wiki.python.org/moin/FromFunctionToMethod > > I have a sense I used to know this once upon a time, but the question > came to my mind (possibly again) and I

Re: to pass self or not to pass self

2010-03-17 Thread Lie Ryan
On 03/17/2010 04:32 PM, Steven D'Aprano wrote: > On Wed, 17 Mar 2010 15:57:17 +1100, Lie Ryan wrote: > >> Most people probably would never need to use >> descriptor protocol directly, since the immediate benefit of descriptor >> protocol are property(), clas

Re: to pass self or not to pass self

2010-03-17 Thread Lie Ryan
On 03/17/2010 08:12 PM, Bruno Desthuilliers wrote: > Patrick Maupin a écrit : >> On Mar 16, 1:59 pm, Jason Tackaberry wrote: >>> Why not create the bound methods at instantiation time, rather than >>> using the descriptor protocol which has the overhead of creating a new >>> bound method each time

Re: StringChain -- a data structure for managing large sequences of chunks of bytes

2010-03-27 Thread Lie Ryan
On 03/22/2010 07:07 PM, Steven D'Aprano wrote: > Perhaps you should have said that it was a wrapper around deque giving > richer functionality, rather than giving the impression that it was a > brand new data structure invented by you. People are naturally going to > be more skeptical about a ne

Re: StringChain -- a data structure for managing large sequences ofchunks of bytes

2010-03-30 Thread Lie Ryan
On 03/29/2010 01:59 AM, Steven D'Aprano wrote: > On Sun, 28 Mar 2010 06:48:21 +1100, Lie Ryan wrote: > >> On 03/22/2010 07:07 PM, Steven D'Aprano wrote: >>> Perhaps you should have said that it was a wrapper around deque giving >>> richer functionality, r

Re: Classes as namespaces?

2010-03-30 Thread Lie Ryan
On 03/27/2010 10:28 PM, Jonathan Hartley wrote: > one might like to name the complex block of logic, just to make it > readable: > > > x = 1 > def account_for_non_square_pixels(x): >((some complex logic)) > account_for_non_square_pixels() > y = 2 > > > But defining and then calling the func

Re: off topic but please forgive me me and answer

2010-04-01 Thread Lie Ryan
On 04/02/10 13:01, Patrick Maupin wrote: > On Apr 1, 7:49 pm, Tim Chase wrote: >> David Robinow wrote: >>> $ python -c "print 1/2 * 1/2" >>> 0 >> >>> But that's not what I learned in grade school. >>> (Maybe I should upgrade to 3.1?) >> >> That's because you need to promote one of them to a float

Re: Good Intermediate Tutorials

2010-04-01 Thread Lie Ryan
On 04/02/10 11:25, Abethebabe wrote: > I've recently finished reading A Byte Of Python and have the basics of > Python down. I want to continue practice but I'm unsure what I can do. > So I started looking for tutorials to open my mind a little, but > everything I come across are beginner tutorials

Re: How to run python without python

2010-04-03 Thread Lie Ryan
On 04/03/10 06:24, John Bokma wrote: >> >> you think virtualbox could help? i wonder if one could run linux/ >> py2exe virtually on a win machine and get it working. > > Of course that works, a virtual windows machine is just a windows > machine ;-). > > Also that you can't do a "cross compilatio

Re: Which non SQL Database ?

2010-12-05 Thread Lie Ryan
On 12/05/10 10:43, Jorge Biquez wrote: > I do not see a good reason for not using Sqlite3 BUT if for some reason > would not be an option what plain schema of files would you use? Assuming you don't want SQL, you can use filesystem-based database. Most people doesn't realize that a filesystem

Re: Comparison with False - something I don't understand

2010-12-06 Thread Lie Ryan
On 12/05/10 15:52, Tim Harig wrote: > On 2010-12-05, Tim Harig wrote: >> Another, questionable but useful use, is to ignore the complex accounting >> of your position inside of a complex data structure. You can continue >> moving through the structure until an exception is raised indicating >> th

Re: Python critique

2010-12-11 Thread Lie Ryan
On 12/11/10 11:37, Dan Stromberg wrote: > On Fri, Dec 10, 2010 at 3:51 PM, John Nagle wrote: >> On 12/10/2010 3:25 PM, Stefan Behnel wrote: >>> Benjamin Kaplan, 11.12.2010 00:13: On Fri, Dec 10, 2010 at 5:46 PM, Octavian Rasnita wrote: The only scopes Python has are module and function.

Re: Python distribution recommendation?

2010-12-11 Thread Lie Ryan
On 12/11/10 23:43, Octavian Rasnita wrote: > Hi, > > Is there a "recommended" Python distribution for Windows XP? > > I know about the one that can be downloaded from python.org (which I am using > for the moment) and the one offered by ActiveState but I don't know which one > is better for a b

Re: off topic but please forgive me me and answer

2010-04-04 Thread Lie Ryan
On 04/04/10 13:01, Patrick Maupin wrote: > On Apr 3, 9:24 pm, Steven D'Aprano cybersource.com.au> wrote: >> To put it another way, even though there are an infinite number of >> rationals, they are vanishingly rare compared to the irrationals. If you >> could choose a random number from the real n

Re: Translation docstrings with gettext

2010-04-05 Thread Lie Ryan
On 04/05/10 20:31, sapient wrote: > Hello. > > I found several discussions where this question was asked, but was not > answered. Why would you want to translate docstring? Docstring is meant for developers not users. Maintaining a translated docstring is going to be a maintenance hell and will e

Re: Tkinter inheritance mess?

2010-04-05 Thread Lie Ryan
On 04/06/10 02:38, ejetzer wrote: > On 5 avr, 12:36, ejetzer wrote: >> For a school project, I'm trying to make a minimalist web browser, and >> I chose to use Tk as the rendering toolkit. I made my parser classes >> into Tkinter canvases, so that I would only have to call pack and >> mainloop fun

Re: How to output the commands that are executed in a python script?

2010-04-05 Thread Lie Ryan
On 04/06/10 12:38, Peng Yu wrote: > I want to show what commands have been executed when I run a python > script. Is there an option which can instruct python to print the > commands automatically? > > (If you are familiar with R, what I am asking is essentially > options(echo=T) in R.) > It's n

Re: Incorrect scope of list comprehension variables

2010-04-06 Thread Lie Ryan
On 04/06/10 18:42, Alain Ketterlin wrote: > Alain Ketterlin writes: > >> d = dict() >> for r in [1,2,3]: >> d[r] = [r for r in [4,5,6]] >> print d > > Thanks to Chris and Paul for the details (the list comp. r actually > leaks). I should have found this by myself. > > My background is more

Re: (a==b) ? 'Yes' : 'No'

2010-04-06 Thread Lie Ryan
On 04/07/10 00:16, Albert van der Horst wrote: > In article , > Peter Otten <__pete...@web.de> wrote: >> Pierre Quentel wrote: >> >>> I'm surprised nobody proposed a solution with itertools ;-) >> >> next(itertools.takewhile(lambda _: a == b, ["yes"]), "no") > > I could learn something here, if y

Re: pass object or use self.object?

2010-04-06 Thread Lie Ryan
On 04/06/10 23:52, Tim Arnold wrote: > Hi, > I have a few classes that manipulate documents. One is really a > process that I use a class for just to bundle a bunch of functions > together (and to keep my call signatures the same for each of my > manipulator classes). > > So my question is whether

Re: Pickle problem while loading a class instance.

2010-04-06 Thread Lie Ryan
On 04/07/10 03:23, gerardob wrote: > The error below appears. In the case i remove the comment to initialize m2, > the same thing happens. Any ideas on how to fix this? > When unpickling a user-defined class, you unpickling module must have access to the original class definition. This means if

Re: Translation docstrings with gettext

2010-04-06 Thread Lie Ryan
On 04/06/10 19:52, sapient wrote: > Lie Ryan, thank you for your answer! >> Why would you want to translate docstring? Docstring is meant for >> developers not users. > I have mentioned that I want to provide API for existing image- > processing applicaion in Python. > In

Re: Recommend Commercial graphing library

2010-04-06 Thread Lie Ryan
On 04/07/10 02:22, Grant Edwards wrote: > On 2010-04-06, Grant Edwards wrote: >> On 2010-04-06, Jean-Michel Pichavant wrote: >>> Pablo Recio Quijano wrote: Why must be commercial, when there is open and free alternatives? Like GNU Plot. >>> >>> Gnuplot is ugly. I'm using it because I d

Re: PIL question

2010-04-06 Thread Lie Ryan
On 04/06/10 19:47, Peter Otten wrote: > Tim Eichholz wrote: > >> I think maybe I am using the wrong function. I want to paste the >> entire 192x192 contents of cols[f] into newimage. I would think it >> works like newimage.paste(cols[f], (x, 0, 192+x, 192)) if that's not >> it I think I'm missing

Re: Performance of list vs. set equality operations

2010-04-06 Thread Lie Ryan
On 04/07/10 04:11, Gustavo Narea wrote: > Hello! > > Could you please confirm whether my understanding of equality > operations in sets and lists is correct? This is how I think things > work, partially based on experimentation and the online documentation > for Python: > > When you compare two l

Re: Is there a standard name for this tree structure?

2010-04-06 Thread Lie Ryan
On 04/07/10 14:18, Steven D'Aprano wrote: > I could have used None, or "root", or "this is a magic value that > probably won't clash with an entry in the tree", or -1 as a sentinel > instead, but they all risk accidental clashes with tree entries. Especially when you want to consider the possibi

Re: pass object or use self.object?

2010-04-07 Thread Lie Ryan
On 04/07/10 18:34, Bruno Desthuilliers wrote: > Lie Ryan a écrit : > (snip) > >> Since in function in python is a first-class object, you can instead do >> something like: >> >> def process(document): >> # note: document should encapsulate its

The Regex Story

2010-04-07 Thread Lie Ryan
On 04/08/10 12:45, Patrick Maupin wrote: > (And I got testy because of seeing other IMO unwarranted denigration > of re on the list lately.) Why am I seeing a lot of this pattern lately: OP: Got problem with string +- A: Suggested a regex-based solution +- B: Quoted "Some people ... r

Re: The Regex Story

2010-04-08 Thread Lie Ryan
On 4/9/10, Tim Chase wrote: > Lie Ryan wrote: >> Why am I seeing a lot of this pattern lately: >> >> OP: Got problem with string >> +- A: Suggested a regex-based solution >>+- B: Quoted "Some people ... regex ... two problems." >> >>

Re: Dynamically growing an array to implement a stack

2010-04-08 Thread Lie Ryan
On 04/09/10 06:54, M. Hamed wrote: > Thanks Patrick, that is what I was exactly looking for. > > Paul, thanks for your example. wasn't familiar with the stack class. The stack class is nothing but a wrapper that renames append() to push(); everything you need can be fulfilled by the regular list

Re: Why these don't work??

2010-04-08 Thread Lie Ryan
On 04/09/10 06:36, Robert Kern wrote: > On 2010-04-08 15:08 PM, M. Hamed wrote: > >> On the other hand (other than installing NumPy) is there a built-in >> way to do an array full of zeros or one just like the numpy.zeros()? I >> know I can do it with list comprehension (like [0 for i in >> range(

Re: Pythonic list reordering

2010-04-08 Thread Lie Ryan
On 04/09/10 08:52, Ben Racine wrote: > I have a list... > > ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat', > 'dir_330_error.dat'] > > I want to sort it based upon the numerical value only. > > Does someone have an elegant solution to this? > > Thanks, > Ben R. list.sort() and s

Re: pass object or use self.object?

2010-04-08 Thread Lie Ryan
On 04/08/10 18:20, Bruno Desthuilliers wrote: > Lie Ryan a écrit : >> On 04/07/10 18:34, Bruno Desthuilliers wrote: >>> Lie Ryan a écrit : >>> (snip) >>> >>>> Since in function in python is a first-class object, you can instead do >

Re: The Regex Story

2010-04-08 Thread Lie Ryan
On 04/09/10 12:32, Dotan Cohen wrote: >> Regexes do have their uses. It's a case of knowing when they are the >> best approach and when they aren't. > > Agreed. The problems begin when the "when they aren't" is not recognised. But problems also arises when people are suggesting overly complex ser

Re: The Regex Story

2010-04-09 Thread Lie Ryan
On 04/09/10 18:59, Steven D'Aprano wrote: > On Fri, 09 Apr 2010 14:48:22 +1000, Lie Ryan wrote: > >> On 04/09/10 12:32, Dotan Cohen wrote: >>>> Regexes do have their uses. It's a case of knowing when they are the >>>> best approach and when they aren&

Re: Python Line Intersection

2010-04-09 Thread Lie Ryan
On 04/10/10 16:24, Mark Tolonen wrote: > > "Chris Rebert" wrote in message > news:y2o50697b2c1004091304u627d99bfj44ad56fa76a3c...@mail.gmail.com... >> On Fri, Apr 9, 2010 at 11:43 AM, John Nagle wrote: >>> Chris Rebert wrote: On Fri, Apr 9, 2010 at 8:04 AM, Peyman Askari wrote: >

Re: Confused by slash/escape in regexp

2010-04-11 Thread Lie Ryan
On 04/12/10 08:43, andrew cooke wrote: > > Is the third case here surprising to anyone else? It doesn't make > sense to me... > > Python 2.6.2 (r262:71600, Oct 24 2009, 03:15:21) > [GCC 4.4.1 [gcc-4_4-branch revision 150839]] on linux2 > Type "help", "copyright", "credits" or "license" for more

Re: 2.7 beta 1

2010-04-11 Thread Lie Ryan
On 04/12/10 04:54, Mensanator wrote: > On Apr 11, 11:53�am, Steven D'Aprano cybersource.com.au> wrote: >> On Sat, 10 Apr 2010 21:08:44 -0700, Mensanator wrote: > 3.x won't be adopted by developers until it's fixed. As of now, it's > seriously broken and unsuitable for production. >> I

Re: Globally override built-in print function?

2010-04-16 Thread Lie Ryan
On 04/16/10 12:17, Dave W. wrote: >>> I naively thought I could capture output from exec()'ed print >>> invocations by (somehow) overriding 'print' globally. But this >>> seems not to be possible. > >> >>old_print = __builtins__.print >>__builtins__.print = printhook >>yield >>_

Re: Can anyone reproduce this crash?

2010-04-16 Thread Lie Ryan
On 04/16/10 21:29, MRAB wrote: > Alf P. Steinbach wrote: >> I thought I'd report this so I tried it several times more but unable >> to reproduce: instead of above hang + crash + truncated traceback the >> complete expected traceback appeared and the program terminated properly. >> >> Can anyone re

Re: Download Visual Studio Express 2008 now

2010-04-16 Thread Lie Ryan
On 04/13/10 06:36, Martin v. Loewis wrote: > Microsoft has just released Visual Studio 2010, along with its free (of > charge) Express edition. Following a tradition, they are likely to > withdraw support and availability for VS 2008 Express some time in the > future. If only Python could do that,

Re: Download Visual Studio Express 2008 now

2010-04-16 Thread Lie Ryan
On 04/16/10 22:09, Robin Becker wrote: > On 12/04/2010 21:36, Martin v. Loewis wrote: > ... >> >> If you are planning to build Python extension modules in the next five >> years, I recommend that you obtain a copy of VS Express, just in case >> Microsoft removes it from their servers. As me

Re: Tough sorting problem: or, I'm confusing myself

2010-04-16 Thread Lie Ryan
On 04/15/10 02:03, Paul Rubin wrote: > Raymond Hettinger writes: >> Not sure what the readability issue is. The phrase "nlargest(2, >> iterable)" does exactly what it says, finds the 2 largest elements >> from an iterable. That makes the programmer's intent more clear than >> the slower, but sem

Re: A question about the posibility of raise-yield in Python

2010-04-16 Thread Lie Ryan
On 04/16/10 02:30, Terry Reedy wrote: > On 4/15/2010 9:34 AM, Дамјан Георгиевски wrote: >> I'm writing this as a complete newbie (on the issue), so don't be >> surprised if it's the stupidest idea ever. >> >> I was wondering if there was ever a discusision in the python community >> on a 'raise-yie

Re: question about list extension

2010-04-16 Thread Lie Ryan
On 04/16/10 23:41, J wrote: > Ok... I know pretty much how .extend works on a list... basically it > just tacks the second list to the first list... like so: > lista=[1] listb=[2,3] lista.extend(listb) print lista; > [1, 2, 3] > > what I'm confused on is why this returns None:

Re: cross-platform coloured text in terminal

2010-04-16 Thread Lie Ryan
On 04/16/10 19:28, Jonathan Hartley wrote: > I'm playing with ideas of what API to expose. My favourite one is to > simply embed ANSI codes in the stream to be printed. Then this will > work as-is on Mac and *nix. To make it work on Windows, printing could > be done to a file0-like object which wra

Re: Updated License Term Agreement for VC Redistributable in VS 2008 SP1

2010-04-16 Thread Lie Ryan
On 04/15/10 06:38, pyt...@bdurham.com wrote: > Alex, > >> I do not see anything about redistribution, only installation, unless I am >> missing something? > > I read "installation" to mean the same as "redistribution" in the > context of this article. Perhaps I'm wrong? > Does it makes sense t

Re: Updated License Term Agreement for VC Redistributable in VS 2008 SP1

2010-04-16 Thread Lie Ryan
On 04/17/10 03:40, pyt...@bdurham.com wrote: > Lie, > >> Does it makes sense to be able to install a library in other's computer, but >> not redistribute it? Hmm... I'll have to consult a lawyer. > > See Tim Robert's response (I can't remember which

Re: Striving for PEP-8 compliance

2010-04-17 Thread Lie Ryan
On 04/17/10 16:20, Gregory Ewing wrote: > Steven D'Aprano wrote: >> On Wed, 14 Apr 2010 22:10:28 +0200, Hans Mulder wrote: >> >> Anybody who invents another brace-delimited language should be beaten. You always end up with a big problem trying to make sure the braces are consistent w

Re: when should I explicitly close a file?

2010-04-17 Thread Lie Ryan
On 04/17/10 21:23, Lawrence D'Oliveiro wrote: > In message > , gelonida > wrote: > >> I've been told, that following code snippet is not good. >> >> open("myfile","w").write(astring) ... > > I do that for reads, but never for writes. > > For writes, you want to give a chance for write errors t

Re: An open source AI research project

2010-04-17 Thread Lie Ryan
On 04/18/10 00:13, Simon Brunning wrote: > On 17 April 2010 09:03, David Zhang wrote: >> I have started an open source project to develop human-level >> Artificial Intelligence... > > Have you people never seen Terminator? Sheesh. Ssshhh, you're disclosing our top-secret plan... -- http://mail.

Re: Building a GUI Toolkit

2010-04-20 Thread Lie Ryan
On 04/19/10 03:06, Martin P. Hellwig wrote: > On 04/18/10 12:49, Tim Diels wrote: >> Hi >> >> I was thinking of writing a GUI toolkit from scratch using a basic '2D >> library'. I have already come across the Widget Construction Kit. >> >> My main question is: Could I build a GUI toolkit of reasona

Re: On Class namespaces, calling methods

2010-04-24 Thread Lie Ryan
On 04/24/10 06:07, Aahz wrote: > In article <4bc120bd$0$8850$c3e8...@news.astraweb.com>, > Steven D'Aprano wrote: >> >> I can only think of two circumstances where old-style classes are >> *wrong*: if you use multiple inheritance with a diamond diagram ("...now >> you have THREE problems" *wink

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Lie Ryan
On 04/26/10 02:37, Jonathan Fine wrote: > > I don't know if the quadratic running time is an issue for my purpose. It's not until you decide it's yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Some objects missing from tkinter

2010-04-26 Thread Lie Ryan
On 04/27/10 03:50, Peter Otten wrote: > It is a bit unfortunate that your editor has side effects on your program, > and I recommend that you never trust the result of importing a module from > within idle's shell completely. In fact, never trust IDLE. IDLE is a nice IDE when the alternative is

Re: Some objects missing from tkinter

2010-04-27 Thread Lie Ryan
On 04/27/10 18:01, Peter Otten wrote: > Lie Ryan wrote: > >> In fact, never trust IDLE. IDLE is a nice IDE when the alternative is >> Notepad; but for serious work, you need a real IDE or a programmer's >> text editor (vim or emacs, whichever side you're in).

Re: Download Proprietary Microsoft Products Now

2010-04-27 Thread Lie Ryan
On 04/27/10 08:41, Andrej Mitrovic wrote: > Although I agree, moving away from VS would be nice. Since Unladen > Swallow will eventually be merged with Python, will the dev team > consider trying out Clang as an alternative to VS? What would Unladen Swallow brings that would allow the development

Re: Engineering numerical format PEP discussion

2010-04-27 Thread Lie Ryan
On 04/27/10 10:36, Keith wrote: > I think it's worth making the print statement (or print function, as > the case may be) let us do engineering notation, just like it lets us > specify scientific notation. The print statement/function does no magic at all in specifying how numbers look like when.

Re: Engineering numerical format PEP discussion

2010-04-27 Thread Lie Ryan
On 04/27/10 10:47, MRAB wrote: > Mark Dickinson wrote: >> On Apr 26, 4:36 am, Keith wrote: >>> I am considering writing a PEP for the inclusion of an engineering >>> format specifier, and would appreciate input from others. >> >>> [...] >> >>> I am thinking that if we simply added something like %

Re: assigning multi-line strings to variables

2010-04-28 Thread Lie Ryan
On 04/28/10 15:34, Alf P. Steinbach wrote: > On 28.04.2010 07:11, * Sagar K: >> Use triple quote: >> d = """ this is >> a sample text >> which does >> not mean >> anything""" >> >> "goldtech" wrote in message >> news:4e25733e-eafa-477b-a84d-a64d139f7...@u34g2000yqu.googlegroups.com... >> On Apr 27

Re: assigning multi-line strings to variables

2010-04-28 Thread Lie Ryan
On 04/29/10 04:16, Alf P. Steinbach wrote: > On 28.04.2010 18:54, * Lie Ryan: >> On 04/28/10 15:34, Alf P. Steinbach wrote: > > Yes, that's been mentioned umpteen times in this thread, including the > *very first* quoted sentence above. > > It's IMHO sort of nee

Re: assigning multi-line strings to variables

2010-04-29 Thread Lie Ryan
On 04/29/10 20:40, Gregory Ewing wrote: > Lie Ryan wrote: >> No, the implicit concatenation is there because Python didn't always >> have triple quoted string. Nowadays it's an artifact and triple quoted >> string is much preferred. > > I don't agree. I

Re: assigning multi-line strings to variables

2010-04-29 Thread Lie Ryan
On 04/29/10 16:34, Steven D'Aprano wrote: > On Thu, 29 Apr 2010 02:16:46 +0100, MRAB wrote: > >> Steven D'Aprano wrote: >>> On Thu, 29 Apr 2010 06:17:42 +1000, Lie Ryan wrote: >>> >>>>> Consider that the concatenation language feature probabl

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 04/30/10 13:21, Steven D'Aprano wrote: > On Fri, 30 Apr 2010 05:41:26 +1000, Lie Ryan wrote: > >> On 04/29/10 20:40, Gregory Ewing wrote: >>> Lie Ryan wrote: >>>> No, the implicit concatenation is there because Python didn't always >>>> h

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 04/30/10 12:07, Alf P. Steinbach wrote: > On 30.04.2010 01:29, * Carl Banks: >> On Apr 28, 11:16 am, "Alf P. Steinbach" wrote: >>> On 28.04.2010 18:54, * Lie Ryan: >> >>>> Python have triple-quoted string when you want to include large amount &g

Re: ooolib, reading writing a spread sheet and keep formatting

2010-04-30 Thread Lie Ryan
On 04/30/10 05:58, News123 wrote: > cjw wrote: > However: > > I'd like to read in a spreadsheet, perform only minor modifications and > write it back with the exact formatting. this is unfortunately not working. Do you know that Python is one of OpenOffice's macro language? Python macro have the

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Lie Ryan
On 05/01/10 02:50, Jean-Michel Pichavant wrote: > Jabapyth wrote: >> At least a few times a day I wish python had the following shortcut >> syntax: > currentCar = Car() > currentCar = currentCar.nextCar > > The syntax you prose will be applicable on very little assignements (use > case 3). I'm no

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 00:01, Alf P. Steinbach wrote: > On 30.04.2010 12:51, * Lie Ryan: >> On 04/30/10 12:07, Alf P. Steinbach wrote: >>> On 30.04.2010 01:29, * Carl Banks: >>>> On Apr 28, 11:16 am, "Alf P. Steinbach" wrote: >>>>> On 28.04.2010 1

Re: Dynamically change __del__

2010-04-30 Thread Lie Ryan
On 05/01/10 05:16, Nikolaus Rath wrote: > Hi, > > I'm trying to be very clever: > > Apparently Python calls the class attribute __del__ rather than the > instance's __del__ attribute. Is that a bug or a feature? Is there any > way to implement the desired functionality without introducing an > a

<    4   5   6   7   8   9   10   11   12   >