Re: USB in python

2009-01-27 Thread Lie Ryan
On Mon, 26 Jan 2009 11:08:48 -0600, Unknown wrote: > On 2009-01-26, Lie Ryan wrote: > >> How about (a crazy idea) using the audio jack out? (DISCLAIMER: Little >> Hardware Experience). High pitched sound (or anything in sound-ology >> that means high voltage) means

Re: USB in python

2009-01-26 Thread Lie Ryan
On Fri, 23 Jan 2009 18:56:38 +1100, Astan Chee wrote: > Diez B. Roggisch wrote: >>> >>> >> If all you need is on-off - why can't you just use a switch? >> >> >> > Because I want to control the on-off the device using a computer and > write software for it (which I am confident I can do i

Re: I'm a python addict !

2009-01-24 Thread Lie Ryan
On Fri, 23 Jan 2009 19:58:09 -0700, Linuxguy123 wrote: > I just started using python last week and I'm addicted. you need to try this: import antigravity http://xkcd.com/353/ -- http://mail.python.org/mailman/listinfo/python-list

Re: string in files

2008-12-30 Thread Lie Ryan
On Tue, 30 Dec 2008 11:53:17 +0100, Glauco wrote: >> thanks brother >> i mean how do i particularly assign (u = this) >> (y = is) >> in the strings up there. i have been able to split strings with any >> character sign. >> >> > > If i'm not wrong this is

Re: Python's popularity

2008-12-23 Thread Lie Ryan
On Mon, 22 Dec 2008 21:05:22 -0800, r wrote: > On Dec 22, 10:09 pm, Ben Kaplan wrote: >> That's just because most of us don't say anything unless we have >> something useful to say. We prefer to let the experts answer the >> questions, but we read the threads so we can benefit from them. > > OK

Re: print to console without a line break

2008-12-23 Thread Lie Ryan
On Tue, 23 Dec 2008 11:50:59 +0100, Qian Xu wrote: > Hello All, > > Is it possible to print something to console without a line break? > > I tried: > sys.stdout.write("Testing something ...") // nothing will be printed > time.sleep(1) > sys.stdout.write("done\n") // now, the whole string w

Re: Generator slower than iterator?

2008-12-16 Thread Lie Ryan
On Tue, 16 Dec 2008 12:07:14 -0300, Federico Moreira wrote: > Hi all, > > Im parsing a 4.1GB apache log to have stats about how many times an ip > request something from the server. > > The first design of the algorithm was > > for line in fileinput.input(sys.argv[1:]): > ip = line.split()[

Re: Generator slower than iterator?

2008-12-16 Thread Lie Ryan
On Tue, 16 Dec 2008 12:07:14 -0300, Federico Moreira wrote: > Hi all, > > Im parsing a 4.1GB apache log to have stats about how many times an ip > request something from the server. > > The first design of the algorithm was > > for line in fileinput.input(sys.argv[1:]): > ip = line.split()[

Re: Structure using whitespace vs logical whitespace

2008-12-16 Thread Lie Ryan
On Mon, 15 Dec 2008 08:29:31 -0800, cmdrrickhun...@yaho.com wrote: > I've been trying to search through the years of Python talk to find an > answer to this, but my Googlefu is weak. > > In most languages, I'll do something like this > > xmlWriter.BeginElement("parent"); > xmlWriter.BeginEle

Re: alt.possessive.its.has.no.apostrophe

2008-12-15 Thread Lie Ryan
On Mon, 15 Dec 2008 11:53:40 -0800, Carl Banks wrote: > > (...For that matter, if the rule had been, "Never augment your words > spelling with an apostrophe", it would have really simplified > things) Th next dae, wee aul wil bee speling liek this -- http://mail.python.org/mailman/listinfo/

Re: [OT] stable algorithm with complexity O(n)

2008-12-14 Thread Lie Ryan
On Mon, 15 Dec 2008 01:48:43 +, Steven D'Aprano wrote: > Some things really don't have a solution, no matter how much power of > positive thinking you apply to it. Some may, only not with the current understanding of the universe. Well, I agree that there are a few things that is straight ou

Re: Removing None objects from a sequence

2008-12-14 Thread Lie Ryan
On Mon, 15 Dec 2008 03:21:21 +, Steven D'Aprano wrote: > On Mon, 15 Dec 2008 02:11:10 +0000, Lie Ryan wrote: > >>> So given the normal precedence rules of Python, there is no ambiguity. >>> True, you have to learn the rules, but that's no hardship. >>

Re: Removing None objects from a sequence

2008-12-14 Thread Lie Ryan
On Fri, 12 Dec 2008 22:55:20 +, Steven D'Aprano wrote: > On Fri, 12 Dec 2008 21:18:36 +0000, Lie Ryan wrote: >> Personally, I'd prefer VB's version: >> foo IsNot bar >> >> or in pseudo-python >> foo isnot bar >> >> since tha

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Lie Ryan
On Sun, 14 Dec 2008 09:51:03 -0800, Paul Moore wrote: > On 14 Dec, 16:22, Bruno Desthuilliers > wrote: >> if you only want the first returned value, you can just apply a slice: >> >> def f(): >>     return 1,2,3 >> >> a = f()[0] + 1 > > Hmm, true. I'm not sure it's any less ugly, though :-) >

Re: [OT] stable algorithm with complexity O(n)

2008-12-14 Thread Lie Ryan
On Sat, 13 Dec 2008 19:17:41 +, Duncan Booth wrote: > "Diez B. Roggisch" wrote: > >> David Hláčik schrieb: >>> Hi guys, >>> >>> i am really sorry for making offtopic, hope you will not kill me, but >>> this is for me life important problem which needs to be solved within >>> next 12 hours

Re: Python 3.0 crashes displaying Unicode at interactive prompt

2008-12-13 Thread Lie Ryan
On Sat, 13 Dec 2008 14:09:04 -0800, John Machin wrote: > On Dec 14, 8:07 am, "Chris Rebert" wrote: >> On Sat, Dec 13, 2008 at 12:28 PM, John Machin >> wrote: >> >> > Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit >> > (Intel)] on win32 >> > Type "help", "copyright", "credits

Re: Interface & Implementation

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 16:07:26 +0530, J Ramesh Kumar wrote: > Hi, > > I am new to python. I require some help on implementing interface and > its implementation. I could not find any sample code in the web. Can you > please send me some sample code which is similar to the below java code > ? Thanks

Re: Removing None objects from a sequence

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 11:50:38 -0500, Steve Holden wrote: > Kirk Strauser wrote: >> At 2008-12-12T15:51:15Z, Marco Mariani writes: >> >>> Filip Gruszczyński wrote: >>> I am not doing it, because I need it. I can as well use "if not elem is None", >> >>> I suggest "if elem is not None",

Re: Testing against different versions of Python

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 14:42:24 -0500, mercado wrote: > What is the best way to go about testing against different versions of > Python? For example, I have 2.5.2 installed on my machine (Ubuntu Hardy > 8.04), and I want to test a script against 2.5.2 and 2.5.1 (and possibly > other versions as well

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 09:50:43 -0800, Dennis Lee Bieber wrote: > On Fri, 12 Dec 2008 03:42:55 -0800 (PST), feb...@gmail.com declaimed the > following in comp.lang.python: > >> #!/usr/bin/python >> #Py3k, UTF-8 >> >> bank = int(input("How much money is in your account?\n>>")) target = >> int(input(

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 04:58:36 -0800, feba wrote: > Actually, I have gedit set to four spaces per tab. I have no reason why > it's showing up that large on copy/paste, but the file itself is fine. You've set gedit to _show tabs_ as four spaces, but not to substitute tabs with four spaces. Go to g

Re: Is 3.0 worth breaking backward compatibility?

2008-12-10 Thread Lie Ryan
On Tue, 09 Dec 2008 17:25:59 -0500, Benjamin Kaplan wrote: > On Tue, Dec 9, 2008 at 3:56 PM, Lie Ryan <[EMAIL PROTECTED]> wrote: > >> On Sun, 07 Dec 2008 21:48:46 +, Tim Rowe wrote: >> >> > >> > But that's what a major release number does for

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Lie Ryan
On Tue, 09 Dec 2008 16:10:08 -0500, Albert Hopkins wrote: > On Tue, 2008-12-09 at 20:56 +0000, Lie Ryan wrote: >> Actually I noticed a tendency from open-source projects to have slow >> increment of version number, while proprietary projects usually have >> big >> vers

Re: Guido's new method definition idea

2008-12-09 Thread Lie Ryan
On Mon, 08 Dec 2008 20:55:16 +, Arnaud Delobelle wrote: > [EMAIL PROTECTED] writes: > >> class C: >> def createfunc(self): >> def self.func(arg): >> return arg + 1 >> >> Or, after the class definition is done, to extend it dynamically: >> >> def C.method(self, arg): >>

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Lie Ryan
On Sun, 07 Dec 2008 21:48:46 +, Tim Rowe wrote: > 2008/12/7 walterbyrd <[EMAIL PROTECTED]>: >> IMO: breaking backward compatibility is a big deal, and should only be >> done when it is seriously needed. >> >> Also, IMO, most of, if not all, of the changes being made in 3.0 are >> debatable, at

Re: infering the number of args a function takes at runtime

2008-12-08 Thread Lie Ryan
On Mon, 08 Dec 2008 02:40:03 -0800, sniffer wrote: > On Dec 8, 9:39 am, sniffer <[EMAIL PROTECTED]> wrote: >> hi all, >> i am a python newbie, in a project currently doing i need to find out >> the number of arguments that a function takes at runtime.? Is this >> possible ,if so how do i do this,i

Re: Guido's new method definition idea

2008-12-08 Thread Lie Ryan
On Sun, 07 Dec 2008 18:27:21 +0100, Andreas Waldenburger wrote: > On Sat, 6 Dec 2008 23:21:04 -0800 (PST) Lie <[EMAIL PROTECTED]> wrote: > >> I think we have to test this on newbies. [snip] >> > Now that's talking like a programmer! > > Ideas on how such a survey could be conducted? Anyone? >

Re: Guido's new method definition idea

2008-12-07 Thread Lie Ryan
On Sun, 07 Dec 2008 12:57:27 +0100, News123 wrote: > Lie wrote: >> On Dec 7, 1:02 am, News123 <[EMAIL PROTECTED]> wrote: >>> What would be interesting would be some syntactical sugar to get rid >>> of the 'self' (at least in the code body). >>> >>> example: >>> class C: >>> class_elements a,b,

Re: Guido's new method definition idea

2008-12-07 Thread Lie Ryan
On Sun, 07 Dec 2008 20:56:40 +, I V wrote: > So, if we want Python to the programming language of choice for Lacanian > psychoanalysts, perhaps we should adopt the symbol "$" (or even, with > Python 3's support for unicode identifiers, S followed by U+0388) > instead of "self." Is that suppos

Re: tabs and spaces in py3k

2008-12-07 Thread Lie Ryan
On Sun, 07 Dec 2008 20:51:50 -0800, rurpy wrote: > Do the Py3k docs need correction? If I were the maintainer of the parser, I'd add something like this: tab_width = random.randint(0, 1000) -- http://mail.python.org/mailman/listinfo/python-list

Re: Brain going crazy with recursive functions

2008-12-07 Thread Lie Ryan
On Sat, 06 Dec 2008 23:33:35 -0800, 5lvqbwl02 wrote: > I'm trying to solve the 9-tile puzzle using as functional an approach as > possible. I've recently finished reading SICP and am deliberately > avoiding easy python-isms for the more convoluted scheme/functional > methods. The following funct

Re: end of print = lower productivity ?

2008-12-01 Thread Lie Ryan
On Mon, 2008-12-01 at 09:46 -0600, Tim Chase wrote: > > For a proof, let's see what Google has to say about this: > > "Windows text editor". Vim is on page 3, near the turning > > point where nobody is talking about text-editor anymore and > > more about text-editor reviews. Even worse is Emacs, on

Re: end of print = lower productivity ?

2008-11-30 Thread Lie Ryan
On Sat, 2008-11-29 at 17:51 -0600, Tim Chase wrote: > >> It's not so much "ridiculous" as a failure of your editor to > >> assist you. In Vim (my editor-of-choice), I'd do something > >> like > > > > seriously, I don't think anyone in Windows uses vim > > Are you just guessing, or do you have an

Re: Custom keyboard shortcuts

2008-11-09 Thread Lie Ryan
On Sun, 09 Nov 2008 06:15:02 -0800, aud2008 wrote: > Nov 9 2008,9.14PM<[EMAIL PROTECTED]> to be or not to be... what is the question. -- http://mail.python.org/mailman/listinfo/python-list

Re: Are .pyc files portable?

2008-11-09 Thread Lie Ryan
On Fri, 07 Nov 2008 18:36:41 -0800, Roy Smith wrote: > I'm using Python as part of a test fixture for a large (mostly C++) > software project. We build on a lot of different platforms, but Solaris > is a special case -- we build on Solaris 8, and then run our test suite > on Solaris 8, 9, and 10.

Re: Ordering python sets

2008-11-04 Thread Lie Ryan
On Sun, 02 Nov 2008 02:08:37 +, Steven D'Aprano wrote: > On Sat, 01 Nov 2008 18:58:59 +, Tim Rowe wrote: > >> 2008/10/27 <[EMAIL PROTECTED]>: >>> Lie Ryan: >>> >>>>Oh no, the two dict implementation would work _exactly_

Re: Windows DOS box redirection

2008-11-03 Thread Lie Ryan
On Fri, 31 Oct 2008 18:35:25 +0100, Stef Mientki wrote: > Bill McClain wrote: >> On 2008-10-31, Tim Golden <[EMAIL PROTECTED]> wrote: >> >>> You've got a few options. >>> >>> >> Ok, thanks! >> >> It is a small hobbyist community. I'll just document it and tell them >> "life is hard fo

Re: Function Memory Usage

2008-11-01 Thread Lie Ryan
On Fri, 31 Oct 2008 18:41:58 +, Paulo J. Matos wrote: > Hi all, > > What's the best way to know the amount of memory allocated by a function > and the time it took to run? While the latter is simple to implement > using a wrapper function, the former is striking me as something that > needs t

Re: Ordering python sets

2008-11-01 Thread Lie Ryan
On Mon, 27 Oct 2008 13:18:43 -0700, bearophileHUGS wrote: > So I don't accept so much different data structures to have the > same name You need to adjust the current mindset slightly (but in an important way to understand the "why" behind this idea). The current notion is: list and dict is a

Re: Exact match with regular expression

2008-10-26 Thread Lie Ryan
On Sun, 26 Oct 2008 17:51:29 +0100, Mr.SpOOn wrote: > Hi, > I'd like to use regular expressions to parse a string and accept only > valid strings. What I mean is the possibility to check if the whole > string matches the regex. > > So if I have: > p = re.compile('a*b*') > > I can match thi

Re: Ordering python sets

2008-10-26 Thread Lie Ryan
On Sat, 25 Oct 2008 21:50:36 -0400, Terry Reedy wrote: > Lie Ryan wrote: >> On Sat, 25 Oct 2008 18:20:46 -0400, Terry Reedy wrote: > Then why do you object to current > mylist = linkedlist(data) > and request the harder to write and implement > mylist = list

Re: Ordering python sets

2008-10-26 Thread Lie Ryan
On Sun, 26 Oct 2008 00:53:18 +, Steven D'Aprano wrote: [...] > And how do you find an arbitrary object's creation point without > searching the project's source code? How is it better using the current way? Asking the .implementation field isn't much harder than asking the type (), and is much

Re: How can I handle the char immediately after its input, without waiting an endline?

2008-10-26 Thread Lie Ryan
On Sun, 26 Oct 2008 09:23:41 +, Duncan Booth wrote: > Lie Ryan <[EMAIL PROTECTED]> wrote: > >> And as far as I know, it is impossible to implement a "press any key" >> feature with python in a simple way (as it should be). > > "press any key

Re: Why can't I assign a class method to a variable?

2008-10-26 Thread Lie Ryan
On Wed, 22 Oct 2008 12:34:26 -0400, ed wrote: > I'm trying to make a shortcut by doing this: > > t = Globals.ThisClass.ThisMethod > > Calling t results in an unbound method error. > > Is it possible to do what I want? I call this method in hundreds of > locations and I'm trying to cut down on

Re: Ordering python sets

2008-10-25 Thread Lie Ryan
On Sat, 25 Oct 2008 18:20:46 -0400, Terry Reedy wrote: > Lie Ryan wrote: > > >> >> Since python is dynamic language, I think it should be possible to do >> something like this: >> >> a = list([1, 2, 3, 4, 5], implementation = 'linkedlist') &g

Re: Ordering python sets

2008-10-25 Thread Lie Ryan
On Sat, 25 Oct 2008 18:20:46 -0400, Terry Reedy wrote: > Lie Ryan wrote: > > >> >> Since python is dynamic language, I think it should be possible to do >> something like this: >> >> a = list([1, 2, 3, 4, 5], implementation = 'linkedlist') &g

Re: Consequences of importing the same module multiple times in C++?

2008-10-25 Thread Lie Ryan
On Fri, 24 Oct 2008 12:23:18 -0700, Robert Dailey wrote: > Hi, > > I'm currently using boost::python::import() to import Python modules, so > I'm not sure exactly which Python API function it is calling to import > these files. I posted to the Boost.Python mailing list with this > question and th

Re: PIL: Getting a two color difference between images

2008-10-25 Thread Lie Ryan
> Kevin D. Smith: >> What I want is a two color output image: black where the image wasn't >> different, and white where it was different.< Use the ImageChops.difference, which would give a difference image. Then map all colors to white except black using Image.point() -- http://mail.python.org

Re: How can I handle the char immediately after its input, without waiting an endline?

2008-10-25 Thread Lie Ryan
On Sat, 25 Oct 2008 15:27:32 +, Steven D'Aprano wrote: > On Sat, 25 Oct 2008 16:30:55 +0200, Roel Schroeven wrote: > >> Steven D'Aprano schreef: >>> I can't think of any modern apps that use one character commands like >>> that. One character plus a modifier (ctrl or alt generally) perhaps, >

Re: Ordering python sets

2008-10-25 Thread Lie Ryan
On Sat, 25 Oct 2008 09:21:05 +, Steven D'Aprano wrote: > On Sat, 25 Oct 2008 08:58:18 +0000, Lie Ryan wrote: > >> >> Since python is dynamic language, I think it should be possible to do >> something like this: >> >> a = list([1, 2, 3, 4, 5], im

Re: Improving interpreter startup speed

2008-10-25 Thread Lie Ryan
On Sat, 25 Oct 2008 12:32:07 -0700, Pedro Borges wrote: > Hi guys, > > > Is there a way to improve the interpreter startup speed? > > In my machine (cold startup) python takes 0.330 ms and ruby takes 0.047 > ms, after cold boot python takes 0.019 ms and ruby 0.005 ms to start. > > > TIA um.

Re: How can I handle the char immediately after its input, without waiting an endline?

2008-10-25 Thread Lie Ryan
On Sat, 25 Oct 2008 09:04:01 +, Steven D'Aprano wrote: > On Sat, 25 Oct 2008 08:36:32 +0000, Lie Ryan wrote: > >>>>> I want to write something that handle every char immediately after >>>>> its input. Then tehe user don't need to ty

Re: set/dict comp in Py2.6

2008-10-25 Thread Lie Ryan
On Sat, 25 Oct 2008 09:07:35 +, Steven D'Aprano wrote: > On Sat, 25 Oct 2008 01:13:08 -0700, bearophileHUGS wrote: > >> I'd like to know why Python 2.6 doesn't have the syntax to create sets/ >> dicts of Python 3.0, like: >> >> {x*x for x in xrange(10)} >> {x:x*x for x in xrange(10)} > > Ma

Re: Ordering python sets

2008-10-25 Thread Lie Ryan
On Wed, 22 Oct 2008 10:43:35 -0700, bearophileHUGS wrote: > Mr.SpOOn: >> Is there another convenient structure or shall I use lists and define >> the operations I need? > > > As Python becomes accepted for more and more "serious" projects some > more data structures can eventually be added to th

Re: How can I handle the char immediately after its input, without waiting an endline?

2008-10-25 Thread Lie Ryan
>>> I want to write something that handle every char immediately after its >>> input. Then tehe user don't need to type [RETURN] each time. How can I >>> do this? >>> >>> Thanks in advance. Don't you think that getting a one-character from console is something that many people do very often? Do y

Re: from package import * without overwriting similarly named functions?

2008-10-25 Thread Lie Ryan
On Fri, 24 Oct 2008 11:06:54 -0700, Reckoner wrote: > I have multiple packages that have many of the same function names. Is > it possible to do > > from package1 import * > from package2 import * > > without overwriting similarly named objects from package1 with material > in package2? How abou

Re: Urllib vs. FireFox

2008-10-25 Thread Lie Ryan
On Fri, 24 Oct 2008 20:38:37 +0200, Gilles Ganault wrote: > Hello > > After scratching my head as to why I failed finding data from a web > using the "re" module, I discovered that a web page as downloaded by > urllib doesn't match what is displayed when viewing the source page in > FireFox. >

Re: PIL: Getting a two color difference between images

2008-10-25 Thread Lie Ryan
On Fri, 24 Oct 2008 14:51:07 -0500, Kevin D. Smith wrote: > I'm trying to get the difference of two images using PIL. The > ImageChops.difference function does almost what I want, but it takes the > absolute value of the pixel difference. What I want is a two color > output image: black where th

Re: IRC

2008-10-22 Thread Lie Ryan
On Tue, 21 Oct 2008 05:59:43 -0700, Amie wrote: > HI All, > > Please can you perhaps provide me with links or good places where I can > learn what IRC is, how to work with it and how to write to a large log > file at the same time as letting the IRC spy read and write to the > server. > > Thank

Re: what's the python for this C statement?

2008-10-20 Thread Lie Ryan
On Mon, 20 Oct 2008 12:34:11 +0200, Hrvoje Niksic wrote: > Michele <[EMAIL PROTECTED]> writes: > >> Hi there, >> I'm relative new to Python and I discovered that there's one single way >> to cycle over an integer variable with for: for i in range(0,10,1) > > Please use xrange for this purpose, e

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread Lie Ryan
On Sun, 19 Oct 2008 22:32:20 -0700, est wrote: > On Oct 20, 10:48 am, Liang Chen <[EMAIL PROTECTED]> wrote: >> Hope you all had a nice weekend. >> >> I have a question that I hope someone can help me out. I want to run a >> Python program that uses Tkinter for the user interface (GUI). The >> prog

Re: Idenfity numbers in variables

2008-10-20 Thread Lie Ryan
On Mon, 20 Oct 2008 13:16:48 +0200, Alfons Nonell-Canals wrote: > Hello, > I have a trouble and I don't know how to solve it. I am working with > molecules and each molecule has a number of atoms. I obtain each atom > spliting the molecule. > > Ok. It is fine and I have no problem with it. > > T

Re: indentation

2008-10-20 Thread Lie Ryan
On Sun, 19 Oct 2008 07:16:44 -0700, Gandalf wrote: > every time I switch editor all the script indentation get mixed up, and > python start giving me indentation weird errors. indentation also hard > to follow because it invisible unlike brackets { } > > is there any solution to this problems?

Re: Overloading operators

2008-10-16 Thread Lie Ryan
On Wed, 15 Oct 2008 14:34:14 +0200, Mr.SpOOn wrote: > Hi, > in a project I'm overloading a lot of comparison and arithmetic > operators to make them working with more complex classes that I defined. > > > What is the best way to do this? Shall I use a lot of "if...elif" > statements inside the ov

Re: Pr. Euler 18, recursion problem

2008-10-09 Thread Lie Ryan
On Mon, 06 Oct 2008 00:14:37 -0700, process wrote: > On Oct 6, 8:13 am, Aidan <[EMAIL PROTECTED]> wrote: >> process wrote: >> > I am trying to solve project euler problem 18 with brute force(I will >> > move on to a better solution after I have done that for problem 67). >> >http://projecteuler.ne

Re: Safe eval of insecure strings containing Python data structures?

2008-10-09 Thread Lie Ryan
On Thu, 09 Oct 2008 13:26:17 +0100, Orestis Markou wrote: > The ast module in 2.6 has something... > in python 2.6, ast.literal_eval may be used to replace eval() for literals. It does not accepts statements and function calls, i.e.: >>> a = set([1, 2, 3]) >>> repr(a) set([1, 2, 3]) >>> ast.li

Re: Efficient Bit addressing in Python.

2008-10-09 Thread Lie Ryan
On Fri, 10 Oct 2008 00:30:18 +0200, Hendrik van Rooyen wrote: > Is there a canonical way to address the bits in a structure like an > array or string or struct? > > Or alternatively, is there a good way to combine eight ints that > represent bits into one of the bytes in some array or string or >

Re: why? __builtins__ key added from eval

2008-10-02 Thread Lie Ryan
On Tue, 30 Sep 2008 16:04:34 -0500, William Purcell wrote: > I want to use eval to evaluate wx.TextCtrl inputs. How can I keep python > from adding the __builtins__ key to mydict when I use it with eval? > Other wise I have to __delitem__('__builtins__') everytime I use eval? > mydict = {'a'

Re: windows help files ?

2008-10-02 Thread Lie Ryan
On Thu, 02 Oct 2008 17:13:50 +0200, Stef Mientki wrote: > Hello, > > I've 2 questions about python help files: Python help files or your program's help files? > 1. how can I launch the windows help file (CHM), from python with a > keyword as argument ? I'm not really sure, but isn't CHM obsol

Re: code critique requested - just 60 lines

2008-10-02 Thread Lie Ryan
On Thu, 02 Oct 2008 07:51:30 -0700, Terrence Brannon wrote: > Hi, I would like some feedback on how you would improve the following > program: > http://www.bitbucket.org/metaperl/ptc_math/src/21979c65074f/payout.py > > Basically, using non-strict dictionary keys can lead to bugs, so that > worrie

Re: string concatenate

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 09:41:57 -0700, sandric ionut wrote: > Hi: > > I have the following situation: >     nameAll = [] Here you defined nameAll as a list >     for i in range(1,10,1): That range is superfluous, you could write this instead[1]: for i in range(10): >     n = "name" + str([i])

Re: How to emit UTF-8 from console mode?

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 08:17:15 -0700, Siegfried Heintze wrote: (snip) > The code was a little confusing because those two apostrophes look like > a double quote! Tips: use mono-spaced font. There is no ambiguity. (snip) > I think part of the problem is that Lucida Console is not as capable as

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 18:09:20 +0200, Bruno Desthuilliers wrote: > Phillip B Oldham a écrit : >> On Oct 1, 4:12 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: >>> Please explain what you want to do. >> >> I'm primarily looking for alternatives to MVC frameworks for web >> development, particularly

Re: parse a normal textfile

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 14:09:09 +0200, Tino Wildenhain wrote: > devi thapa wrote: >> hi all >> >>I have one normal text file. I need to parse the file, that >> too in an associative way . >> suppose that below is the normal textfile >> >> name='adf' >> id =1 >> value=344 >> >> > the

Re: Isolated environment for execfile

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 11:11:29 +, Igor Kaplan wrote: > Hello python gurus. > > I got quite unusual problem and all my searches to find the answer on > my > own were not successful. > Here is the scenario: > I have the python program, let's call it script1.py, this program > needs to >

Re: Peek inside iterator (is there a PEP about this?)

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 10:46:33 -0400, Luis Zarrabeitia wrote: > Hi there. > > For most use cases I think about, the iterator protocol is more than > enough. However, on a few cases, I've needed some ugly hacks. > > Ex 1: > > a = iter([1,2,3,4,5]) # assume you got the iterator from a function and

Re: text file

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 07:19:44 -0700, yqyq22 wrote: > My problem is how to translate this vbs in python: > > Dim fso > Dim strComputer > Set fso = CreateObject("Scripting.FileSystemObject") Set ElencoPC = > fso.OpenTextFile("elencoPC.txt" , 1, False) Do Until > ElencoPC.AtEndOfStream > strComputer =

Re: indirectly addressing vars in Python

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 10:53:08 -0400, Ross wrote: > Forgive my newbieness - I want to refer to some variables and indirectly > alter them. Not sure if this is as easy in Python as it is in C. > > Say I have three vars: oats, corn, barley > > I add them to a list: myList[{oats}, {peas}, {barley}

Re: ssh keepalive

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 10:47:28 +, Marc 'BlackJack' Rintsch wrote: > On Wed, 01 Oct 2008 08:07:43 +0000, Lie Ryan wrote: > >>>>> a = [1, 3, 4, 2] >>>>> a = a.sort() >>>>> print a >> [None, None, None, None] > > *That* wou

Re: Tix: Windows XP: Problem - how to stop root window from popping up with Tix

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 11:33:59 +0100, dudeja.rajat wrote: > Hi, > > Im using Tix on widows XP and I've tried many ways to suppress the root > window. But so far I'm unable to do it. > > > Please suggest how can I suppress the root window. > > My code is as follows: > > import Tix > myRoot = Tix

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 01:01:41 -0700, Phillip B Oldham wrote: > Are there any python event driven frameworks other than twisted? Most GUI package use event-driven model (e.g. Tkinter). -- http://mail.python.org/mailman/listinfo/python-list

Re: ssh keepalive

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 00:30:59 -0700, loial wrote: > I have a problem with a ssh connection in python > > I get the error > > 'NoneType' object has no attribute 'exec_command' > > I am thinking that maybe the ssh connection is timeing out. > > Since I have no control over the configuration of th

Re: Output of pexpect

2008-10-01 Thread Lie Ryan
On Tue, 30 Sep 2008 20:48:12 -0700, Anh Khuong wrote: > I am using pexpect and I want to send output of pexpet to both stdout > and log file concurrently. Anybody know a solution for it please let me > know. One way is to create a file-like object that forked the output to stdout and the logfil

Re: [Tutor] Replacing cmd.exe with custom .py application

2008-09-30 Thread Lie Ryan
On Tue, 30 Sep 2008 15:09:06 -0400, Ezra Taylor wrote: > Is there something similar to /dev/null on Windows? I think it's called nul REM This is a batch file (.bat) echo "This won't show" > NUL I'm not sure how to use it in python though. -- http://mail.python.org/mailman/listinfo/python-list

Re: r""

2008-09-30 Thread Lie Ryan
On Tue, 30 Sep 2008 10:50:01 -0700, Kyle Hayes wrote: >> Please describe the actual problem you're trying to solve. In what way >> do slashes need to be "fixed," and why? > > Well, I have decided to build a tool to help us sync files in UNC paths. > I am just building the modules and classes righ

Re: What is not objects in Python?

2008-09-30 Thread Lie Ryan
On Mon, 2008-09-29 at 21:03 -0700, namekuseijin wrote: > On 28 set, 15:29, process <[EMAIL PROTECTED]> wrote: > > I have heard some criticism about Python, that it is not fully object- > > oriented. > > So what? > > > Why isn't len implemented as a str.len and list.len method instead of > > a len

Re: Insert character at a fixed position of lines

2008-07-26 Thread Lie Ryan
On Sat, 2008-07-26 at 17:47 +0200, Francesco Pietra wrote: > Sorry to come again for the same problem. On commanding: > > $ python script.py 2>&1 | tee fileout.pdb > > nothing occurred (fileout.pdb was zero byte). The script reads: > > f = open("xxx.pdb", "w") > f.write('line = line[:22] + "A" +

Re: Change PC to Win or Windows

2008-07-22 Thread Lie Ryan
On Mon, 2008-07-21 at 18:50 -0400, Derek Martin wrote: > On Mon, Jul 21, 2008 at 02:47:31PM -0700, Lie wrote: > > Common usage isn't always correct. > > Actually it is, inherently... When usage becomes common, the language > becomes redefined, and its correctness is therefore true by identity >

<    3   4   5   6   7   8