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 <%[email protected]>, 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, [email protected] (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 +0000, 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

Re: question of style

2009-07-02 Thread Lie Ryan
Simon Forman wrote: > Hey I was hoping to get your opinions on a sort of minor stylistic > point. > These two snippets of code are functionally identical. Which would you > use and why? If self is an object (and it must have been), it would be preferrable to set self.higher and self.lower to a kno

Re: Sequence splitting

2009-07-03 Thread Lie Ryan
Brad wrote: > On Jul 2, 9:40 pm, "Pablo Torres N." wrote: >> If it is speed that we are after, it's my understanding that map and >> filter are faster than iterating with the for statement (and also >> faster than list comprehensions). So here is a rewrite: >> >> def split(seq, func=bool): >>

Re: logging of strings with broken encoding

2009-07-03 Thread Lie Ryan
Thomas Guettler wrote: > Stefan Behnel schrieb: >> 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.dec

Re: Sequence splitting

2009-07-03 Thread Lie Ryan
Rickard Lindberg wrote: >> I tried posting on python-ideas and received a "You are not allowed to >> post to this mailing list" reply. Perhaps because I am posting through >> Google groups? Or maybe one must be an approved member to post? > > If you got an "awaiting moderator approval" message you

Re: question of style

2009-07-03 Thread Lie Ryan
Paul Rubin wrote: > Lie Ryan writes: >> I guess in python, None as the missing datum idiom is still quite prevalent: > > Well, sometimes there is no way around it, but: > >> def cat_list(a=None, b=None): >> # poor man's list concatenation >&g

Re: Is code duplication allowed in this instance?

2009-07-03 Thread Lie Ryan
Klone wrote: > Hi all. I believe in programming there is a common consensus to avoid > code duplication, I suppose such terms like 'DRY' are meant to back > this idea. Anyways, I'm working on a little project and I'm using TDD > (still trying to get a hang of the process) and am trying to test the

Re: Sequence splitting

2009-07-03 Thread Lie Ryan
tsangpo wrote: > Just a shorter implementation: > > from itertools import groupby > def split(lst, func): > gs = groupby(lst, func) > return list(gs[True]), list(gs[False]) > As you're replying to my post, I assume you meant a shorter implementation my function. But it doesn't do the sam

Re: stringio+tarfile

2009-07-03 Thread Lie Ryan
superpollo wrote: >> First problem I see is all those numbers before the lines. That's not >> valid python. >> >> Assuming that was a transcription error > > not so. i intentionally add linenumbers to facilitare reference to the > code, but if it is a nuisance i will not include them anymore. Th

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Lie Ryan
kj wrote: > I'm will be teaching a programming class to novices, and I've run > into a clear conflict between two of the principles I'd like to > teach: code clarity vs. code reuse. I'd love your opinion about > it. Sometimes when the decision between clarity and generality becomes too hard; you

Re: Why re.match()?

2009-07-03 Thread Lie Ryan
Steven D'Aprano wrote: > On Thu, 02 Jul 2009 11:19:40 +, kj wrote: > >> I'm sure that it is possible to find cases in which the *current* >> implementation of re.search() would be inefficient, but that's because >> this implementation is perverse, which, I guess, is ultimately the point >> of

Re: Sequence splitting

2009-07-03 Thread Lie Ryan
Brad wrote: > On Jul 3, 12:57 am, Steven D'Aprano cybersource.com.au> wrote: >> I've never needed such a split function, and I don't like the name, and >> the functionality isn't general enough. I'd prefer something which splits >> the input sequence into as many sublists as necessary, according t

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Lie Ryan
mclovin wrote: > OK then. I will try some of the strategies here but I guess things > arent looking too good. I need to run this over a dataset that someone > pickled. I need to run this 480,000 times so you can see my > frustration. So it doesn't need to be "real time" but it would be nice > it wa

Re: question of style

2009-07-05 Thread Lie Ryan
Paul Rubin wrote: > Steven D'Aprano writes: >> "if len(x) == 0" is wasteful. Perhaps I've passed you a list-like >> iterable instead of a list, and calculating the actual length is O(N). > > That doesn't happen in any of Python's built-in container types. I > could see some value to having a g

Re: question of style

2009-07-05 Thread Lie Ryan
Steven D'Aprano wrote: > On Sun, 05 Jul 2009 11:37:49 +0000, Lie Ryan wrote: > >> Neither python's `if` nor `if` in formal logic is about testing True vs. >> False. `if` in python and formal logic receives a statement. The >> statement must be evaluatable to True

Re: A Bug By Any Other Name ...

2009-07-06 Thread Lie Ryan
Chris Rebert wrote: > On Mon, Jul 6, 2009 at 1:29 AM, Lawrence > D'Oliveiro wrote: >> In message , Tim Golden >> wrote: >> >>> The difficulty here is knowing where to put such a warning. >>> You obviously can't put it against the "++" operator as such >>> because... there isn't one. >> This bug is

Re: Clarity vs. code reuse/generality

2009-07-06 Thread Lie Ryan
Aahz wrote: > In article <[email protected]>, > Steven D'Aprano wrote: >> On Mon, 06 Jul 2009 14:32:10 +0200, Jean-Michel Pichavant wrote: >>> kj wrote: sense = cmp(func(hi), func(lo)) assert sense != 0, "func is not strictly monotonic in [lo, hi]" >>> As

Re: Method to separate unit-test methods and data?

2009-07-07 Thread Lie Ryan
Nick Daly wrote: > Hi, > > I was wondering if it's possible / if there are any simple methods > known of storing unit-test functions and their data in separate files? > > Perhaps this is a strange request, but it does an excellent job of > modularizing code. As far as revision control goes, it m

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Lie Ryan
Steven D'Aprano wrote: > On Tue, 07 Jul 2009 05:13:28 +0000, Lie Ryan wrote: > >> When people are fighting over things like `sense`, although sense may >> not be strictly wrong dictionary-wise, it smells of something burning... > > That would be my patience. >

Re: older pythons

2009-07-09 Thread Lie Ryan
superpollo wrote: > Adrian Dziubek wrote: >> The recommended Debian way is update-alternatives. I find it a bit >> unintuitive, so I have to read through the documentation every time I >> use it, but it should be able link a chosen version of python to /usr/ >> bin/python. I don't know if it's set

Re: older pythons

2009-07-09 Thread Lie Ryan
superpollo wrote: > Lie Ryan wrote: > >> AFAIK, no major linux distributions have officially ported to python >> 3.x. > > http://packages.debian.org/experimental/python3.1 > > thanks for help Note the word "experimental" -- http://mail.python.org/mailman/listinfo/python-list

Re: property using a classmethod

2009-07-09 Thread Lie Ryan
Emanuele D'Arrigo wrote: > Greetings, > > today I did something like this: > > class MyClass(object): > > @classmethod > def myClassMethod(self): > print "ham" > > myProperty = property(myClassMethod, None, None) > > As many of you know this doesn't work and returns a Typ

Re: Catching control-C

2009-07-09 Thread Lie Ryan
Michael Mossey wrote: > On Jul 6, 2:47 pm, Philip Semanchuk wrote: >> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: >> >>> What is required in a python program to make sure it catches a >>> control- >>> c on the command-line? Do some i/o? The OS here is Linux. >> You can use a try/except to

Re: Cleaning up after failing to contructing objects

2009-07-09 Thread Lie Ryan
brasse wrote: > Hello! > I have been thinking about how write exception safe constructors in > Python. By exception safe I mean a constructor that does not leak > resources when an exception is raised within it. The following is an > example of one possible way to do it: First, your automatic clea

Re: property using a classmethod

2009-07-09 Thread Lie Ryan
Bruno Desthuilliers wrote: > Lie Ryan a écrit : >> Emanuele D'Arrigo wrote: > (snip) >>> Ultimately all I want is a non-callable class-level attribute >>> MyClass.myProperty that gives the result of MyClass.myClassMethod(). >> >> This works like what

Re: older pythons

2009-07-09 Thread Lie Ryan
superpollo wrote: > Lie Ryan wrote: >> superpollo wrote: >> >>> Lie Ryan wrote: >>> >>> >>>> AFAIK, no major linux distributions have officially ported to python >>>> 3.x. >>> >>> http://packages.debian.

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-10 Thread Lie Ryan
Friðrik Már Jónsson wrote: > Hi Rhodri, > >> It's only really a pitfall if you try to use the built-in after you've >> redefined it. That's the thing to keep an eye open for. > > You're right, but in cases where you're editing a codebase which you > didn't author entirely by yourself you may not

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-10 Thread Lie Ryan
Simon Forman wrote: > On Thu, Jul 9, 2009 at 9:42 AM, Nick wrote: > >>fields = line.split() >>for i in range(len(fields)): >>fields[i] = float(fields[i]) > > > instead of the above code you could say: > > fields = [float(n) for n in in line.split()] > > Have fun getting back in

Re: Try... except....Try again?

2009-07-17 Thread Lie Ryan
Xavier Ho wrote: > oops, wrong address. > > When will reply-to tag appear on the Python mailing list? =/ > > Good idea, Steven and MRAB. > > I changed my code to the following: > > > def nPrime(self, n): > "Returns nth prime number, the first one being 2, where n = 0. > When n = 1,

Re: Rus Python script interactively

2009-07-18 Thread Lie Ryan
Gnarlodious wrote: > In an interactive session (I am using iPython), what is the most > elegant way to run a Python script from Terminal? Right now I am > saying: > > import subprocess > subprocess.call("python /path/to/scriptname.py", shell=True) > > But I am calling a shell process and I'd rath

Re: python command running old version

2009-07-18 Thread Lie Ryan
Tim Edwards wrote: >> Which OS? How did you install it? > > Sorry (see I need that coffee) > > Installed on redhat from source You should consult the distro's (i.e. RedHat's) documentation/mailing list about changing the default python interpreter. In most cases, you will need to make sure all p

Re: Documentation Problems

2009-07-22 Thread Lie Ryan
Inky 788 wrote: > On Jul 22, 7:15 am, Tim Golden wrote: >> Mark du Preez wrote: >>> Hi >>> Can anyone tell me where to go to suggest changes to the Python >>> documentation? >> Drop an entry in the tracker: >> >> http://bugs.python.org >> >> Patches are always welcome, > > Could you please provi

Re: How to document Python code properly for Pydoc

2009-07-22 Thread Lie Ryan
jorma kala wrote: > Hi, > Do you know where I can find the rules for documenting Python code, so > that automatic document generation with Pydoc makes the most of the > comments inserted in the code? > I know about documenting class and method through triple quote just > under the class definition.

Failed Regression Test: What socket.gethostname() is supposed to return?

2009-07-25 Thread Lie Ryan
In my laptop, socket.gethostname() returned my username, and causing one of python's "make test" regression test to error (test_socket): == ERROR: testSockName (test.test_socket.GeneralModuleTests)

Re: Class variable inheritance

2009-09-11 Thread Lie Ryan
HPJ wrote: And by the way, the reason I've come across this problem at all is because I have something like this: class A: class X: n = 'a' x = X() class B(A): class X(A.X): n = 'b' # x = X() The line commented out was originally not there, but I found out I had to add it if I wa

Re: ImageFont family mojibake

2009-09-11 Thread Lie Ryan
Donn wrote: Python 2.6 PIL Version: 1.1.6-3ubuntu1 libfreetype6 Version: 2.3.9-4ubuntu0.1 Hello, I have a feeling I've asked this in the distant past, but it's recently emerged as a bug in my app so can anyone point me in the right direction? In Fonty Python, when I draw the fa

Re: Dataflow programming in Python

2009-09-11 Thread Lie Ryan
Anh Hai Trinh wrote: Hello all, I just want to share with you something that I've worked on recently. It is a library which implements streams -- generalized iterators with a pipelining mechanism and lazy-evaluation to enable data-flow programming in Python. The idea is to be able to take the o

Re: Declaring array of Variables ?

2009-09-12 Thread Lie Ryan
Lennyboi wrote: Can I declare an array of variables in python like in C int p[10]; I looked everywhere, but I don't find any mention of it. p = [] -- http://mail.python.org/mailman/listinfo/python-list

Re: ImageFont family mojibake

2009-09-13 Thread Lie Ryan
Donn wrote: On Saturday 12 September 2009 17:30:19 garabik- [email protected] wrote: apt-get install unicode unicode 0100.. Nice tip, thanks. if you see a lot of accented letters (and not squares or question marks), you can be sure I see the accented chars -- so now I am m

Re: list as an instance attribute

2009-09-14 Thread Lie Ryan
Robin Becker wrote: Python is often put forward as a as a finger friendly language, but we have capitals encouraged for user class names and for some common values eg None, True, False these are required. And I'm glad it is, or else I'll get a finger-sore and an eye-sore -- http://mail.pyth

Re: An assessment of the Unicode standard

2009-09-16 Thread Lie Ryan
r wrote: On Sep 15, 4:12 am, Hendrik van Rooyen wrote: (snip) When a language lacks a word for a concept like "window", then (I believe :-) ), it kind of puts a crimp in the style of thinking that a person will do, growing up with only that language. Are you telling us people using a langua

Re: An assessment of the Unicode standard

2009-09-16 Thread Lie Ryan
r wrote: Not that I agree that it would be a Utopia, whatever the language - more like a nightmare of Orwellian proportions - because the language you get taught first, moulds the way you think. And I know from personal experience that there are concepts that can be succinctly expressed in on

Re: An assessment of the Unicode standard

2009-09-16 Thread Lie Ryan
r wrote: You're on a slippery slope when you claim that people deserve whatever mistreatment or misfortune comes their way through mere circumstances of birth. I suggest you step back and actually read your messages again and consider how others might interpret them. Paul: civilizations rise an

Re: Class variable inheritance

2009-09-16 Thread Lie Ryan
Terry Reedy wrote: Lie Ryan wrote: Note that when the python interpreter meets this statement: class B(P): def foo(self): print('ab') X = 'f' the compiler sees a class statement -> create a new blank class ->

Re: Optimising literals away

2010-09-01 Thread Lie Ryan
On 09/01/10 17:06, Stefan Behnel wrote: > MRAB, 31.08.2010 23:53: >> On 31/08/2010 21:18, Terry Reedy wrote: >>> On 8/31/2010 12:33 PM, Aleksey wrote: On Aug 30, 10:38 pm, Tobias Weber wrote: > Hi, > whenever I type an "object literal" I'm unsure what optimisation > will do > t

Re: Performance: sets vs dicts.

2010-09-01 Thread Lie Ryan
On 09/01/10 00:09, Aahz wrote: > In article , > Jerry Hill wrote: >> On Mon, Aug 30, 2010 at 7:42 PM, Aahz wrote: >>> >>> Possibly; IMO, people should not need to run timeit to determine basic >>> algorithmic speed for standard Python datatypes. >> >> http://wiki.python.org/moin/TimeComplexity t

Re: Static typing, Python, D, DbC

2010-09-11 Thread Lie Ryan
On 09/12/10 00:33, Bearophile wrote: > > > Lately while I program with Python one of the D features that I most > miss is a built-in Design By Contract (see PEP 316), because it avoids > (or helps me to quickly find and fix) many bugs. In my opinion DbC is > also very good used w

Re: Static typing, Python, D, DbC

2010-09-12 Thread Lie Ryan
On 09/12/10 08:53, John Nagle wrote: > On 9/11/2010 9:36 AM, Lie Ryan wrote: >> On 09/12/10 00:33, Bearophile wrote: >> >>> >>> >>> Lately while I program with Python one of the D features that I most >>> miss is a built-in

Re: Debugger - fails to "continue" with breakpoint set

2010-09-17 Thread Lie Ryan
On 09/16/10 03:38, Ed Greenberg wrote: > I'm pretty new to Python, but I am really enjoying it as an alternative > to Perl and PHP. > > When I run the debugger [import pdb; pdb.set_trace()] and then do next > and step, and evaluate variables, etc, when I hit 'c' for continue, we > go to the end, j

Re: The trouble with "dynamic attributes".

2010-09-17 Thread Lie Ryan
On 09/17/10 07:46, John Nagle wrote: >There's a tendency to use "dynamic attributes" in Python when > trying to encapsulate objects from other systems. It almost > works. But it's usually a headache in the end, and should be > discouraged. Here's why. I personally love them, they makes XML

Making logging.getLogger() simpler

2010-09-18 Thread Lie Ryan
I was expecting this to work: import logging logger = logging.getLogger(__name__) logger.warn('this is a warning') instead it produced the error: No handlers could be found for logger "__main__" However, if instead I do: import logging logging.warn('creating logger') logger = lo

Re: The trouble with "dynamic attributes".

2010-09-18 Thread Lie Ryan
On 09/18/10 03:53, Ethan Furman wrote: > Lie Ryan wrote: > [snip] >> And even dict-syntax is not perfect for accessing XML file, e.g.: >> >> >> foo >> bar >> >> >> should a['b'] be 'foo' or 'bar'? > &

Re: Too much code - slicing

2010-09-20 Thread Lie Ryan
On 09/19/10 17:31, Seebs wrote: > Basically, think of what happens as I read each symbol: > > x = x + 1 if condition else x - 1 > > Up through the '1', I have a perfectly ordinary assignment of a value. > The, suddenly, it retroactively turns out that I have misunderstood > everything

Re: Down with tinyurl! (was Re: importing excel data into a pythonmatrix?)

2010-09-20 Thread Lie Ryan
On 09/20/10 19:59, Tim Harig wrote: > On 2010-09-20, Steven D'Aprano wrote: >> On Mon, 20 Sep 2010 05:46:38 +, Tim Harig wrote: >> I'm not particularly convinced that these are *significant* complaints about URL-shorteners. But I will say, of the last couple hundred links I've

Re: Python in Linux - barrier to Python 3.x

2010-09-25 Thread Lie Ryan
On 09/22/10 02:44, Diez B. Roggisch wrote: > Antoine Pitrou writes: > >> On Tue, 21 Sep 2010 17:59:27 +0200 >> [email protected] (Diez B. Roggisch) wrote: >>> >>> The problems explained are simply outdated and crippled python >>> versions. >>> >>> And to me, a python version installed that has not th

Re: "Strong typing vs. strong testing"

2010-09-29 Thread Lie Ryan
On 09/30/10 11:17, Seebs wrote: > On 2010-09-30, RG wrote: >> That the problem is "elsewhere in the program" ought to be small >> comfort. > > It is, perhaps, but it's also an important technical point: You CAN write > correct code for such a thing. > >> int maximum(int a, int b) { return a >

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Lie Ryan
On 09/30/10 16:09, TheFlyingDutchman wrote: > >> >> That argument can be made for dynamic language as well. If you write in >> dynamic language (e.g. python): >> >> def maximum(a, b): >> return a if a > b else b >> >> The dynamic language's version of maximum() function is 100% correct -- >> i

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Lie Ryan
On 10/01/10 00:24, TheFlyingDutchman wrote: > >> >>> If I had to choose between "blow up" or "invalid answer" I would pick >>> "invalid answer". >> >> there are some application domains where neither option would be >> viewed as a satisfactory error handling strategy. Fly-by-wire, petro- >> chemic

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Lie Ryan
On 10/02/10 20:04, Nick Keighley wrote: >>> > > In a statically typed language, the of-the-wrong-type is something which >>> > > can, by definition, be caught at compile time. >> > >> > Any time something is true "by definition" that is an indication that >> > it's not a particularly useful fact. >

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Lie Ryan
On 10/05/10 14:36, salil wrote: > So, the programmer who > specifically mentions "Int" in the signature of the function, is > basically overriding this default behavior for specific reasons > relevant to the application, for example, for performance. I think > Haskell's way is the right. I agree

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Lie Ryan
On 10/01/10 23:56, BartC wrote: > > "Pascal J. Bourguignon" wrote in message > news:[email protected]... >> "BartC" writes: >> >>> "Pascal J. Bourguignon" wrote in message > When Intel will realize that 99% of its users are running VM >>> >>> Which one? >> >> Any

Re: Interactive mode under DOS?

2010-10-24 Thread Lie Ryan
On 10/24/10 21:37, huisky wrote: > Hi, > > I'm trying to use the interactive mode under DOS for Python 2.7. As a > newbie, I do NOT know what is the following problem: > world_is_flat=1 if world_is_flat: > .. . . print "be carefule to be not fall out!" > File "", line 2 > prin

Re: Exception Handling in Python 3

2010-10-24 Thread Lie Ryan
On 10/24/10 16:01, Steve Holden wrote: > I was somewhat surprised to discover that Python 3 no longer allows an > exception to be raised in an except clause (or rather that it reports it > as a separate exception that occurred during the handling of the first). FYI, Java has a similar behavior. In

Re: Why "flat is better than nested"?

2010-10-27 Thread Lie Ryan
On 10/26/10 06:56, Steve Holden wrote: > On 10/25/2010 3:11 PM, kj wrote: >> In Steve Holden >> writes: >> >>> On 10/25/2010 10:47 AM, rantingrick wrote: On Oct 25, 5:07 am, kj wrote: > In "The Zen of Python", one of the "maxims" is "flat is better than > nested"? Why? Can anyone

<    6   7   8   9   10   11   12   >