Re: How to generate pdf file from an html page??

2007-12-20 Thread MonkeeSage
On Dec 19, 10:17 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-12-19, Terry Jones <[EMAIL PROTECTED]> wrote: > > > > >> "Grant" == Grant Edwards <[EMAIL PROTECTED]> writes: > >Grant> On 2007-12-19, abhishek <[EMAIL PROTECTED]> wrote: > > Hi everyone, I am trying to generate a PDF

Re: free video lessons on 12 computer Science Courses

2007-12-17 Thread MonkeeSage
On Dec 17, 6:12 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Dec 17, 3:13 am, AK444 <[EMAIL PROTECTED]> wrote: > > > Hi Guys, Good news is that as many as 12 courses from top > > universities are providing free video lessons > > http://freevideolectures

Re: Finite State Machine GUI editor in python?

2007-12-17 Thread MonkeeSage
On Dec 16, 1:55 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > I have spent some time googling and on wiki and came up with > pyFSA in python. It may end up being useful, but it is not directly > what I am looking for, as there is no GUI that I can see. > > I know about SMC, but it is not Py

Re: free video lessons on 12 computer Science Courses

2007-12-17 Thread MonkeeSage
On Dec 17, 3:13 am, AK444 <[EMAIL PROTECTED]> wrote: > Hi Guys, Good news is that as many as 12 courses from top > universities are providing free video lessons > http://freevideolectures.com/ComputerScience/ > on all the basic courses. All you need to have is Real Player > installed on your PC.

Re: Windows XP unicode and escape sequences

2007-12-16 Thread MonkeeSage
On Dec 16, 5:28 pm, <[EMAIL PROTECTED]> wrote: > Thank you John and Tim. > > With your help I found that the XP console code page is set up for 'cp437' > and with a little bit of browsing I found that 869 is the code page for > Modern Greek. After changing it to 869 that did the trick! Thanks v

Re: Is Python really a scripting language?

2007-12-16 Thread MonkeeSage
On Dec 14, 3:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Dec 14, 2:48 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > > > On Dec 14, 2007 2:09 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > On Dec 11, 10:34 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > > > "Ron Provo

Re: searching a value of a dict (each value is a list)

2007-12-14 Thread MonkeeSage
On Dec 10, 1:28 pm, [EMAIL PROTECTED] wrote: > Seongsu Lee: > > >I have a dictionary with million keys. Each value in the dictionary has a > >list with up to thousand integers.< > > Let's say each integer can be represented with 32 bits (if there are > less numbers then a 3-byte representation may

Re: Is a "real" C-Python possible?

2007-12-11 Thread MonkeeSage
On Dec 11, 3:10 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > sturlamolden <[EMAIL PROTECTED]> wrote: > > On 9 Des, 23:34, Christian Heimes <[EMAIL PROTECTED]> wrote: > > >> >http://antoniocangiano.com/2007/11/28/holy-shmoly-ruby-19-smokes-pyth > >> >... > > >> The Ruby developers are allowed to be

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread MonkeeSage
On Dec 10, 9:45 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Dec 10, 8:31 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > > > > On 2007-12-10, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > > If I'm not mistaken, building a reverse dictionary li

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread MonkeeSage
On Dec 10, 8:31 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-10, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > If I'm not mistaken, building a reverse dictionary like that will be > > O(n*m) because dict/list access is O(n) (ammortized). Somebody correc

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread MonkeeSage
On Dec 10, 8:31 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-10, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > If I'm not mistaken, building a reverse dictionary like that will be > > O(n*m) because dict/list access is O(n) (ammortized). Somebody correc

Re: Distinguishing attributes and methods

2007-12-10 Thread MonkeeSage
On Dec 10, 7:19 am, Bruno Desthuilliers wrote: > MonkeeSage a écrit : > > > It seems that I've got a short-circuit somewhere here. I understand > > that everything is an object and the the storage/lookup system is > > object-agnostic, and that it is only the descripto

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread MonkeeSage
On Dec 10, 3:50 am, Seongsu Lee <[EMAIL PROTECTED]> wrote: > On 12월10일, 오후12시18분, Adonis Vargas <[EMAIL PROTECTED]> > wrote: > > > > > Seongsu Lee wrote: > > > Hi, > > > > I have a dictionary with million keys. Each value in the > > > dictionary has a list with up to thousand integers. > > > Follow

Re: Distinguishing attributes and methods

2007-12-10 Thread MonkeeSage
It seems that I've got a short-circuit somewhere here. I understand that everything is an object and the the storage/lookup system is object-agnostic, and that it is only the descriptors (or "tags" as I called them generically) that determine how an attribute is bound, whether it is bound at all, w

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
On Dec 9, 6:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > Hi Bruno, > > I think that we've been having a mainly "semantic" (pun intended) > dispute. I think you're right, that we've been using the same words > with different meanings. > > I w

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
Hi Bruno, I think that we've been having a mainly "semantic" (pun intended) dispute. I think you're right, that we've been using the same words with different meanings. I would like to say firstly that I've been using python for a few years now (about three I think), and I think I have a basic gr

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
On Dec 9, 3:10 pm, I V <[EMAIL PROTECTED]> wrote: > On Sun, 09 Dec 2007 11:58:05 -0800, MonkeeSage wrote: > > class A > > attr_accessor :a # == self.a, > ># accessible to instances of A > > def initialize > > @a = "foo"

Re: Distinguishing attributes and methods

2007-12-09 Thread MonkeeSage
On Dec 8, 4:11 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > > > > On Dec 8, 12:56 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > >>MonkeeSage a écrit : > > >>>On Dec 8, 2:10 am, Marc '

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
On Dec 9, 1:58 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > Sure. But as I understand, every attribute in python is a value, sorry...*references* a value -- http://mail.python.org/mailman/listinfo/python-list

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
On Dec 8, 4:54 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > > > > On Dec 8, 12:42 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > >>MonkeeSage a écrit : > > >>>On Dec 7, 11:08 pm, Steve

Re: Distinguishing attributes and methods

2007-12-08 Thread MonkeeSage
On Dec 8, 2:51 pm, Glenn Hutchings <[EMAIL PROTECTED]> wrote: > On Dec 8, 7:44 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > I think it muddies the water to say that a.a() and a.a are the same > > thing--obviously they are not. > > A thing is not what it is;

Re: Distinguishing attributes and methods

2007-12-08 Thread MonkeeSage
On Dec 8, 12:56 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > > > > On Dec 8, 2:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > >>On Fri, 07 Dec 2007 23:19:40 -0800, tjhnson wrote: > > >&g

Re: a Python person's experience with Ruby

2007-12-08 Thread MonkeeSage
On Dec 8, 12:42 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > > On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > > (snip) > >> 4) Ruby forces you to explicitly make attributes for > >> instance variabl

Re: How does python build its AST

2007-12-08 Thread MonkeeSage
On Dec 8, 3:32 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 7, 9:23 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > A quick question about how python parses a file into compiled > > bytecode. Does it parse the whole file into AST first and then compile >

Re: Distinguishing attributes and methods

2007-12-08 Thread MonkeeSage
On Dec 8, 6:50 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 08 Dec 2007 00:34:06 -0800, MonkeeSage wrote: > > I think he means callable attributes (methods) and non-callable > > attributes (variables). > > But not every callable attribute

Re: Distinguishing attributes and methods

2007-12-08 Thread MonkeeSage
On Dec 8, 2:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Fri, 07 Dec 2007 23:19:40 -0800, tjhnson wrote: > > With properties, attributes and methods seem very similar. I was > > wondering what techniques people use to give clues to end users as to > > which 'things' are methods

Re: How does python build its AST

2007-12-07 Thread MonkeeSage
On Dec 8, 12:20 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "MonkeeSage" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | 1.) What is the benefit of doing a two phase compilation (parsing/ > | compiling), rather th

Re: a Python person's experience with Ruby

2007-12-07 Thread MonkeeSage
On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > Python is my favorite programming language. I've used > it as my primary language for about six years now, > including four years of using it full-time in my day > job. Three months ago I decided to take a position > with a team that d

Re: How does python build its AST

2007-12-07 Thread MonkeeSage
On Dec 7, 4:29 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "MonkeeSage" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > |A quick question about how python parses a file into compiled > | bytecode. Does it parse the whole file

Re: How does python build its AST

2007-12-07 Thread MonkeeSage
On Dec 7, 9:50 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On Dec 7, 3:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > A quick question about how python parses a file into compiled > > bytecode. Does it parse the whole file into AST first and then compile >

How does python build its AST

2007-12-07 Thread MonkeeSage
A quick question about how python parses a file into compiled bytecode. Does it parse the whole file into AST first and then compile the AST, or does it build and compile the AST on the fly as it reads expressions? (If the former case, why can't functions be called before their definitions?) Thank

Re: __iadd__ useless in sub-classed int

2007-12-07 Thread MonkeeSage
On Dec 7, 12:45 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 07 Dec 2007 03:01:28 -0300, MonkeeSage <[EMAIL PROTECTED]> > escribió: > > > I've wondered about this myself. Seems to me, to prevent clobbering > > subclasses, __iadd_

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread MonkeeSage
On Dec 6, 3:02 pm, samwyse <[EMAIL PROTECTED]> wrote: > On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > samwyse schrieb: > > > > For whatever reason, I need an inproved integer. Sounds easy, let's > > > just subclass int: > > > class test(int): > > >pass > > > >

Re: Capturing global input?

2007-12-06 Thread MonkeeSage
On Dec 6, 9:16 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Dec 6, 3:51 pm, nomihn0 <[EMAIL PROTECTED]> wrote: > > > I'd like to accept mouse gestures and keyboard shortcuts as input to a > > program. The nature of this program requires that these comma

Re: Capturing global input?

2007-12-06 Thread MonkeeSage
On Dec 6, 3:51 pm, nomihn0 <[EMAIL PROTECTED]> wrote: > I'd like to accept mouse gestures and keyboard shortcuts as input to a > program. The nature of this program requires that these commands be > issued regardless of the currently active window. Here's the rub: I > need a platform-independent so

Re: Class destructor -- strange behaviour

2007-12-06 Thread MonkeeSage
On Dec 6, 3:51 pm, Spes <[EMAIL PROTECTED]> wrote: > Hi, > > I have this simple code: > | #!/usr/bin/python > | import codecs > | import re > | from copy import deepcopy > | > | class MyClass(object): > | def __del__(self): > | deepcopy(1) > | > | x=MyClass() > > but I get an error: > | Excep

Re: converting to and from octal escaped UTF--8

2007-12-04 Thread MonkeeSage
On Dec 3, 8:10 am, Michael Goerz <[EMAIL PROTECTED]> wrote: > MonkeeSage wrote: > > On Dec 3, 1:31 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > >> On Dec 2, 11:46 pm, Michael Spencer <[EMAIL PROTECTED]> wrote: > > >>> Michael Goerz wrote: > >

Re: Generating API documentation as a textfile

2007-12-03 Thread MonkeeSage
On Dec 3, 8:58 am, Samuel <[EMAIL PROTECTED]> wrote: > On Mon, 03 Dec 2007 06:45:45 -0800, Giampaolo Rodola' wrote: > > dir.__doc__ > > This contains only the docstring one object (module, class, > function, ...). I was thinking more of the complete API documentation > that can be found in a file,

Re: "Python" is not a good name, should rename to "Athon"

2007-12-03 Thread MonkeeSage
On Dec 3, 5:39 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > On Dec 3, 2:40 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > > Until the OP posted his lastest 'why', I assumed this proposal was an April > > Fools' post that he just could not wait to post. In fact, given that the > > effective cost wo

Re: "Python" is not a good name, should rename to "Athon"

2007-12-03 Thread MonkeeSage
On Dec 3, 7:23 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Mon, 03 Dec 2007 02:12:17 -0800, MonkeeSage wrote: > > Being fair, the bulk of Liebniz' writings have also been rejected by > > those in related fields. Most modern metaphysicians h

Re: "Python" is not a good name, should rename to "Athon"

2007-12-03 Thread MonkeeSage
On Dec 2, 4:47 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 01 Dec 2007 23:55:32 -0800, Russ P. wrote: > > I neither know nor care much about Newton's personality and social > > graces, but I can assure you that he was more than a "technician" (no > > offense to techn

Re: minimalist web server

2007-12-03 Thread MonkeeSage
On Dec 2, 10:13 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > > > The reason I need this is that my current best strategy to avoid ads in > > > web pages is putting all ad server names into /etc/hosts and stick my > > > local ip number next to them (127.0.0.1) so every ad request goes to my

Re: converting to and from octal escaped UTF--8

2007-12-02 Thread MonkeeSage
On Dec 3, 1:31 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Dec 2, 11:46 pm, Michael Spencer <[EMAIL PROTECTED]> wrote: > > > > > Michael Goerz wrote: > > > Hi, > > > > I am writing unicode stings into a special text file that requires to > &

Re: converting to and from octal escaped UTF--8

2007-12-02 Thread MonkeeSage
On Dec 2, 11:46 pm, Michael Spencer <[EMAIL PROTECTED]> wrote: > Michael Goerz wrote: > > Hi, > > > I am writing unicode stings into a special text file that requires to > > have non-ascii characters as as octal-escaped UTF-8 codes. > > > For example, the letter "Í" (latin capital I with acute, cod

Re: converting to and from octal escaped UTF--8

2007-12-02 Thread MonkeeSage
On Dec 2, 8:38 pm, Michael Goerz <[EMAIL PROTECTED]> wrote: > Michael Goerz wrote: > > Hi, > > > I am writing unicode stings into a special text file that requires to > > have non-ascii characters as as octal-escaped UTF-8 codes. > > > For example, the letter "Í" (latin capital I with acute, code p

Re: "Show this file in explorer"

2007-12-01 Thread MonkeeSage
On Dec 1, 2:58 pm, farsheed <[EMAIL PROTECTED]> wrote: > But now I have a more technical question. when I run this command, I > saw that the windows explorer did not refresh,example: I have two > files in a folder and i use that command to select them from command > line, the first one will be sel

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread MonkeeSage
On Dec 1, 4:11 am, Bjoern Schliessmann wrote: > [EMAIL PROTECTED] wrote: > > New name "Pytn" may be better, do you think so ? > > No. How would you pronounce it? Pai-tn? > > Why don't you create a fork where the only difference is the name? > > Regards, > > Björn > > -- > BOFH excuse #194: > > We

Re: reading raw variables from file

2007-11-30 Thread MonkeeSage
On Nov 30, 10:05 am, "Martin Blume" <[EMAIL PROTECTED]> wrote: > "Bruno Desthuilliers" schrieb > > > > > >> I have a file that might contain literal python > > >> variable statements at every line. For example > > >> the file info.dat looks like this: > > >> users = ["Bob", "Jane"] > > >> status =

Re: How to Teach Python "Variables"

2007-11-28 Thread MonkeeSage
On Nov 28, 8:35 am, Aaron Watters <[EMAIL PROTECTED]> wrote: > On Nov 27, 5:31 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > Of course. But then it really depends on the teaching methodology, > > doesn't it? There is no reason (well, barring the restraints of

Re: How to Teach Python "Variables"

2007-11-27 Thread MonkeeSage
On Nov 27, 2:49 pm, Aaron Watters <[EMAIL PROTECTED]> wrote: > In practice there is too much to understand all at > once and in the beginning you have to say "don't worry about that > right now, consider it magic..." Of course they should > eventually understand it. Of course. But then it really

Re: How to Teach Python "Variables"

2007-11-27 Thread MonkeeSage
On Nov 27, 11:50 am, Donn Cave <[EMAIL PROTECTED]> wrote: > In contrast, I suspect that someone who learns Python concepts > in terms of explanations like `boxes' or `pointers' or whatnot > is at some disadvantage while that lasts, like translating a > foreign language to your own instead of attac

Re: A bug in Python's regular expression engine?

2007-11-27 Thread MonkeeSage
On Nov 27, 10:52 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Nov 27, 10:19 am, "Just Another Victim of the Ambient Morality" > > <[EMAIL PROTECTED]> wrote: > > That is funny. Thank you for your help... > > Just for clarification, what does t

Re: A bug in Python's regular expression engine?

2007-11-27 Thread MonkeeSage
On Nov 27, 10:19 am, "Just Another Victim of the Ambient Morality" <[EMAIL PROTECTED]> wrote: > That is funny. Thank you for your help... > Just for clarification, what does the "r" in your code do? It means a "raw" string (as you know ruby, think of it like %w{}): This page explains a

Re: the annoying, verbose self

2007-11-27 Thread MonkeeSage
On Nov 27, 4:22 am, Bruno Desthuilliers > You don't have to subclass function to define a callable type that > implements the descriptor protocol so it behaves just like a function in > the context of an attribute lookup. I'm aware, and I understand that python's types (as with other duck- typed

Re: spawning a process with subprocess

2007-11-27 Thread MonkeeSage
On Nov 27, 4:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > MonkeeSage <[EMAIL PROTECTED]> wrote: > > Couple of things. You should use poll() on the Popen instance, and > > should check it explicitly against None (since a 0 return code, > > meaning exit s

Re: Find & Replace hyperlinks in a string

2007-11-27 Thread MonkeeSage
On Nov 27, 1:37 am, Nico Grubert <[EMAIL PROTECTED]> wrote: > Hi there, > > I have a string containing some hyperlinks. I'd like to replace every > hyperlink with a HTML style link. > > Example: > > Replace >'http://www.foo.com/any_url' > with >'http://www.foo.com/any_url";>http://

Re: the annoying, verbose self

2007-11-27 Thread MonkeeSage
On Nov 27, 3:20 am, Roy Smith <[EMAIL PROTECTED]> wrote: > If you want to have a little fun: > > class peverse: > def __call__(self): > raise AttributeError ("peverse instance has no __call__ method") > > x = peverse() > x() That is "peverse", but still... from types import FunctionT

Re: spawning a process with subprocess

2007-11-26 Thread MonkeeSage
Hi Brian, Couple of things. You should use poll() on the Popen instance, and should check it explicitly against None (since a 0 return code, meaning exit successfully, will be treated as a false condition the same as None). Also, in your second example, you block the program when you call readline

Re: import pysqlite2 or import sqlite3?

2007-11-25 Thread MonkeeSage
On Nov 25, 3:30 pm, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > MonkeeSage <[EMAIL PROTECTED]> wrote: > > I use the following for a progam I wrote using sqlite, to ensure > > maximum compatibility (since the API is the same, importing them both > > as &#x

Re: the annoying, verbose self

2007-11-25 Thread MonkeeSage
The issue of lexical scope still looms large on the horizon. How does one distinguish between attributes (as scoped by the "with" clause), local/global variables, and function/method calls? There doesn't seem to be an easy way. You'd need multiple passes over the data to determine various scopes --

Re: the annoying, verbose self

2007-11-25 Thread MonkeeSage
I like the explicit "self", personally. It helps distinguish class methods from functions. When I see a "self" I think "A-ha, a class method". Of course, I could tell that from just the indentation and following that back to the class declaration, but as a quick reference I find it helpful. Besides

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-25 Thread MonkeeSage
On Nov 24, 6:42 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > This has nothing, absolutely NOTHING, to do with memoization. Memoization > trades off memory for time, allowing slow functions to return results > faster at the cost of using more memory. The OP wants to save memo

Re: import pysqlite2 or import sqlite3?

2007-11-25 Thread MonkeeSage
I use the following for a progam I wrote using sqlite, to ensure maximum compatibility (since the API is the same, importing them both as 'sqlite' should be fine): try: from sqlite3 import dbapi2 as sqlite # python 2.5 except: try: from pysqlite2 import dbapi2 as sqlite except: print

Re: Disk Space Script

2007-11-24 Thread MonkeeSage
On Nov 24, 11:46 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I would like to write a script in Python to email me when disk space > gets below a certain value. OK, I'll give you the easy way using your example and popen, and then a more complex example that doesn't rely on df/grep/awk an

Re: eof

2007-11-23 Thread MonkeeSage
On Nov 23, 10:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > This is not the same as ISO C. f.tell could be equal to > File.size(f.path) and eof could be false. An extra read() is required. My bad. As you might have surmised, I'm not a genius when it comes to C. I thought that the eof f

Re: eof

2007-11-23 Thread MonkeeSage
On Nov 23, 10:00 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Ruby doesn't have the good ol' eof. Good old eof tests a single flag > and requires a pre read(). Ruby's eof blocks and does buffering (and > this is a very strong technical statement). Actually, to be a bit more technical, IO

Re: Clean way to get one's network IP address?

2007-11-23 Thread MonkeeSage
k you. For linux (and possibly other POSIX-like OS', though reported not to work on FreeBSD), see the pure python 'ifconfig' script I posted here: http://groups.google.com/group/comp.lang.python/browse_thread/thread/52ad421ed64ec3fc/13e2a0609920c27b?lnk=gst&q=monkeesage+hwadd

Re: foldr function in Python

2007-11-23 Thread MonkeeSage
On Nov 23, 8:56 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > This doesn't matter for non-associative functions > like "+", but it does for associative functions like "-". Err...that's backwards...should have been: This doesn't matter for asso

Re: eof

2007-11-23 Thread MonkeeSage
On Nov 23, 6:56 pm, greg <[EMAIL PROTECTED]> wrote: > By not providing an eof() function, C -- and Python -- make > it clear that testing for eof is not a passive operation. > It's always obvious what's going on, and it's much harder to > make mistakes like the above. err...C has feof() in stdio

Re: foldr function in Python

2007-11-23 Thread MonkeeSage
On Nov 23, 7:05 pm, greg <[EMAIL PROTECTED]> wrote: > My feeling is that Python shouldn't provide a bunch of > different versions of the same function that differ only in > the degree of currying. If you want a particular curried > combination, it's easy enough to create it as needed using > lambd

Re: eof

2007-11-23 Thread MonkeeSage
On Nov 22, 11:04 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > I think it's too low level, and so doesn't do what naive users > expect. It's really only useful, even in C, as part of the > forensic study of a stream in an error state, [...] Indeed. I just wrote a little implementation of an IPS p

Re: newbie Q: sequence membership

2007-11-18 Thread MonkeeSage
On Nov 19, 12:32 am, saccade <[EMAIL PROTECTED]> wrote: > I am not a programmer so I feel odd commenting about language design > decisions. When my Prof. introduced python the first question that > popped into mind was that since "x=9; y=9; print x is y and x == y" > prints "True" is there a way t

Re: Python too complex ?!?!?!

2007-11-18 Thread MonkeeSage
On Nov 17, 7:46 am, Brian <[EMAIL PROTECTED]> wrote: > Had a unsettling conversation with a CS instructor that > teaches at local high schools and the community > college. This person is a long-term Linux/C/Python > programmer, but he claims that the install, config, and > library models for C# hav

Re: regular expression

2007-11-18 Thread MonkeeSage
On Nov 18, 3:54 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > What the heck is that format? XML's retarded cousin living in the attic? ROFL...for some reason that makes me think of wierd Ed Edison from maniac mansion, heh ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple eval

2007-11-18 Thread MonkeeSage
As I see it, just as a matter of common sense, there will be no way to match the performance of the backend eval() with any interpreted code. At best, performance-wise, a preprocessor for the built-in eval() would be in order, filtering out the "unsafe" cases and passing the rest through. But what

Re: A proposal for attribute lookup failures

2007-11-18 Thread MonkeeSage
On Nov 18, 5:59 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > No need to excuse. I think Ruby provides a nice context for discussing > the semantics of top level "open classes". But I think those are > entirely different than your contextual bindings. Note I find your > proposal somewhat confusing

Re: A proposal for attribute lookup failures

2007-11-18 Thread MonkeeSage
Ps. Just for kicks, here is a simple ruby 1.8 mock-up of the proposal (sorry for using ruby, but I don't know enough C to start hacking the CPython backend; I think that a higher-level example is conceptually clearer anyhow). Reference cycles are not detected in the example. #!/usr/bin/ruby class

Re: A proposal for attribute lookup failures

2007-11-18 Thread MonkeeSage
On Nov 18, 5:27 am, James Stroud <[EMAIL PROTECTED]> wrote: > It would be unoriginal of me to suggest that this violates the explicit > is better than implicit maxim. But it does. That's what I meant about hiding the complexity of an attribute failure. Though, sometimes implicit is acceptable (e.

A proposal for attribute lookup failures

2007-11-17 Thread MonkeeSage
Proposal: When an attribute lookup fails for an object, check the top-level (and local scope?) for a corresponding function or attribute and apply it as the called attribute if found, drop through to the exception otherwise. This is just syntactic sugar. Example: a = [1,2,3] a.len() #

Re: Single string print statements on multiple lines.

2007-03-12 Thread MonkeeSage
HeEm wrote: > In my 100 level CS course, I was asked to create multiple lines of > output within a single string. Of course I know how to: If this is for a CS course, you shouldn't really be cheating and asking for an answer here, should you? I mean, the whole point of taking (and paying for!) a

Re: number generator

2007-03-11 Thread MonkeeSage
On Mar 11, 2:16 am, greg <[EMAIL PROTECTED]> wrote: > MonkeeSage wrote: > > this ... requires that M be evenly divisible by N, > > No, it doesn't -- I never said the numbers had > to be *equal*. Sorry for not being clear. I was refering to my specific implementat

Re: number generator

2007-03-10 Thread MonkeeSage
On Mar 10, 11:26 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > To compare to the "cheat" method, calculate the mean and standard > deviation of this sample, and compare to those from the other method. I belieive you (mainly because I'm too lazy to write the sieve, hehe). ;) Regards, Jordan --

Re: minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread MonkeeSage
" "first person shooter" programming language " OMG! Thank's freakin awsome, lol!!! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in a desktop environment

2007-03-10 Thread MonkeeSage
On Mar 10, 9:23 pm, "David Cramer" <[EMAIL PROTECTED]> wrote: > If you had an application that you were about to begin development on > which you wanted to be cross platform (at least Mac and Windows), > would you suggest using c++ and Python? Depending on what exactly you're trying to do, a pure

Re: Help controlling CDROM from python

2007-03-10 Thread MonkeeSage
On Mar 10, 4:11 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote: > win32file.CreateFile(r'\\.\\' + drive, GENERIC_READ, > FILE_SHARE_READ, > None, OPEN_EXISTING, 0, 0) Oops! That should have been: h = win32file.Create

Re: number generator

2007-03-10 Thread MonkeeSage
On Mar 10, 6:47 pm, Paul Rubin wrote: > The fencepost method still seems to be simplest: > > t = sorted(random.sample(xrange(1,50), 4)) > print [(j-i) for i,j in zip([0]+t, t+[50])] Simpler, true, but I don't think it gives any better distribution... import rand

Re: number generator

2007-03-10 Thread MonkeeSage
On Mar 10, 3:16 am, greg <[EMAIL PROTECTED]> wrote: > Another possibility is to generate a list of N non-random > numbers that sum to M, and then adjust them up or down > by random amounts. By performing up/down adjustments in > pairs, you can maintain the sum invariant at each step. > So then it's

Re: Help controlling CDROM from python

2007-03-10 Thread MonkeeSage
On Mar 10, 8:27 am, Ognjen Bezanov <[EMAIL PROTECTED]> wrote: > My issue is that I need to be able to eject the CDROM tray even if there > is no disk inside. Here's a Q&D version (haven't tested the windows part, it's from an old mailing list post, but it looks correct): import os, sys if 'win'

Re: Where to "import"?

2007-03-08 Thread MonkeeSage
On Mar 8, 10:27 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > Class names should be CamelCase. Read it again, and notice the difference > between a "Descriptive" section and a "Prescriptive" one. Yes, I misread Bruno's comment (missed that he was speaking of class names). Disregard my post.

Re: I am a new guy on python world

2007-03-08 Thread MonkeeSage
Welcome. :) Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to "import"?

2007-03-08 Thread MonkeeSage
Disregard my last message, I'm stupid. I totally missed that Bruno was talking about classname. Bruno is exactly right. -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to "import"?

2007-03-08 Thread MonkeeSage
On Mar 8, 5:49 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> > >>1/ better to stick to naming conventions (class names in CamelCase) > > > Ok. Thanks. > > FWIW:http://www.python.org/dev/peps/pep-0008/ By my reading, PEP8 doesn't specify CamelCase as preferred over the other styles it mentions. non_c

Re: catching exceptions from an except: block

2007-03-07 Thread MonkeeSage
On Mar 7, 4:58 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >except_retry: # the missing(???) keyword you're after What is 'except_retry'? To the OP, with the loop and the callables you could also break out of the loop when the condition is met and use the else condition to raise the ex

Re: finding monitor or screen resolution in Linux with standard python module

2007-03-07 Thread MonkeeSage
On Mar 7, 4:25 am, "akbar" <[EMAIL PROTECTED]> wrote: > I googled and searched in archive. All I can find is finding > resolution with Tkinter and pygame. Any idea to find monitor > resolution with standard python module? > I can check from output of: xprop -root > _NET_DESKTOP_GEOMETRY(CARDINAL) .

Re: Interface Implementation in Python

2007-03-06 Thread MonkeeSage
On Mar 6, 6:23 pm, [EMAIL PROTECTED] wrote: > I dont want to expose the above Point3D implementation to the user / > client side.To achieve that we can use interface concept.In Python to > use interface concept. In python you would use name mangling to hide parts of the interface from the public.

Re: SPE python IDE: Call for testers!

2007-03-06 Thread MonkeeSage
Very nice. One issue I've come across is that it doesn't seem to work with < wxwidgets-2.8 (segfault when trying to load a file), so you should probably set MIN_WX_VERSION to 2.8. Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: how can I find out the value of an environment variable?

2007-03-05 Thread MonkeeSage
On Mar 5, 8:22 pm, "ken" <[EMAIL PROTECTED]> wrote: > how can I find out the value of an environment variable in my pythong > script? > > Thank you. RTFM... os.getenv http://docs.python.org/lib/os-procinfo.html Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is every number in a list in a range?

2007-03-05 Thread MonkeeSage
On Mar 5, 9:19 pm, Paul Rubin wrote: > OK, I didn't read the question that way. I thought the person just > wanted a yes or no answer to whether the list contained any elements > outside the desired range. If the purpose is to select the elements > in the range, then us

Re: Is every number in a list in a range?

2007-03-05 Thread MonkeeSage
On Mar 5, 9:03 pm, Paul Rubin wrote: > Maybe I didn't undrestand the question. Say maxnum is 30 in your > example above. Then as soon as 46 is seen, you can stop checking, I > thought. Yes, as long as 29 doesn't follow 46. inlist = [1, 5, 23, 46, 29, 21] If you want

Re: Is every number in a list in a range?

2007-03-05 Thread MonkeeSage
On Mar 5, 7:24 pm, Paul Rubin wrote: > This genexp is better than a loop because it bails out immediately > if it finds an out-of-range x. That's true: assuming that input is sequential. But if it's farily random (e.g., [10, 20, 12, 46, 202, 5, 102]), then you need a loo

  1   2   3   >