Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 04:08, Neil Cerutti wrote: > On 2010-04-30, Lie Ryan wrote: >> Use triple-quoted, let them flow, done. I've never heard of any >> text editor in current use without text wrapping capability, >> even Notepad has it. And if I've got 5k of text in sourc

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 03:56, Alf P. Steinbach wrote: >> >> Use triple-quoted, let them flow, done. I've never heard of any text >> editor in current use without text wrapping capability, even Notepad has >> it. And if I've got 5k of text in source code without line breaks I >> wouldn't want that silly strin

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 05:43, Lie Ryan wrote: > On 05/01/10 03:56, Alf P. Steinbach wrote: >>> >>> Use triple-quoted, let them flow, done. I've never heard of any text >>> editor in current use without text wrapping capability, even Notepad has >>> it. And if I&#x

Re: Dynamically change __del__

2010-04-30 Thread Lie Ryan
On 05/01/10 05:39, Lie Ryan wrote: > 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 bu

Re: Inheritable computed class attributes?

2010-04-30 Thread Lie Ryan
On 05/01/10 06:42, kj wrote: > I want to define a class attribute that is computed from other > class attributes. Furthermore, this attribute should be inheritable, > and its value in the subclasses should reflect the subclasses values > of the attributes used to compute the computed attribute. I

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 07:54, Alf P. Steinbach wrote: > You'd put a 5K line in your source code, + you're working with text wrapping in your editor. >>> >>> In the other hand, you'd put a 5K line in your source code, + you're >>> writing, debugging, and running a script to wrap and put vari

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Lie Ryan
On 05/01/10 11:16, Steven D'Aprano wrote: > On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote: > > In practice though, I think that's a difference that makes no difference. > It walks like an operator, it swims like an operator, and it quacks like > an operator. > Nope it's not. A ful

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Lie Ryan
On 05/02/10 10:58, Steven D'Aprano wrote: >> > And Python's object system >> > makes it that the argument to __getattr__ is always a string even though >> > there might be a valid variable that corresponds to it: > That is nothing to do with the object system, it is related to the > semantics of P

Re: Python dot-equals (syntax proposal)

2010-05-02 Thread Lie Ryan
On 05/02/10 10:58, Steven D'Aprano wrote: > On Sun, 02 May 2010 05:08:53 +1000, Lie Ryan wrote: > >> > On 05/01/10 11:16, Steven D'Aprano wrote: >>> >> On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote: >>> >> >>

Re: strange interaction between open and cwd

2010-05-03 Thread Lie Ryan
On 05/04/10 07:57, Baz Walter wrote: > On 03/05/10 19:12, Grant Edwards wrote: >> On 2010-05-03, Baz Walter wrote: >> You requested something that wasn't possible. It failed. What do you think should have happened? >>> >>> path = '../abc.txt' >>> >>> os.path.realpath(path) -> "OSError

Re: Sharing a program I wrote

2010-05-04 Thread Lie Ryan
On 05/05/10 13:25, Scott wrote: > James, > > Thanks for the comprehensive reply. I would like to post it to > comp.lang.python but the main file is 169 lines long and the file for > functions is 316 lines long. I'm thinking that is a little long for > this format. Maybe I can put them up on a basi

Re: recursive converting object to string which hasn't __str__ or/and__repr__

2010-05-07 Thread Lie Ryan
On 05/06/10 14:40, Daneel Yaitskov wrote: > Hi, > > > > Everybody knows class's __str__ and __repr__ can be used to get readable > user representation of an object. > > > But for simple classes or debug aims it is tediously to code these > methods. And Python has very powerful reflection. I be

Re: Kindly show me a better way to do it

2010-05-08 Thread Lie Ryan
On 05/09/10 07:09, Günther Dietrich wrote: > > Why not this way? > a = [[1,2,3,4], [5,6,7,8]] for i in a: > for j in i: > print(j) > > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > > Too simple? IMHO that's more complex due to the nested loop, though I would personally d

Re: Kindly show me a better way to do it

2010-05-09 Thread Lie Ryan
On 05/09/10 19:18, Steven D'Aprano wrote: > On Sun, 09 May 2010 15:17:38 +1000, Lie Ryan wrote: > >> On 05/09/10 07:09, Günther Dietrich wrote: >>> >>> Why not this way? >>> >>>>>> a = [[1,2,3,4], [5,6,7,8]] >>>>>&g

Re: accessing superclass methods from subclass

2010-05-09 Thread Lie Ryan
On 05/09/10 10:05, Chris Rebert wrote: > Additionally, it makes no sense to call an *instance* method such as > f1() in a class context. Or in Java-speak: you can't call a non-static > method in a static context. Actually, in python it does make sense, with a caveat that you have to provide the in

Re: Picking a license

2010-05-11 Thread Lie Ryan
On 05/11/10 20:24, Paul Boddie wrote: > On 10 Mai, 17:01, Patrick Maupin wrote: >> >> I'll be charitable and assume the fact that you can make that >> statement without apparent guile merely means that you haven't read >> the post I was referring to: >> >> http://www.gnu.org/philosophy/why-not-lgp

Re: Is Python a functional programming language?

2010-05-11 Thread Lie Ryan
On 05/12/10 05:25, Chris Rebert wrote: > On Tue, May 11, 2010 at 11:13 AM, Terry Reedy wrote: >> On 5/11/2010 7:11 AM, Lawrence D'Oliveiro wrote: >>> In message<7xvdavd4bq@ruckus.brouhaha.com>, Paul Rubin wrote: >>> Python is a pragmatic language from an imperative tradition ... >>> >>> I

Re: Picking a license

2010-05-11 Thread Lie Ryan
On 05/12/10 07:02, Patrick Maupin wrote: > On May 11, 9:00 am, Paul Boddie wrote: >> On 11 Mai, 15:00, Lie Ryan wrote: >>> Come on, 99% of the projects released under GPL did so because they >>> don't want to learn much about the law; they just need to release i

Re: Picking a license

2010-05-12 Thread Lie Ryan
On 05/12/10 06:50, Patrick Maupin wrote: > On May 11, 5:34 am, Paul Boddie wrote: >> On 10 Mai, 20:36, Patrick Maupin wrote: >>> The fact is, I know the man would force me to pay for the chocolate, so in >>> some cases that enters into the equation and keeps me from wanting the >>> chocolate. >>

Re: encoding issue (cp720)

2010-05-12 Thread Lie Ryan
On 05/12/10 18:43, M. Bashir Al-Noimi wrote: > Hi All, > > I'm still a newbie in Python (I started learn it yesterday) and I faced > a huge problem cuz python always crashes because of encoding issue! > >> Fatal Python error: Py_Initialize: can't initialize sys standard streams >> LookupError: u

Re: Picking a license

2010-05-12 Thread Lie Ryan
On 05/13/10 00:53, Patrick Maupin wrote: > On May 12, 2:19 am, Lie Ryan wrote: >> On 05/12/10 06:50, Patrick Maupin wrote: >> >> >> >>> On May 11, 5:34 am, Paul Boddie wrote: >>>> On 10 Mai, 20:36, Patrick Maupin wrote: >>>>> The

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Lie Ryan
On 05/13/10 03:42, Joel Koltner wrote: > Just curious... in Microsoft's Visual Studio (and I would presume some > other tools), for many languages (both interpreted and compiled!) > there's an "edit and conitnue" option that, when you hit a breakpoint, > allows you to modify a line of code before i

Re: Broken pipe

2010-05-13 Thread Lie Ryan
On 05/13/10 22:41, Lawrence D'Oliveiro wrote: > In message , Chris > Rebert wrote: > >> Also, please don't use semicolons in your code. It's bad style. > > Wonder why they’re allowed, then. they're there for line continuation, e.g.: a = 40; foo(a) but in many cases, putting two statements in

Re: Broken pipe

2010-05-15 Thread Lie Ryan
On 05/15/10 11:56, Lawrence D'Oliveiro wrote: > In message <4bec2a9...@dnews.tpgi.com.au>, Lie Ryan wrote: > >> On 05/13/10 22:41, Lawrence D'Oliveiro wrote: >>> In message , Chris >>> Rebert wrote: >>> >>>> Also, please do

Re: Puzzled by code pages

2010-05-15 Thread Lie Ryan
On 05/15/10 10:27, Adam Tauno Williams wrote: > I'm trying to process OpenStep plist files in Python. I have a parser > which works, but only for strict ASCII. However plist files may contain > accented characters - equivalent to ISO-8859-2 (I believe). For example > I read in the line: >

Re: Puzzled by code pages

2010-05-15 Thread Lie Ryan
On 05/16/10 00:12, Adam Tauno Williams wrote: > On Sat, 2010-05-15 at 20:30 +1000, Lie Ryan wrote: >> On 05/15/10 10:27, Adam Tauno Williams wrote: >>> I'm trying to process OpenStep plist files in Python. I have a parser >>> which works, but only for strict

Re: where are the program that are written in python?

2010-05-21 Thread Lie Ryan
On 05/22/10 04:47, Terry Reedy wrote: > On 5/21/2010 6:21 AM, Deep_Feelings wrote: >> python is not a new programming language ,it has been there for the >> last 15+ years or so ? right ? >> >> however by having a look at this page >> http://wiki.python.org/moin/Applications >> i could not see

Re: where are the program that are written in python?

2010-05-23 Thread Lie Ryan
On 05/23/10 04:49, Terry Reedy wrote: > On 5/21/2010 11:03 PM, Lie Ryan wrote: >> On 05/22/10 04:47, Terry Reedy wrote: >>> On 5/21/2010 6:21 AM, Deep_Feelings wrote: >>>> python is not a new programming language ,it has been there for the >>>> last 1

Re: to prevent reveres engineering for Python

2010-05-25 Thread Lie Ryan
On 05/26/10 01:09, Adam Tauno Williams wrote: > On Tue, 2010-05-25 at 18:49 +0500, Sandy Ydnas wrote: >> Agree, reveres engineering is crucial issuer for programming >> language >> but every executable file can be cracked, for example by using >> disassembler!!! >> For each weapon there is anti

Re: function that counts...

2010-05-28 Thread Lie Ryan
On 05/26/10 11:04, Bryan wrote: > Jean-Michel Pichavant wrote: >> I still don't see "how many positive integers less than n have digits >> that sum up to m" makes it a "partition" though if that what prttn >> means. Surely because I miss the context. > > A partition of a positive integer m is an u

Re: if, continuation and indentation

2010-05-31 Thread Lie Ryan
On 05/31/10 05:10, Colin J. Williams wrote: > On 30-May-10 01:50 AM, Nathan Rice wrote: >> On 27-May-10 08:48 AM, Xavier Ho wrote: >> > On 27 May 2010 22:22, HH> > > >

Re: Python Forum

2010-06-03 Thread Lie Ryan
On 06/03/10 22:50, Adam Tauno Williams wrote: > On Thu, 2010-06-03 at 13:42 +0100, Paul Rudin wrote: >> Adam Tauno Williams writes: >>> On Thu, 2010-06-03 at 12:35 +0100, Paul Rudin wrote: Adam Tauno Williams writes: > Most people use this list via e-mail... Do you know this to be t

Re: Python Forum

2010-06-04 Thread Lie Ryan
On 06/04/10 11:56, John Bokma wrote: > Phlip writes: > >> On Jun 3, 3:20 pm, geremy condra wrote: >> You mean like how I never get answers, to my super-easy GED-level questions, here??! >>> >>> I agree. This proves conclusively that a web forum is the right >>> place for you. >> >> Ah,

Re: Python Forum

2010-06-04 Thread Lie Ryan
On 06/05/10 04:19, John Bokma wrote: > Steven D'Aprano writes: > >> But the really sad thing is that you think that "bigger" automatically >> equals "better". > > I don't think that was the point. > > Anyway, not everbody can pick a provider, there are plenty of places > that have only one or

Re: Python Forum

2010-06-04 Thread Lie Ryan
On 06/05/10 05:04, Emile van Sebille wrote: > On 6/4/2010 11:27 AM Terry Reedy said... >> On 6/4/2010 12:28 PM, Emile van Sebille wrote: >> >>> Is there now a non-email method of posting to this list? >> >> Google <==> comp.lang.python <==> python-list <==> >> gmane.comp.python.general >> >> where

Re: tallying occurrences in list

2010-06-04 Thread Lie Ryan
On 06/05/10 04:38, Magdoll wrote: > On Jun 4, 11:33 am, Peter Otten <__pete...@web.de> wrote: >> kj wrote: >> >>> Task: given a list, produce a tally of all the distinct items in >>> the list (for some suitable notion of "distinct"). >> >>> Example: if the list is ['a', 'b', 'c', 'a', 'b', 'c', 'a'

Re: Python Forum

2010-06-04 Thread Lie Ryan
On 06/05/10 06:57, John Bokma wrote: > Lie Ryan writes: > >> On 06/04/10 11:56, John Bokma wrote: >>> Phlip writes: >>> >>>> On Jun 3, 3:20 pm, geremy condra wrote: >>>> >>>>>> You mean like how I never get answers, to my

Re: Diff of Text

2010-06-04 Thread Lie Ryan
On 06/05/10 07:51, GZ wrote: > Hi Pat, > > On Jun 4, 2:55 pm, Patrick Maupin wrote: >> On Jun 3, 9:54 pm, GZ wrote: >> >>> Hi All, >> >>> I am looking for an algorithm that can compare to source code files >>> line by line and find the minimum diff. I have looked at the difflib >>> included in p

Re: Diff of Text

2010-06-05 Thread Lie Ryan
On 06/05/10 15:43, GZ wrote: > On Jun 4, 8:37 pm, Lie Ryan wrote: >> On06/05/10 07:51, GZ wrote: >>> No, rsync does not solve my problem. >> >>> I want a library that does unix 'diff' like function, i.e. compare two >>> strings line by line and

Re: Python Forum

2010-06-05 Thread Lie Ryan
On 06/05/10 12:34, John Bokma wrote: > Lie Ryan writes: > >> If you look at Stack Overflow, the highest voted questions are: >> >> - Hidden Features of C#? >> - What is the single most influential book every programmer should read? >> - What's your fa

Re: reading help() - newbie question

2010-06-05 Thread Lie Ryan
On 05/31/10 20:19, Payal wrote: > Hi, > I am trying to learn Python (again) and have some basic doubts which I > hope someone in the list can address. (English is not my first language and I > have no CS background except I can write decent shell scripts) > > When I type help(something) e.g. help(

Re: reading help() - newbie question

2010-06-05 Thread Lie Ryan
On 06/05/10 21:24, Lie Ryan wrote: > On 05/31/10 20:19, Payal wrote: >> Hi, >> I am trying to learn Python (again) and have some basic doubts which I >> hope someone in the list can address. (English is not my first language and I >> have no CS background except I can

Re: GUIs - A Modest Proposal

2010-06-06 Thread Lie Ryan
On 06/06/10 12:22, ant wrote: > I get the strong feeling that nobody is really happy with the state of > Python GUIs. > Tkinter is not widely liked, but is widely distributed. WxPython and > PyGtk are both > powerful, but quirky in different ways. PyQt is tied to one platform. > And there are > doz

Re: GUIs - A Modest Proposal

2010-06-06 Thread Lie Ryan
On 06/06/10 22:09, Petite Abeille wrote: > > On Jun 6, 2010, at 12:52 PM, Steven D'Aprano wrote: > >> Yes, just wait until somebody builds a web-browser that runs in your web- >> browser! > > There you go: > > "A good browser should be able to reproduce itself. Safari 4, built entirely > with

Re: map is useless!

2010-06-06 Thread Lie Ryan
On 06/07/10 03:22, rantingrick wrote: > On Jun 6, 12:02 pm, Alain Ketterlin > wrote: >> rantingrick writes: >> I've not used map since I learned about list comprehensions. > > Thats has been my experienced also. Actually i've been at Python for > O... about 2 years now and i don't think i've eve

Re: [RELEASE] Python 2.7 release candidate 1 released

2010-06-06 Thread Lie Ryan
On 06/07/10 00:05, Franck Ditter wrote: > Just an advice as I see that "old" Python is maintained. > When starting with Python (simple programs and GUIs) should I start > with Python 3.x ? If it has a decent implementation on Mac/Linux/Windows of > course... I say, if you're learning the language

Re: map is useless!

2010-06-06 Thread Lie Ryan
On 06/07/10 05:54, D'Arcy J.M. Cain wrote: > On Mon, 07 Jun 2010 05:27:43 +1000 > Lie Ryan wrote: >> In the most naive uses, map appears to have no advantage over list >> comprehension; but one thing that map can do that list comprehension >> still can't

Re: map is useless!

2010-06-06 Thread Lie Ryan
On 06/07/10 09:56, D'Arcy J.M. Cain wrote: > On Mon, 07 Jun 2010 05:59:02 +1000 > Lie Ryan wrote: >>> foo = lambda x: [y + 1 for y in x] >>> [foo(x) for x in [[4, 6, 3], [6, 3, 2], [1, 3, 5]]] >>> >>> Didn't seem like such a long walk. >>

Re: Python Forum

2010-06-06 Thread Lie Ryan
On 06/07/10 10:45, D'Arcy J.M. Cain wrote: > On Mon, 07 Jun 2010 10:17:39 +1000 > Ben Finney wrote: >> So you say. For the interface to be “better” it needs to keep the good >> features of the existing interface. I include among the good features of >> Usenet: > > That's a great list of features.

Re: GUIs - A Modest Proposal

2010-06-06 Thread Lie Ryan
On 06/07/10 10:48, Adam Tauno Williams wrote: > On Sun, 2010-06-06 at 17:03 -0700, AD. wrote: >> On Jun 7, 10:55 am, ant wrote: >>> My concern is simple: I think that Python is doomed to remain a minor >>> language unless we crack this problem. >> I'm curious why you think fragmented GUI choices i

Re: GUIs - A Modest Proposal

2010-06-06 Thread Lie Ryan
On 06/07/10 12:18, Adam Tauno Williams wrote: > On Mon, 2010-06-07 at 11:11 +1000, Lie Ryan wrote: >> On 06/07/10 10:48, Adam Tauno Williams wrote: >>> On Sun, 2010-06-06 at 17:03 -0700, AD. wrote: >>>> On Jun 7, 10:55 am, ant wrote: >>>>> My concer

Re: Reading file bit by bit

2010-06-07 Thread Lie Ryan
On 06/07/10 19:31, Richard Thomas wrote: > On Jun 7, 10:17 am, Peter Otten <__pete...@web.de> wrote: >> Alfred Bovin wrote: >>> I'm working on something where I need to read a (binary) file bit by bit >>> and do something depending on whether the bit is 0 or 1. >> >>> Any help on doing the actual f

Re: GUIs - A Modest Proposal

2010-06-07 Thread Lie Ryan
On 06/07/10 20:18, Adam Tauno Williams wrote: > On Mon, 2010-06-07 at 13:19 +1000, Lie Ryan wrote: >> On 06/07/10 12:18, Adam Tauno Williams wrote: >>> But then I don't know any of the local Python devs who use IDLE; the >>> IDE landscape for Python is very fragm

Re: GUIs - A Modest Proposal

2010-06-08 Thread Lie Ryan
On 06/09/10 01:17, bart.c wrote: > > "Grant Edwards" wrote in message > news:hullf3$hl...@reader1.panix.com... >> On 2010-06-08, Kevin Walzer wrote: >> >>> Since Tk already provides a basic GUI toolset, and Python can interface >>> with it more directly than it can with other toolkits >>> (PyGui

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Lie Ryan
On 06/09/10 07:44, Deadly Dirk wrote: > I am a total beginner with Python. I am reading a book ("The Quick Python > Book", 2nd edition, by Vernon Ceder) which tells me that print function > takes end="" argument not to print newline character. I tried and here is > what happens: > print(x)

Re: GUIs - A Modest Proposal

2010-06-09 Thread Lie Ryan
On 06/09/10 08:20, Martin P. Hellwig wrote: > > However I don't think that x11 represents that majority (just a gut > feeling I have no data to back this claim up) of gui users, so an equal > solution should be found for windows and macs. > > I do think it is technically possible to have your own

Re: function that counts...

2010-06-10 Thread Lie Ryan
On 06/10/10 09:03, Bryan wrote: > Lie Ryan wrote: >> I went through the mathematical foundation of using >> partition/distribution and inclusion-exclusion, and have written some >> code that solves a subset of the problem, feel free if you or superpollo >> are interested

Re: How do subprocess.Popen("ls | grep foo", shell=True) with shell=False?

2010-06-10 Thread Lie Ryan
On 06/10/10 21:52, Nobody wrote: > Spawning child processes to perform tasks > which can easily be performed in Python is inefficient Not necessarily so, recently I wrote a script which takes a blink of an eye when I pipe through cat/grep to prefilter the lines before doing further complex filteri

Re: pythonize this!

2010-06-16 Thread Lie Ryan
On 06/15/10 21:49, superpollo wrote: > goal (from e.c.m.): evaluate > 1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three > consecutive + must be followed by two - (^ meaning ** in this context) > > my solution: > s = 0 for i in range(1, 2011): > s += i**2 > .

Re: Overriding "__setattr__" of a module - possible?

2010-06-16 Thread Lie Ryan
On 06/16/10 12:43, John Nagle wrote: > Is it possible to override "__setattr__" of a module? I > want to capture changes to global variables for debug purposes. > > None of the following seem to have any effect. > > modu.__setattr__ = myfn > > setattr(modu, "__setattr__", myfn) > >

Re: List of lists surprising behaviour

2010-06-17 Thread Lie Ryan
On 06/17/10 20:21, candide wrote: > Let's the following code : > t=[[0]*2]*3 t > [[0, 0], [0, 0], [0, 0]] t[0][0]=1 t > [[1, 0], [1, 0], [1, 0]] > > Rather surprising, isn't it ? So I suppose all the subarrays reférence > the same array : > id(t[0]), id(t[1]), id(t[2]) >

Re: List of lists surprising behaviour

2010-06-17 Thread Lie Ryan
On 06/18/10 09:20, bart.c wrote: > > "J Kenneth King" wrote in message > news:87wrtxh0dq@agentultra.com... >> candide writes: >> >>> Let's the following code : >>> >> t=[[0]*2]*3 >> t >>> [[0, 0], [0, 0], [0, 0]] >> t[0][0]=1 >> t >>> [[1, 0], [1, 0], [1, 0]] >>> >>> Rather s

Re: super() woes (n00b)

2010-06-18 Thread Lie Ryan
On 06/18/10 19:19, Jean-Michel Pichavant wrote: > Deadly Dirk wrote: >> I cannot get right the super() function: >> Python 3.1.1+ (r311:74480, Nov 2 2009, 14:49:22) [GCC 4.4.1] on linux2 >> Type "copyright", "credits" or "license()" for more information. >> No Subprocess >> > class

Re: variable variables

2010-06-18 Thread Lie Ryan
On 06/18/10 20:31, someone wrote: > On Jun 18, 12:01 pm, "Gabriel Genellina" > wrote: >> En Fri, 18 Jun 2010 06:48:34 -0300, someone >> escribió: >> >>> is it possible to make first attr variable? >> >>> some_object.attr.attr >> >>> so instead of attr I could use self.foo which has value "attr"

Re: List of lists surprising behaviour

2010-06-18 Thread Lie Ryan
On 06/18/10 20:00, bart.c wrote: > (I > don't know if Python allows circular references, but that would give > problems anyway: how would you even print out such a list?) Python uses ellipsis to indicate recursive list: >>> a = [1, 2, 3] >>> a.append(a) >>> a [1, 2, 3, [...]] -- http://mail.pyt

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Lie Ryan
On 06/20/10 20:57, DivX wrote: > On 20 lip, 12:46, Steven D'Aprano cybersource.com.au> wrote: >> On Sun, 20 Jun 2010 03:19:48 -0700, DivX wrote: >>> On 20 lip, 02:52, Steven D'Aprano >> cybersource.com.au> wrote: >> [...] I think that mixing assembly and python is a gimmick of very little >>>

Re: I strongly dislike Python 3

2010-06-26 Thread Lie Ryan
On 06/27/10 02:33, Thomas Jollans wrote: >> > >> > And here's the disadvantages: >> > >> > -The Python 3 syntax actually requires more keystrokes. > Typically ONE extra character: the closing bracket. The opening bracket > can replace the whitespace previously required. What really matters is no

Re: I strongly dislike Python 3

2010-06-30 Thread Lie Ryan
On 06/27/10 11:24, Steven D'Aprano wrote: >> > Producing print function takes a little bit more effort than producing a >> > print statement. > > (1) The main use-cases for print are quick (and usually dirty) scripts, > interactive use, and as a debugging aid. That is precisely how the quick-and

Re: I strongly dislike Python 3

2010-06-30 Thread Lie Ryan
On 07/01/10 01:30, Stephen Hansen wrote: > On 6/30/10 5:52 AM, Lie Ryan wrote: >> On 06/27/10 11:24, Steven D'Aprano wrote: >>>>> Producing print function takes a little bit more effort than >>>>> producing a >>>>> print statement. >

Re: I strongly dislike Python 3

2010-06-30 Thread Lie Ryan
On 07/01/10 01:42, Michele Simionato wrote: > On Jun 30, 2:52 pm, Lie Ryan wrote: >> On 06/27/10 11:24, Steven D'Aprano wrote: >> >>>>> Producing print function takes a little bit more effort than producing a >>>>> print statement. >> >

Re: List-type attributes and name strings

2010-07-01 Thread Lie Ryan
On 07/01/10 20:56, egbert wrote: self.__dict__[namestring][keystring]=value try this: getattr(self, namestring)[keystring] = value -- http://mail.python.org/mailman/listinfo/python-list

Re: newb

2010-07-27 Thread Lie Ryan
On Tue, 27 Jul 2010 11:07:09 GMT, whitey wrote: hi all. am totally new to python and was wondering if there are any newsgroups that are there specifically for beginners. Yes, Python Tutor list is specifically aimed for beginners. You can access it by subscribing to either tu...@python.org or

Re: Nice way to cast a homogeneous tuple

2010-08-05 Thread Lie Ryan
On Wed, 28 Jul 2010 15:58:29 +0200, Ulrich Eckhardt wrote: wheres pythonmonks wrote: > Thanks ... I thought int was a type-cast (like in C++) so I assumed I > couldn't reference it. Firstly, "int" is a class. Python doesn't make a distinction between builtin types and class types like C++,

Re: Nice way to cast a homogeneous tuple

2010-08-05 Thread Lie Ryan
On Wed, 28 Jul 2010 09:15:24 -0400, wheres pythonmonks wrote: A new python convert is now looking for a replacement for another perl idiom. A functional alternative: l = ... seqint = compose(map, int) print f(seqint(l)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-13 Thread Lie Ryan
On 08/10/10 06:36, Bartc wrote: > And if the context is Python, I doubt whether the choice of 0-based over a > 1-based makes that much difference in execution speed. And I doubt anyone cares about execution speed when deciding whether to use 1-based or 0-based array. The reason why you want to ch

Re: Python "why" questions

2010-08-13 Thread Lie Ryan
Sorry the message gets cuts off by an accidental press of send button. On 08/14/10 04:31, Lie Ryan wrote: > On 08/10/10 06:36, Bartc wrote: >> And if the context is Python, I doubt whether the choice of 0-based over a >> 1-based makes that much difference in execution speed. &

Re: Python "why" questions

2010-08-17 Thread Lie Ryan
On 08/16/10 21:54, David Cournapeau wrote: > On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing > wrote: >>> On Aug 7, 2010, at 9:14 PM, John Nagle wrote: >>> The languages which have real multidimensional arrays, rather than arrays of arrays, tend to use 1-based subscripts. That refl

Re: 79 chars or more?

2010-08-18 Thread Lie Ryan
On 08/17/10 12:59, AK wrote: > On 08/16/2010 10:42 PM, James Mills wrote: >> On Tue, Aug 17, 2010 at 12:35 PM, AK wrote: >>> As monitors are getting bigger, is there a general change in opinion on >>> the 79 chars limit in source files? I've experimented with 98 characters >>> per line and I find

Re: multi-thread python interpreaters and c++ program

2009-06-09 Thread Lie Ryan
myopc wrote: > hi, all > I am ruuning a c++ program (boost python) , which create many python > interpreaters and each run a python script with use multi-thread > (threading). > when the c++ main program exit, I want to shut down python > interpreaters, but it crashed. I have googled a lot but can

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Lie Ryan
504cr...@gmail.com wrote: > I've encountered a problem with my RegEx learning curve -- how to > escape hash characters # in strings being matched, e.g.: > string = re.escape('123#abc456') match = re.match('\d+', string) print match > > <_sre.SRE_Match object at 0x00A6A800> pri

Re: Exception inside loop wrongly failing doctest

2009-06-12 Thread Lie Ryan
Steven D'Aprano wrote: > One of my doctests is failing, and I suspect a bug. > > The test involves matching an exception in a for-loop. Here are two > simplified versions of the test, both should pass but only the first does. > tell me, what's the result of 1/0? -- http://mail.python.org/mailma

Re: Exception inside loop wrongly failing doctest

2009-06-12 Thread Lie Ryan
Lie Ryan wrote: > Steven D'Aprano wrote: >> One of my doctests is failing, and I suspect a bug. >> >> The test involves matching an exception in a for-loop. Here are two >> simplified versions of the test, both should pass but only the first does. >>

Re: RE replace problem too

2009-06-12 Thread Lie Ryan
oyster wrote: > in my case, I want to replace all the function name with '', that is > sin(1) -> (1) > sin(pi*(2+4)) -> (pi*(2+4)) > how can I use RE in this situation? thanx this works if there is no implicit multiplication: re.sub('\w+\(', '(', 'sin(pi*(2+4))') this one might be more robust

Re: Perl's @foo[3,7,1,-1] ?

2009-06-14 Thread Lie Ryan
Piet van Oostrum wrote: >> kj (k) wrote: > >> k> Switching from Perl here, and having a hard time letting go... > >> k> Suppose I have an "array" foo, and that I'm interested in the 4th, 8th, >> k> second, and last element in that array. In Perl I could write: > >> k> my @wanted = @foo[3

Re: How to escape # hash character in regex match strings

2009-06-14 Thread Lie Ryan
Brian D wrote: > On Jun 11, 9:22 am, Brian D wrote: >> On Jun 11, 2:01 am, Lie Ryan wrote: >> >> >> >>> 504cr...@gmail.com wrote: >>>> I've encountered a problem with my RegEx learning curve -- how to >>>> escape hash characters

Re: Good books in computer science?

2009-06-15 Thread Lie Ryan
Bob Martin wrote: > in 117455 20090615 044816 Steven D'Aprano > wrote: >> On Mon, 15 Jun 2009 10:39:50 +1200, Lawrence D'Oliveiro wrote: >> Shame on you for deliberately cutting out my more serious and nuanced answer while leaving a silly quip. >>> Can't have been very "serious and nuan

Re: Alter list items within loop

2009-06-15 Thread Lie Ryan
Tim Harig wrote: > On 2009-06-11, Duncan Booth wrote: >> Tim Harig wrote: number 3 never gets printed. Does Python make a copy of a list before it iterates through it?: >>> No, complex types are passed by reference unless explicity copied. >> *All* types are passed by reference unless

Re: On the property function

2009-06-16 Thread Lie Ryan
Chris Rebert wrote: > On Mon, Jun 15, 2009 at 5:43 AM, Virgil Stokes wrote: >> Does anyone have a good example (or examples) of when "property(...)" can be >> useful? > > Erm, when you want to create a property (i.e. computed attribute). > > from __future__ import division > class TimeDelta(objec

Re: TypeError: int argument required

2009-06-16 Thread Lie Ryan
Lawrence D'Oliveiro wrote: > In message , Rhodri > James wrote: > >> On Mon, 15 Jun 2009 01:33:50 +0100, Lawrence D'Oliveiro >> wrote: >> >>> Perl allows just about any printable character as a quote. I tried >>> alternative quotes for many years, and decided making that choice was a >>> waste o

Re: mac text files & for line

2009-06-16 Thread Lie Ryan
Humberto wrote: > Greetings. > > This is probably a v. basic question, but my apologies as I'm > relatively new w/ this. > > But I am attempting to use for line to iterate through a text > file, but I am working on a Mac and am getting a single block of text. > I assume this is because of the Mac

Re: Input problem

2009-06-16 Thread Lie Ryan
Piet van Oostrum wrote: >> Prasoon (P) wrote: > >> P> What is the difference between >> P> z=int(raw_input()) and z=eval(raw_input())(I thought them to be >> P> the same in case of integers) > >> P> I mean when an integer is entered in that case are they same and when >> P> an integer in

Re: Executing a python script while it is running

2009-06-16 Thread Lie Ryan
Zach Hobesh wrote: >> A lot more information would be useful. What version of Python, and what >> operating system environment? Exactly what would you like to happen when >> the batch file is invoked a second time? > > I'm running Python 2.6.2 on Windows. I'm passing filenames to the > batch fi

Re: Need to know if a file as only ASCII charaters

2009-06-16 Thread Lie Ryan
Scott David Daniels wrote: > norseman wrote: >> Scott David Daniels wrote: >>> Dave Angel wrote: Jorge wrote: ... > I'm making a application that reads 3 party generated ASCII files, > but some times the files are corrupted totally or partiality and I > need to know if it's a ASCI

Re: Need to know if a file as only ASCII charaters

2009-06-16 Thread Lie Ryan
Wolfgang Rohdewald wrote: > On Wednesday, 17. June 2009, Steven D'Aprano wrote: >> while text: >> for c in text: >> if c not in printable: return False > > that is one loop per character. unless printable is a set > wouldn't it be faster to apply a regex to te

Re: walking a directory with very many files

2009-06-16 Thread Lie Ryan
Mike Kazantsev wrote: > On Wed, 17 Jun 2009 14:52:28 +1200 > Lawrence D'Oliveiro wrote: > >> In message >> <234b19ac-7baf-4356-9fe5-37d00146d...@z9g2000yqi.googlegroups.com>, >> thebjorn wrote: >> >>> Not proud of this, but...: >>> >>> [django] www4:~/datakortet/media$ ls bfpbilder|wc -l >>> 17

Re: Logging multiple lines

2009-06-16 Thread Lie Ryan
Nikolaus Rath wrote: > Hi, > > Are there any best practices for handling multi-line log messages? > > For example, the program, > > main = logging.getLogger() > handler = logging.StreamHandler() > handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s > %(message)s')) >

Re: Exotic Logics

2009-06-17 Thread Lie Ryan
Steven D'Aprano wrote: > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > >> I was staring at a logic table the other day, and I asked myself, "what >> if one wanted to play with exotic logics; how might one do it?" > > > This might be useful for you, and if not useful, at least it

Re: Regarding Python is scripting language or not

2009-06-17 Thread Lie Ryan
Jean-Michel Pichavant wrote: > abhishek goswami wrote: >> Hi, >> I have very basic question about Python that do we consider pyhton as >> script language. >> I searched in google but it becomes more confusion for me. After some >> analysis I came to know that Python support oops . >> >> Can anyone

Re: Exotic Logics

2009-06-17 Thread Lie Ryan
pdpi wrote: > On Jun 17, 5:37 pm, Lie Ryan wrote: >> Steven D'Aprano wrote: >>> On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: >>>> I was staring at a logic table the other day, and I asked myself, "what >>>> if one wanted to pla

Re: TypeError: int argument required

2009-06-18 Thread Lie Ryan
Rhodri James wrote: > On Thu, 18 Jun 2009 08:29:53 +0100, Lawrence D'Oliveiro > wrote: > >> Now compare that with Lie Ryan's examples which, instead of using >> backslashes, instead used alternative quotes plus backslashes in one >> example, and in

<    5   6   7   8   9   10   11   12   >