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: Possible to reach back in stack and grab calling function's locals()?

2010-06-17 Thread Ryan Kelly
ing > functions. I understand the desire, but that sounds like trouble to me. Explicit is better than implicit and all that. You might get away with it for purely internal code (heck, even the standard library uses sys._getframe on occasion!) but I would hesitate to have a public-faci

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: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
is for lazy object initialisation, e.g. something like this: def get_my_object(key): try: return objects[key] except KeyError: return objects.setdefault(key,create_my_object(key)) If two threads happen to try initialising the object at the same time, only one will

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
plementation that aren't guaranteed by the language spec - > namely that thread switches can't happen while executing C > code, that dict.setdefault is implemented in C, and that is > can calculate the hash of a string key without calling back > o

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
this gives us is global synchronization for free! The GIL is > there anyway, so it adds no additional overhead. Very interesting idea. Will it work if accessed through ctypes? ticker = ctypes.c_int.in_dll(ctypes.pythonapi,"_Py_Ticker") ticker.value = 0x7fff Or does

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: A question about the posibility of raise-yield in Python

2010-06-30 Thread Ryan Kelly
describe, is an optional > > callback, to be called in case of a fixable problem. Then the > > caller gets control, but without stack unwinding. I've tried my hand at implementing the "condition/handler/restart" paradigm of common lisp, which is very similar to what

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: sending a file chunk by chunk instead as a whole to a web server

2010-08-02 Thread Ryan Kelly
(key, filename, value) in files: yield '--' + BOUNDARY yield 'Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename) ...etc... ...etc... There are many improvements to make, but this should g

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: subprocess escaping POpen?!

2010-08-05 Thread Ryan Kelly
grams prompt for auth credentials on the controlling tty instead of standard input/output. I believe SSH also does this, which suggests that it's considered more secure. No idea why, but I trust the authors of SSH to know their stuff in this regard. Cheers, Ryan -- Ryan Kelly

Re: Python "why" questions

2010-08-06 Thread Ryan Kelly
e wonder why kids don't want to learn to program. Yeah, obscure language warts, that must be the reason. Note to self: DNFTT... Ryan -- Ryan Kelly http://www.rfk.id.au | This message is digitally signed. Please visit r...@rfk.id.au| http://www.rfk.id.au/ramblings/gpg/ for details -- 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 the other example, alternative quotes, alternati

Re: walking a directory with very many files

2009-06-18 Thread Lie Ryan
Mike Kazantsev wrote: > On Wed, 17 Jun 2009 03:42:02 GMT > Lie Ryan wrote: > >> Mike Kazantsev wrote: >>> In fact, on modern filesystems it doesn't matter whether you >>> accessing /path/f9e95ea4926a4 with million files in /path >>> or /path/f/

Re: python tutorial

2009-06-18 Thread Lie Ryan
Ben Finney wrote: > You started out asking how to *interpret* it, which is fine for this > forum; but discussing it here isn't going to lead automatically to any > *midification* to a document developed within the core of Python. > I definitely want to see how python doc be midified, last time I

Re: walking a directory with very many files

2009-06-19 Thread Lie Ryan
Lawrence D'Oliveiro wrote: > In message <%zv_l.19493$y61.5...@news-server.bigpond.net.au>, Lie Ryan > wrote: > >> Yeah, it might be possible to just mv the file from outside, but not >> being able to enter a directory just because you've got too many files &

Re: Convert hash to struct

2009-06-19 Thread Lie Ryan
Amita Ekbote wrote: > Hello, > > I am retrieving values from a database in the form of a dictionary so > I can access the values as d['column'] and I was wondering if there is > a way to convert the hash to a struct like format so i can just say > d.column. Makes it easier to read and understand.

Re: Convert hash to struct

2009-06-19 Thread Lie Ryan
Amita Ekbote wrote: > Hello, > > I am retrieving values from a database in the form of a dictionary so > I can access the values as d['column'] and I was wondering if there is > a way to convert the hash to a struct like format so i can just say > d.column. Makes it easier to read and understand.

Re: SHM and Touchpad

2009-06-19 Thread Lie Ryan
Sparky wrote: > > Thank you for your quick response, I will take a look at the link you > provided. Depending on what you're trying to do, you may be able to use `synclient` with subprocess. -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking for binary data in a string

2009-06-19 Thread Lie Ryan
Grant Edwards wrote: > On 2009-06-19, Mitko Haralanov wrote: > >> I have a question about finding out whether a string contains >> binary data? > > All strings contain binary data. Not quite, (python 2.x's) strings are binary data. It just happens that it behaves like text when you appropria

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Lie Ryan
Jure Erznožnik wrote: > On Jun 20, 1:36 am, a...@pythoncraft.com (Aahz) wrote: >> You should put up or shut up -- I've certainly seen multi-core speedup >> with threaded software, so show us your benchmarks! >> -- > > Sorry, no intent to offend anyone here. Flame wars are not my thing. > > I have

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Lie Ryan
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jean-Paul Calderone wrote: > On Sat, 20 Jun 2009 00:07:27 GMT, Lie Ryan wrote: >> [snip] >> >> Perhaps we should have more built-in/stdlib operations that can release >> GIL safely to release GIL by default? And perhaps so

Re: What is the best method to match a pattern in set of lines

2009-06-20 Thread Lie Ryan
Dennis Lee Bieber wrote: > On Fri, 19 Jun 2009 17:52:05 -0700 (PDT), Terminator > declaimed the following in > gmane.comp.python.general: > >> Hello, >> My requierment is to get the "Stick Tag" value from the below o/p and >> based on tag take different actions. What is the best way to implement

Re: MemoryError c/vcompiler.h:745: Fatal Python error (Psycopg2)

2009-06-21 Thread Lie Ryan
Luis P. Mendes wrote: > Hi, > > I have a program that uses a lot of resources: memory and cpu but it > never returned this error before with other loads: > > """ > MemoryError > c/vcompiler.h:745: Fatal Python error: psyco cannot recover from the > error above > Aborted > """ > The last time I

Re: Inheritance and forward references (prototypes)

2009-06-21 Thread Lie Ryan
Lorenzo Di Gregorio wrote: > I had also thought of using "None" (or whatever else) as a marker but > I was curious to find out whether there are better ways to supply an > object with standard values as a default argument. > In this sense, I was looking for problems ;-) > > Of course the observati

Re: MemoryError c/vcompiler.h:745: Fatal Python error (Psycopg2)

2009-06-21 Thread Lie Ryan
Luis P. Mendes wrote: > Sun, 21 Jun 2009 13:04:59 +, Lie Ryan escreveu: >> Have you tried running without psyco? Psyco increases memory usage quite >> significantly. >> >> If it runs well without psyco, you can try looking at your code and >> selectively psyc

Re: Idioms and Anti-Idioms Question

2009-06-21 Thread Lie Ryan
Ben Charrow wrote: > I have a question about the "Using Backslash to Continue Statements" in > the howto "Idioms and Anti-Idioms in Python" > (http://docs.python.org/howto/doanddont.html#using-backslash-to-continue-statements) > > > It says: > > "...if the code was: > > value = foo.bar()['first

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

2009-06-22 Thread Lie Ryan
Jean-Michel Pichavant wrote: > Maybe I've been a little bit too dictatorial when I was saying that > renaming namespaces should be avoided. > Sure your way of doing make sense. In fact they're 2 main purposes of > having strong coding rules: > 1/ ease the coder's life > 2/ ease the reader's life

Re: Graphical library - charts

2009-06-22 Thread Lie Ryan
BJörn Lindqvist wrote: > 2009/6/22 : >> Hello, >> >> I have thousends of files with logs from monitoring system. Each file >> has some important data (numbers). I'd like to create charts using those >> numbers. Could you please suggest library which will allow creating >> such charts ? The preferr

Re: Measuring Fractal Dimension ?

2009-06-23 Thread Lie Ryan
Mark Dickinson wrote: > On Jun 23, 3:52 am, Steven D'Aprano > wrote: >> On Mon, 22 Jun 2009 13:43:19 -0500, David C. Ullrich wrote: >>> In my universe the standard definition of "log" is different froim what >>> log means in a calculus class >> Now I'm curious what the difference is. > > It's jus

Re: Idioms and Anti-Idioms Question

2009-06-23 Thread Lie Ryan
Peter Billam wrote: > On 2009-06-22, Lie Ryan wrote: >> Ben Charrow wrote: >>> value = foo.bar()['first'][0]*baz.quux(1, 2)[5:9] \ >>> + calculate_number(10, 20)*forbulate(500, 360) >>> What is subtly wrong about this piece of code? I ca

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

2009-06-23 Thread Lie Ryan
Jean-Michel Pichavant wrote: > Lie Ryan wrote: >> Jean-Michel Pichavant wrote: >> >> >> >> >>> Maybe I've been a little bit too dictatorial when I was saying that >>> renaming namespaces should be avoided. >>> Sure your way o

Re: IDLE / Python 2.5 under Jaunty

2009-06-23 Thread Lie Ryan
duncan smith wrote: > I've just upgraded to Jaunty Jackalope where Python 2.6 is the default > Python version. I'm still developing under 2.5, but IDLE now refuses to > respond to left click events (for code editing, menus etc. respond as > expected). If I right click, then left click I can move

Re: walking a directory with very many files

2009-06-24 Thread Lie Ryan
Lawrence D'Oliveiro wrote: > In message , Steven > D'Aprano wrote: > >> On Tue, 23 Jun 2009 10:29:21 -0400, Mel wrote: >> >>> Steven D'Aprano wrote: >>> Lawrence D'Oliveiro wrote: >> Ok, now pipe ls to less, take three days to browse through all the >> filenames to locate the fi

Re: wikipedia with python

2009-06-24 Thread Lie Ryan
ZeLegolas wrote: > On Mon, 22 Jun 2009 19:23:59 +0200, Andre Engels > wrote: >> On Mon, Jun 22, 2009 at 6:58 PM, zelegolas wrote: >>> Let me know if it's the right place to ask. >>> >>> I'm looking for wiki writen with python where I can import all >>> wikipedia site. >>> If you have any links ple

Re: Reading a large csv file

2009-06-24 Thread Lie Ryan
Mag Gam wrote: > Sorry for the delayed response. I was trying to figure this problem > out. The OS is Linux, BTW Maybe I'm just being pedantic, but saying your OS is Linux means little as there are hundreds of variants (distros) of Linux. (Not to mention that Linux is a kernel, not a full blown OS

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread Lie Ryan
MRAB wrote: > There's no difference between the two types of quote character. a small exception is single-quote can contain double quote but cannot contain unescaped single quote while double-quote can contain single quote but cannot contain unescaped double quote. -- http://mail.python.org/mai

Re: Problem with multithreading

2009-06-24 Thread Lie Ryan
Jeffrey Barish wrote: > I have a program that uses multithreading to monitor two loops. When > something happens in loop1, it sends a message to loop2 to have it execute > a command. loop2 might have to return a result. If it does, it puts the > result in a queue. loop1, meanwhile, would have b

Re: No trees in the stdlib?

2009-06-28 Thread Lie Ryan
João Valverde wrote: > alex23 wrote: >> João Valverde wrote: >> >>> Currently I don't have a strong need for this. >>> >> >> And clearly neither has anyone else, hence the absence from the >> stdlib. As others have pointed out, there are alternative approaches, >> and plenty of recipes on A

Re: pep 8 constants

2009-07-02 Thread Lie Ryan
Eric S. Johansson wrote: > Steven D'Aprano wrote: >> That assumes that every word is all caps. In practice, for real-life >> Python code, I've tripled the vocal load of perhaps one percent of your >> utterances, which cuts your productivity by 2%. >> >> If you have 1 words in you per day, and

Re: pep 8 constants

2009-07-02 Thread Lie Ryan
Eric S. Johansson wrote: > I've been working with speech recognition for 15 years. I've written something > on the order of 10,000 lines of Python code both as open source and private > projects. I've tried it least two dozen editors and they all fail miserably > because they're focused on keyboar

Re: logging of strings with broken encoding

2009-07-02 Thread Lie Ryan
Thomas Guettler wrote: > Hi, > > I have bug in my code, which results in the same error has this one: > > https://bugs.launchpad.net/bzr/+bug/295653 > {{{ > Traceback (most recent call last): > File "/usr/lib/python2.6/logging/__init__.py", line 765, in emit > self.stream.write(fs % msg.enc

Re: logging of strings with broken encoding

2009-07-02 Thread Lie Ryan
Thomas Guettler wrote: > My quick fix is this: > > class MyFormatter(logging.Formatter): > def format(self, record): > msg=logging.Formatter.format(self, record) > if isinstance(msg, str): > msg=msg.decode('utf8', 'replace') > return msg > > But I still thi

Re: invoking a method from two superclasses

2009-07-02 Thread Lie Ryan
Carl Banks wrote: > On Jun 30, 6:23 pm, Carl Banks wrote: >> On Jun 30, 5:34 pm, Mitchell L Model wrote: >> >>> Allow me to add to my previous question that certainly the superclass >>> methods can be called explicitly without resorting to super(), e.g.: >>> class C(A, B): >>> def __i

Re: PEP 376

2009-07-02 Thread Lie Ryan
Joachim Strömbergson wrote: > Aloha! > > Tarek Ziadé wrote: >> The prefix is a good idea but since it's just a checksum to control >> that the file hasn't changed >> what's wrong with using a weak hash algorithm like md5 or now sha1 ? > > Because it creates a dependency to an old algorithm that s

Re: question of style

2009-07-02 Thread Lie Ryan
Tim Harig wrote: >> Speaking only to the style issue, when I've wanted to do something like >> that, I find: >>if self.higher is None is self.lower: >> more readable, by making clear they are both being compared to a >> constant, rather than compared to each other. > > By comparing them to

Re: question of style

2009-07-02 Thread Lie Ryan
Simon Forman wrote: > On Jul 2, 3:57 pm, Scott David Daniels wrote: >> Duncan Booth wrote: >>> Simon Forman wrote: ... if self.higher is self.lower is None: return ... >>> As a matter of style however I wouldn't use the shorthand to run two 'is' >>> comparisons together, I'd write

Re: question of style

2009-07-02 Thread Lie Ryan
Paul Rubin wrote: > Generally, having a special > value like None to denote a missing datum was considered standard > practice a few decades ago, I guess in python, None as the missing datum idiom is still quite prevalent: def cat_list(a=None, b=None): # poor man's list concatenation if

Re: question of style

2009-07-02 Thread Lie Ryan
Lie Ryan wrote: > Tim Harig wrote: >>> Speaking only to the style issue, when I've wanted to do something like >>> that, I find: >>>if self.higher is None is self.lower: >>> more readable, by making clear they are both being compared to a >

Re: question of style

2009-07-02 Thread Lie Ryan
Paul Rubin wrote: > Tim Harig writes: >> That being the case, it might be a good idea either to handle the situation >> and raise an exception or add: >> >> assert self.lower <= self.higher >> >> That way an exception will be raised if there is an error somewhere else >> in the code rather then si

<    5   6   7   8   9   10   11   >