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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: symbolic links, aliases, cls clear

2006-03-29 Thread SM Ryan
rl); if (ec) { if (ec<0) ec = ENOENT; errno = ec; free(s); s = 0; } return s; } #else static char *readalias(char *original) { errno = EINVAL; return 0; } #endif -- SM Ryan http://www.rawbw.com/~wyrmwif/ But I do believe in this. -- http://mail.python.org/mailman/listinfo/python-list

RE: Registration Code

2006-04-04 Thread Ryan Ginstrom
g legitimate users. And of course, it would enable cross-platform (commercial) use of your application. A variation of this strategy is the subscription model. Regards, Ryan --- Ryan Ginstrom http://ginstrom.com -- http://mail.python.org/mailman/listinfo/python-list

Framework/module for generating HTML documentation

2006-04-04 Thread Ryan Ginstrom
from scratch, but if this has been tackled before (as I suspect it has), I'd like to stand on those developers' shoulders . Regards, Ryan --- Ryan Ginstrom -- http://mail.python.org/mailman/listinfo/python-list

RE: Using PythonWin32 to copy text to Windoze Clipboard for Unix-stylerandom .sig rotator?

2006-04-06 Thread Ryan Ginstrom
to type the text in directly. Another (much more ambitious) project would be to create a private clipboard, save the current clipboard contents there, and then swap them back in when you are done. Regards, Ryan --- Ryan Ginstrom -- http://mail.python.org/mailman/listinfo/python-list

Re: hex int and string

2009-11-27 Thread Lie Ryan
On 11/27/2009 8:28 PM, luca72 wrote: i'm using pyscard and for send a command he need a list like this: cmd = [0xdd,0xff, etc] the problem is that i get a text like dd and i need to trasform it in 0xdd for the list and if i use hex i have a sting that is not what i need >>> # Do you know th

Re: Feature request: String-inferred names

2009-11-28 Thread Lie Ryan
On 11/28/2009 3:08 PM, The Music Guy wrote: As for your code, I haven't seen it, so it would be hard for me to say exactly how the new syntax would come into play. What I can tell you, however, is that the parts of your code that would use it would probably be easier to read and change to anyone

Re: Some Basic questions on the use of CTRL and ALT Keys

2009-11-28 Thread Lie Ryan
On 11/28/2009 6:20 PM, joy99 wrote: I was writing a transliteration program from Bengali to English and vice versa. The program using Unicode chart is giving me perfect outputs in Bengali and vice versa with Bengali input -> English. I wanted to add some more power to the key board entry scheme,

Re: Feature request: String-inferred names

2009-11-28 Thread Lie Ryan
On 11/28/2009 10:38 PM, The Music Guy wrote: If you use it a lot, it is likely 1) you have abused class syntax for what should have been a dict or 2) what you need is to override __getattr__/__getattribute__ and __setattr__ Oh boy...here we go. :| ok, then what's your use case, AFAICT in the

Re: Python Programming Challenges for beginners?

2009-11-28 Thread Lie Ryan
On 11/28/2009 1:51 AM, n00m wrote: On Nov 27, 1:22 pm, Jon Clements wrote: Of course, if you take '~' literally (len(s)<= -10001) I reckon you've got way too many :) Jon. Then better: len(s)< abs(~1) PS It's a hard problem; so let's leave it alone I'm not going to write it, but I gue

Re: string payload expected: error

2009-11-29 Thread Lie Ryan
On 11/27/2009 8:43 PM, Ramdas wrote: I tried with MIMEBASE but it still fails.. I changed it to MIMEText, hoping that might trick __handletext to think its a string Anyway that also doesn't work. just pass the string directly to MIMEBase.set_payload: fp = open('...') msg1 = MIMEBase(maint

Re: mysqldb cursor returning type along with result ?

2009-11-29 Thread Lie Ryan
On 11/30/2009 12:14 AM, Paul O'Sullivan wrote: Just taken to Python (2.5)and started to look at some DB cursor stuff using MySQL. Anyway, after creating a query that in MySQL that has a result set of decimals I find that the cursor in python after a fetchall() returns a tuple that contains the f

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread Lie Ryan
On 11/30/2009 1:25 AM, Russell Warren wrote: Maybe it's just that * is strictly for arguments, and trying it for generic tuple unpacking is abuse (which is down the corridor in 12A). Because (1, 2, *x) == (1, 2, 3, 4) is not tuple unpacking [!] Tuple unpacking is related with assignment, e.

Re: Creating a local variable scope.

2009-11-29 Thread Lie Ryan
On 11/30/2009 8:12 AM, markolopa wrote: Hi, On 18 Sep, 10:36, "markol...@gmail.com" wrote: On Sep 11, 7:36 pm, Johan Grönqvist wrote: I find several places in my code where I would like tohavea variable scope that is smaller than the enclosing function/class/module definition. This is one

Re: Feature request: String-inferred names

2009-11-29 Thread Lie Ryan
On 11/29/2009 12:22 PM, The Music Guy wrote: When I first started seeing @ show up in Python code, I said "what the heck is that? It looks so weird and _ugly_.I would never try to mess with that." But I started seeing it more and more, so I asked #python what it was. They told me about decorators

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Lie Ryan
On 11/30/2009 12:38 PM, Esmail wrote: Thanks all!! I get it now :-) It helped to have a number of different explanations, thanks for taking the time to post. Much appreciated. I generally do not expect operator precedence to be reliable at all except for: + - (binary ops, not the unary) * /

Re: Variables with cross-module usage

2009-11-29 Thread Lie Ryan
On 11/30/2009 12:00 PM, Terry Reedy wrote: Dennis Lee Bieber wrote: In these languages, the names always refer to the same location. Python confuses matters by having names that don't really refer to location, but are attached to the objects. In everyday life and natural languages, names refe

Re: Object Not Callable, float?

2009-11-29 Thread Lie Ryan
On 11/30/2009 4:20 PM, W. eWatson wrote: John Bokma wrote: "W. eWatson" wrote: Yikes. Thanks very much. Python seems to act unlike other language in which words like float are reserved. I'll use asum. The problem is that there is a function sum and you creating a float sum: sum = 0.0 and

Re: Creating a local variable scope.

2009-11-30 Thread Lie Ryan
On 11/30/2009 8:13 PM, markolopa wrote: On Nov 30, 4:46 am, Dave Angel wrote: markolopa wrote: Antoher 15 minutes lost because of that Python "feature"... Is it only me??? Yep, I think so. Not very consoling but thanks anyway!...:- You're proposing a much more complex scoping rule,

Re: Go versus Brand X

2009-11-30 Thread Lie Ryan
J Kenneth King wrote: a...@pythoncraft.com (Aahz) writes: Comparing Go to another computer language -- do you recognize it? http://www.cowlark.com/2009-11-15-go/ If you skip to the conclusion, you'll be better off. The author has an interesting point. Go (the language) is not really ground

Re: Feature request: String-inferred names

2009-11-30 Thread Lie Ryan
On 12/1/2009 3:35 AM, Bruno Desthuilliers wrote: Lie Ryan a écrit : On 11/28/2009 3:08 PM, The Music Guy wrote: (snip the part about the proposed feature - which I don't like but that's not the point) My projects rely on a lot of metaclassing for the automatic generation of prop

Re: Questions about list-creation

2009-11-30 Thread Lie Ryan
On 12/1/2009 4:22 AM, Manuel Graune wrote: Hello, in (most) python documentation the syntax "list()" and "[]" is treated as being more or less the same thing. For example "help([])" and "help(list())" point to the same documentation. Since there are at least two cases where this similarity is n

Re: Can't print Chinese to HTTP

2009-11-30 Thread Lie Ryan
On 12/1/2009 4:05 AM, Gnarlodious wrote: Thanks for the help, but it doesn't work. All I get is an error like: UnicodeEncodeError: 'ascii' codec can't encode character '\\u0107' in position 0: ordinal not in range(128) The error says it all; you're trying to encode the chinese character using

Re: how to format a python source file with tools?

2009-11-30 Thread Lie Ryan
On 12/1/2009 4:30 AM, Falcolas wrote: Nonetheless, it would be better to implement coding standards that everyone can stick to. Agreed. You can't solve social issues with program. -- http://mail.python.org/mailman/listinfo/python-list

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread Lie Ryan
On 12/1/2009 5:58 AM, inhahe wrote: i wasn't suggesting it as a feature for python, just pointing out why it might seem counterintuitive. I'm interested, what do YOU (inhahe) think the result should be? Should both become -9 or both become 9. What was your expectation when you wrote that post

Re: Completely OT

2009-11-30 Thread Lie Ryan
On 12/1/2009 5:00 AM, inhahe wrote: On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi wrote: If I'm not mistaken, that won't help me actually print to screen the user's choices as he selects them, which in my application, is important. Please

Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread Lie Ryan
On 12/1/2009 5:04 AM, Esmail wrote: im = Image.open('c://mypic.jpg') sorry, slip of the finger, there's only one forward slash or you can use two backward slashes. The problem isn't with opening it (I know it opens fine since I can get its size attribute via im.size) - the show() is the pr

Re: Variables with cross-module usage

2009-11-30 Thread Lie Ryan
On 12/1/2009 7:51 AM, Terry Reedy wrote: In everyday life and natural languages, a single name can be used to refer to multiple objects just by context without referring any namespace. Namespace are contexts. They were (re)invented in programming just to make it easier to have single name could

Re: python and vc numbers

2009-12-01 Thread Lie Ryan
On 11/30/2009 10:05 PM, Daniel Dalton wrote: On Mon, Nov 30, 2009 at 02:26:14AM -0800, Chris Rebert wrote: Also, in my quickie newbie experimentation with `screen`, each screen "window" seems to get a unique tty#. Admittedly I am running OS X Can you make do with the tempfile module? Or you'd

Re: Python-list Digest, Vol 75, Issue 6

2009-12-01 Thread Lie Ryan
On 12/1/2009 11:27 PM, Nadav Chernin wrote: Nadav Chernin wrote: > When I use getargspec(func) for user-defined function, all is working > OK, but using it for built-in functions raise TypeError: That's just fine and to be expected. It's not possible to inspect

Re: Can't print Chinese to HTTP

2009-12-01 Thread Lie Ryan
On 12/2/2009 12:27 AM, Gnarlodious wrote: On Nov 30, 5:53 am, "Martin v. Löwis" wrote: #!/usr/bin/python print("Content-type:text/plain;charset=utf-8\n\n") sys.stdout.buffer.write('晉\n'.encode("utf-8")) Does this work for anyone? Because all I get is a blank page. Nothing. If I can establish

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-01 Thread Lie Ryan
On 12/2/2009 1:03 AM, Mark Summerfield wrote: I've produced a 4 page document that provides a very concise summary of Python 2<->3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start writing Python 3 programs and want to us

Re: Tracing variable scope (local vs. global)

2009-12-01 Thread Lie Ryan
On 12/2/2009 9:02 AM, Manuel Graune wrote: Hello, consider the following piece of code: a=1 b=2 def foo(c): b=3 return a + b + c In this case, when calling "foo", "a" will take the global value, "b" will take the local value and "c" will take the value assigned when calling the fun

Re: Noob thread lock question

2009-12-03 Thread Lie Ryan
On 12/3/2009 6:33 AM, Astley Le Jasper wrote: I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? Just the ones the comes to th

Re: Creating a local variable scope.

2009-12-03 Thread Lie Ryan
On 12/2/2009 2:56 PM, Ben Finney wrote: The ‘camelCase’ form is not conformant with PEP 8 at all (which makes me glad, since it's hideous). For some reason, every time I look at a unittest code, I was thinking of Java... and not just because it's modeled after JUnitTest. -- http://mail.python

Re: How to set object parameters nicely?

2009-12-03 Thread Lie Ryan
On 12/2/2009 10:26 AM, allen.fowler wrote: I've tried this, but have found two issues: 1) I can't set default values. 2) I can't set required values. In both of the above cases, if the object is created without the "exact" dict() I expect, all the assumption my methods make about what is availa

Re: Organization of GUIs

2009-12-03 Thread Lie Ryan
On 12/4/2009 12:44 AM, Michael Mossey wrote: I have a question about typical organization of GUIs. I will be using PyQt. Model-View-Controller (MVC) pattern. Model - all the business logic lives in the model. View - your GUI Controller - Takes input Controller notifies Model if there is user

Re: Noob thread lock question

2009-12-03 Thread Lie Ryan
On 12/4/2009 1:20 AM, Astley Le Jasper wrote: When you say don't forget about the GIL, what should I not be forgetting? I'm using sqlite and the following: I mean don't forget that when the GIL is locked, all threads (except the current one, and threads waiting on I/O) will not be able to run.

Re: Declaring a class level nested class?

2009-12-03 Thread Lie Ryan
On 12/3/2009 3:55 PM, cmckenzie wrote: I can't figure out what the correct way to construct the "nested" class so it can belong to "module". which one you want? 1. The Outside's class contains a nested class class Outside(object): class Inside(object): ... 2. The Outside's class

Re: Help in wxpython

2009-12-03 Thread Lie Ryan
On 12/3/2009 6:55 PM, r0g wrote: Krishnakant wrote: Madhura, Sorry to be a bit off-topic, but, I would really recommend you to use pygtk instead of wx. For one thing, the developers at pygtk are very active (they have their mailing list as well ) and it comes by default with python on almost all

Re: Declaring a class level nested class?

2009-12-03 Thread Lie Ryan
On 12/4/2009 1:59 AM, cmckenzie wrote: Sigh, I'm using Google Groups and it seems I can't see my original post and everyone's replies. I'm really keen to reply back, so I'll just re-post my follow up for now and make sure I don't make a habit of this. (I'll get a news reader) Here goes: I agree,

Re: Socket question

2009-12-03 Thread Lie Ryan
On 12/4/2009 1:52 AM, perlsyntax wrote: Is there away in python i can connect to a server in socket to two servers at the same time or can't it be done? use threading or non-blocking read. -- http://mail.python.org/mailman/listinfo/python-list

Re: More elegant solution for diffing two sequences

2009-12-03 Thread Lie Ryan
On 12/4/2009 8:28 AM, Ulrich Eckhardt wrote: I'm trying to write some code to diff two fonts. What I have is every character (glyph) of the two fonts in a list. I know that the list is sorted by the codepoints of the characters. What I'd like to ask is whether there is a more elegant solution to

Re: Organization of GUIs

2009-12-03 Thread Lie Ryan
On 12/4/2009 10:40 AM, Michael Torrie wrote: Lie Ryan wrote: On 12/4/2009 12:44 AM, Michael Mossey wrote: I have a question about typical organization of GUIs. I will be using PyQt. Model-View-Controller (MVC) pattern. Model - all the business logic lives in the model. View - your GUI

Re: Which is more pythonic?

2009-12-03 Thread Lie Ryan
On 12/4/2009 11:44 AM, Rhodri James wrote: map(self.__choices, choicesBox.addItem) or [choicesBox.addItem(choice) for choice in self.__choices] Aside from being pythonic or non-pythonic, using map or list comprehension with a method with side-effect is not the intention of functional progra

Re: memory error

2009-12-03 Thread Lie Ryan
On 12/4/2009 12:51 AM, Ahmed, Shakir wrote: I am getting a memory error while executing a script. Any idea is highly appreciated. Error message: " The instruction at "0x1b009032" referenced memory at "0x0804:, The memory could not be "written" This error is appearing and I have to exit from

Re: can python do this?

2009-12-03 Thread Lie Ryan
On 12/3/2009 4:55 AM, Anssi Saari wrote: Rounak writes: I am a complete newbie. I want to know if the following can be done using python or should I learn some other language: (Basically, these are applescripts that I wrote while I used Mac OS) 1.Web Page Image to Wallpaper: A script that take

Re: More elegant solution for diffing two sequences

2009-12-04 Thread Lie Ryan
On 12/5/2009 4:20 AM, Ulrich Eckhardt wrote: Thinking about it, I perhaps should store the glyphs in a set from the beginning. Question is, can I (perhaps by providing the right hash function) sort them by their codepoint? I'll have to look at the docs... Python does not guarantee that a partic

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-04 Thread Lie Ryan
On 12/5/2009 4:56 AM, Rami Chowdhury wrote: I don't think it was a problem of comprehension, more one of appropriate terminology -- AFAIK in Python, they're called functions, so calling them 'routines' is likely to confuse anyone in a discussion of Python features. Human language is not context

Re: Formatting logically nested actions -- Pythonic way?

2009-12-04 Thread Lie Ryan
On 12/4/2009 5:24 PM, Alf P. Steinbach wrote: Hi. I discovered with tkinter the registration of widgets with layout managers (tkinter "geometry" managers, e.g. calls to pack()) needs to be done very hierarchically. And this leads to hierarchical code, which would be nice to indicate by indentin

Re: python bijection

2009-12-04 Thread Lie Ryan
On 12/5/2009 6:53 AM, geremy condra wrote: To be fair, I don't think you'd have to look very far to find places where a graph representation is approximated using some combination of dicts, sets, and lists. ElementTree comes to mind immediately, and the dict-of-dicts idea for logging recently dis

Re: Insane Problem

2009-12-04 Thread Lie Ryan
On 12/5/2009 8:27 AM, Terry Reedy wrote: Victor Subervi wrote: I'm not rude To me, asking for help without providing sufficient information, especially when requested, is a form of rudeness. Think about that and don't be rude. Why does this sounds familiar? http://groups.google.com/group/c

Re: question about subprocess and shells

2009-12-04 Thread Lie Ryan
On 12/5/2009 8:38 AM, Ross Boylan wrote: If one uses subprocess.Popen(args, ..., shell=True, ...) When args finishes execution, does the shell terminate? Either way seems problematic. If it does not terminate, then it seems as if calls like wait and communicate would never return. It also see

Re: Redirecting stdin to a file

2009-12-04 Thread Lie Ryan
On 12/5/2009 10:31 AM, candide wrote: How do I redirect stdin to a text file ? In C, this can be done with the freopen() standard function, for instance FILE *foo = freopen("in.txt", "r", stdin); redirects stdin to the in.txt text file. Does anyone know a freopen() Python equivalent ? Notice

Re: python bijection

2009-12-04 Thread Lie Ryan
On 12/5/2009 9:41 AM, Carl Banks wrote: On Dec 4, 12:46 pm, geremy condra wrote: more common than full-blown graph package). Sure, its a tree, which is also a graph. In this case it looks to me more like a directed acyclic graph than anything, but its pretty much just semantics since the interf

Re: python bijection

2009-12-04 Thread Lie Ryan
On 12/5/2009 12:38 PM, geremy condra wrote: Where a list will do, use a list- duh. But when you need a graph, you shouldn't have to homebrew an implementation any more than you should have to homebrew an odict or named tuple, both of which are substantially easier to get right than a graph is.

Re: [distutils] Install script under a different name

2009-12-04 Thread Lie Ryan
On 12/5/2009 11:34 AM, Nikolaus Rath wrote: Hello, All my Python files have extension .py. However, I would like to install scripts that are meant to be called by the user without the suffix, i.e. the file scripts/doit.py should end up as /usr/bin/doit. Apparently the scripts= option of the set

Re: Can't print Chinese to HTTP

2009-12-05 Thread Lie Ryan
On 12/5/2009 2:57 PM, Gnarlodious wrote: On Dec 1, 3:06 pm, Terry Reedy wrote: def print(s): return sys.stdout.buffer.write(s.encode('utf-8')) Here is a better solution that lets me send any string to the function: def print(html): return sys.stdout.buffer.write(("Content-type:text/ plain;cha

Re: can someone explain 'super' to me?

2009-12-05 Thread Lie Ryan
On 12/5/2009 9:27 PM, Michael wrote: It seems like it can return either a class or an instance of a class. Like super( C, self) is like casting self as superclass C. However if you omit the second argument entirely you get a class. Inside a class C: these are all equivalent: super().method(arg)

Re: python bijection

2009-12-05 Thread Lie Ryan
On 12/5/2009 4:18 PM, Steven D'Aprano wrote: Tree is better than Graph not having Tree and Graph package in the standard library force most people to find List-based solution. If you have to be *forced* to use a list-based solution, that's a good sign that a list is *not* the right tool for th

Re: Can't print Chinese to HTTP

2009-12-05 Thread Lie Ryan
On 12/6/2009 12:56 PM, Gnarlodious wrote: On Dec 5, 3:54 am, Lie Ryan wrote: Because of the switch to unicode str, a simple print('晉') should've worked flawlessly if your terminal can accept the character, but the problem is your terminal does not. There is nothing wrong wit

Re: Generators.

2009-12-06 Thread Lie Ryan
On 12/7/2009 7:22 AM, Jorge Cardona wrote: Hi, I was trying to create a function that receive a generator and return a list but that each elements were computed in a diferent core of my machine. I start using islice function in order to split the job in a way that if there is "n" cores each "i"

Re: Generators.

2009-12-07 Thread Lie Ryan
First, I apologize for rearranging your message out of order. On 12/8/2009 5:29 AM, Jorge Cardona wrote: islice execute the function at the generator and drop the elements that aren't in the slice. I found that pretty weird, the way that i see generators is like an association between and indexi

Re: How decoupled are the Python frameworks?

2009-12-08 Thread Lie Ryan
On 12/8/2009 9:11 PM, Martin Sand Christensen wrote: If the user isn't currently signed in to our CAS, he'll be redirected to the sign-in page and, after signing in, is returned to the page he originally requested. The role decorator checks his privileges (based on his CAS credentials) and either

Re: Duplicates of third-party libraries

2009-12-08 Thread Lie Ryan
On 12/8/2009 3:25 PM, Martin P. Hellwig wrote: Ben Finney wrote: "Martin P. Hellwig" writes: Along with the duplication this introduces, it also means that any bug fixes — even severe security fixes — in the third-party code will not be addressed in your duplicate. I disagree, what you ne

Re: python proxy checker ,change to threaded version

2009-12-08 Thread Lie Ryan
On 12/8/2009 8:43 AM, Rhodri James wrote: def run(self): result = func(*func_args) # matching run_in_thread param names callback(result, *callback_args) Neat, but I think you mean if callback is not None: callback(result, *callback_args) for that last line. how about: import threading def

Re: Duplicates of third-party libraries

2009-12-08 Thread Lie Ryan
On 12/9/2009 12:02 AM, David Cournapeau wrote: On Tue, Dec 8, 2009 at 9:02 PM, Lie Ryan wrote: I disagree, what you should have is an Operating System with a package management system that addresses those issues. The package management must update your software and your dependencies, and keep

Re: IO Gurus: what are the differences between these two methods?

2009-12-08 Thread Lie Ryan
On 12/8/2009 4:12 AM, dpapathanasiou wrote: I have two methods for writing binaries files: the first works with data received by a server corresponding to a file upload, and the second works with data sent as email attachments. The odd thing is, they're not interchangeable: if I use the first on

Re: Generators.

2009-12-08 Thread Lie Ryan
On 12/9/2009 3:52 AM, Jorge Cardona wrote: 2009/12/8 Lie Ryan: First, I apologize for rearranging your message out of order. Theoretically yes, but the semantic of generators in python is they work on an Iterable (i.e. objects that have __iter__), instead of a Sequence (i.e.. objects that have

Re: plain text parsing to html (newbie problem)

2009-12-10 Thread Lie Ryan
On 12/10/2009 11:17 PM, João wrote: Thanks for the output. akean, I've installed ipython and I'm exploring it. Thanks. Terry, from what I've read stringIO allows us to store strings in a 'virtual' file. Can you please write just 2 lines exemplifying a write to and a read from an OS level file?

Re: accessing local variables from the pdb debugger

2009-12-10 Thread Lie Ryan
On 12/11/2009 12:37 AM, Jean-Michel Pichavant wrote: Diez B. Roggisch wrote: By just inserting the print foo statement right after changing foo's value, I've rolled back the value to 'foo' ??? A hell of a wtf pdb feature ! Apparently it's fixed in 2.7 and 3.1 D:\Lie R

Re: KeyboardInterrupt

2009-12-10 Thread Lie Ryan
On 12/11/2009 10:43 AM, mattia wrote: Ok, so is there any way to stop all the threads if the keyboard interrupt is received? You can't stop a thread from outside. The thread has to end itself (by ending the function). Usually, in the thread, you will check the value of a variable. If it's fal

Re: Variable class instantiation

2009-12-11 Thread Lie Ryan
On 12/11/2009 8:26 PM, Jan Mach wrote: Hi everybody, I am currently solving the following problem and I am stuck. I am trying to create instance of the class of variable name. I know, that the following works: if (something): classToUse = C1 else: classToUse = C2 o = classToUse() ,bu

Re: plain text parsing to html (newbie problem)

2009-12-11 Thread Lie Ryan
On 12/11/2009 8:43 PM, João wrote: On Dec 10, 7:55 pm, Lie Ryan wrote: and, is there any reason why you're not using the email and smtplib?http://docs.python.org/library/email-examples.html Mainly because I was unaware of them :( I just read about them and I found all the Subject,

Re: IndentationError

2009-12-11 Thread Lie Ryan
On 12/10/2009 6:32 AM, hong zhang wrote: List, I got error says IndentationError in end of line. I could not figure out why. See following: $ ./cont-mcs File "./cont-mcs", line 264 mcs1 = ht_val+cck_val+green_val+fat_val+sgi_val ^ Inden

Re: Virtual file for subprocess

2009-12-11 Thread Lie Ryan
On 12/12/2009 4:07 AM, bobnotbob wrote: I am calling external executable from my python program (using subprocess). This external program's output is a text file which I then read and parse. Is there any way to "sandbox" the calling of this external program so that it writes to a virtual file i

Re: Problems with debugging Lists

2009-12-12 Thread Lie Ryan
On 12/12/2009 8:28 PM, Sancar Saran wrote: repr works as you say and I had some complaints, it wont format the output. Finding some string in 100 key dictionary in formatted in single line bit problematic. Is it any way to format it ? As has been mentioned, use pprint.pformat() to get what ppri

Re: Spawning an interactive interpreter in a running python process?

2009-12-12 Thread Lie Ryan
On 12/12/2009 3:49 PM, Tim Chase wrote: I'm curious, in an academic sense, if it's possible to spawn the interactive interpreter (>>>) in a running python application. Ideally, I would like to be able to access the modules, functions and variables the application can. Is something like this pos

Re: a list/re problem

2009-12-12 Thread Lie Ryan
import re r = re.compile('\*(.+)\*') def f(s): m = r.match(s) if m: return m.group(1) l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] n = [y for y in (f(x) for x in l) if y] -- http://mail.python.org/mailman/listinfo/python-list

Re: a list/re problem

2009-12-12 Thread Lie Ryan
On 12/12/2009 8:24 AM, Peter Otten wrote: But it is inefficient, because it is matching the regex twice for each item, and it is a bit ugly. I could use: n = [] for x in keys: m = r.match(x) if m: n.append(m.group(1)) It is more efficient, but much uglier. It's

Re: read text file byte by byte

2009-12-12 Thread Lie Ryan
On 12/13/2009 5:15 PM, daved170 wrote: Thank you all. Dennis I really liked you solution for the issue but I have two question about it: 1) My origin file is Text file and not binary 2) I need to read each time 1 byte. I didn't see that on your example code. That's where you're confusing things

Re: insert unique data in a list

2009-12-13 Thread Lie Ryan
On 12/14/2009 11:49 AM, Fire Crow wrote: I also think that if every api has to conform to every other api nothing will ever get done. but if every object has its own distinct API, we will never finish reading the docs (assuming they do exist for each object). -- http://mail.python.org/mailman

Re: Moving from PHP to Python. Is it Possible

2009-12-13 Thread Lie Ryan
On 12/14/2009 12:04 PM, Sancar Saran wrote: On Monday 14 December 2009 02:10:16 am Diez B. Roggisch wrote: In my usage GLOBALS are too much useful to discard it. The problem with global variables is their scope. If you have a piece of code, the important thing to know is what influences it's b

Re: Dangerous behavior of list(generator)

2009-12-13 Thread Lie Ryan
On 12/14/2009 9:45 AM, exar...@twistedmatrix.com wrote: On 08:18 pm, st...@remove-this-cybersource.com.au wrote: On Sun, 13 Dec 2009 14:35:21 +, exarkun wrote: StopIteration is intended to be used only within the .__next__ method of iterators. The devs know that other 'off-label' use result

Re: Dangerous behavior of list(generator)

2009-12-14 Thread Lie Ryan
On 12/14/09, exar...@twistedmatrix.com wrote: > On 02:50 am, lie.1...@gmail.com wrote: >>On 12/14/2009 9:45 AM, exar...@twistedmatrix.com wrote: >>>On 08:18 pm, st...@remove-this-cybersource.com.au wrote: On Sun, 13 Dec 2009 14:35:21 +, exarkun wrote: >>StopIteration is intended to be

Re: insert unique data in a list

2009-12-14 Thread Lie Ryan
On 12/15/2009 4:13 AM, mattia wrote: > > of course it is broken as long as it uses it's instance id. i added this > to notify that unhashable can become hashable implementing __hash__ > inside the class. which probably set to None by default. Ok, nice example, but I believe that using id() as

Re: Seek support for new slice syntax PEP.

2009-12-14 Thread Lie Ryan
On 12/15/2009 5:03 AM, Dave wrote: Just as sets may now be written as {3,'hi'}, I propose that slices should be available using [start:end] syntax. Following example comes from projecteuler.net problem 166. The Numeric community would also like this, as would the general python user. The slice

Re: str and unicode proper usage

2009-12-14 Thread Lie Ryan
On 12/15/2009 5:05 AM, gizli wrote: Hi all, If an entire application operates on Unicode strings from UI to database, is there a use case for str() and unicode() functions? The application should be able to read/write files, open sockets and execute external processes and parse their output. Fro

<    1   2   3   4   5   6   7   8   9   10   >