Re: Python obfuscation

2005-11-10 Thread Mike Meyer
Yu-Xi Lim <[EMAIL PROTECTED]> writes: > Bill Mill wrote: >> Your only solution, then, is to write unpopular code. Because, as Alex >> said, it will otherwise be broken into. Let's look at two very popular >> pieces of code: Half-Life 2 and Windows XP. How are they secured? >> Previous version of th

Re: Command-line tool able to take multiple commands at one time?

2005-11-10 Thread Mike Meyer
Peter A. Schott <[EMAIL PROTECTED]> writes: > Per subject - I realize I can copy/paste a line at a time into an interactive > session when I'm trying to debug, but was wondering if there is any tool out > there that allows me to copy sections of working Python scripts to paste into > my > interact

Re: Recompile AST?

2005-11-10 Thread Chris Spencer
Leif K-Brooks wrote: > [EMAIL PROTECTED] wrote: > >>Is it possible to recompile the AST generated by compiler.parse, back >>into code or an executable code object? > > > Into a bytecode object: > > >>> from compiler.pycodegen import ModuleCodeGenerator > >>> from compiler.misc import set_file

Re: SuSe 10.0 missing Idle

2005-11-10 Thread Steve
Joseph Garvin wrote: > Steve wrote: > >>Hello, >> >>Hopefully this is not to of topic. I just installed SuSe >>10.0 >> and although python installed but no Idle. I can't seem to find it >> in >>the list of available packages either. I was wondering if someone >>might steer me in t

Change directory not successfully done

2005-11-10 Thread Samuel Yin
Hi, guys, This should be a simple problem, but I just can not resolve it. I just want to use a python script to change my working directory. see my following code: # mycd.py 1) destdir = "" 2) command = "cd "+ destdir 3) os.system(command) 4) os.chdir(destdir) But neither 3) nor 4) is us

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Bengt Richter wrote: > If you want to terminate a generator expression after the first sequence of > elements > satisfying a condition, and you don't want to use takewhile, I don't know of > a gotcha > to prevent you from just raising StopIteration, using an expression that will > do that, e.g.

Re: derived / base class name conflicts

2005-11-10 Thread christopherlmarshall
Steve Juranich wrote: > This should prove most enlightening: > > import Tkinter > dir(Tkinter.Canvas) > > Huh? Chris Marshall -- http://mail.python.org/mailman/listinfo/python-list

Curses & Keypress

2005-11-10 Thread ale . of . ginger
Now that I have gotoxy() down for moving the cursor around, I want that to be a result of keypresses (namely from the numpad -- 7 = NorthWest, 8 = North, 9 = NE, etc...). I have little clue how to do this. After searching google, I've come upon this; include: import curses in the header. Howev

Re: Printing current time to a file

2005-11-10 Thread skip
zolaris> self.log.write(time.ctime(time.time())) zolaris> But that prints nothing in the file assigned to log. Is there zolaris> something I should be doing extra? There's no newline in there. You probably need to flush the file: self.log.write(time.ctime(time.time())) self

Re: derived / base class name conflicts

2005-11-10 Thread christopherlmarshall
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > Now, 'i' might have already been defined by A or by the call to > > A.__init__() so if you define it without knowing that, you could be > > changing the behavior of A's methods in unknown ways, which is > > obviously a bad thing. > > http://doc

Re: How to set program name in Python? ($0 in Perl)

2005-11-10 Thread Bengt Richter
gt; >given that Swaroop has written a nice book about Python, I somehow >suspect that he knows how sys.argv works: > > http://tinyurl.com/9s7bz > Sorry, I wasn't familiar with that (or Swaroop ;-) >or are you saying that "ps" looks inside sys.argv on your mac

Re: testing C code with python

2005-11-10 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > A simple question - Is it common/good practice to test C code using > Python? For example one could wrap individual C functions, and test > each of them using python, maybe not for low-level things but at least > for algorithmic correctness. Anyone effectively doing this

Re: Printing current time to a file

2005-11-10 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > I am trying to print the current system time to a file. I know only a > little bit about Python. I have gotten the very simple: > > Print time.time() > > to work properly. From what I gather the line to print it to a file > should look like: > > self.log.write(time.

Re: derived / base class name conflicts

2005-11-10 Thread Ben Finney
[EMAIL PROTECTED] wrote: > Suppose you want to write a subclass of some existing class you are > importing from a module you didn't write and that you don't want to > study the internals of No need to study its internals. Fire up a Python interpreter and inspect its outside: >>> import foomod

Abstract Base Classes

2005-11-10 Thread Ben Finney
Howdy all, Okay, so Guido doesn't like Abstract Base Classes[0], and interfaces are the way of the future[1]. But they're not here now, and I understand ABCs better. I want my modules to (sometimes) define an abstract base exception class, that all other exceptions in that module inherit from.

Re: Change directory not successfully done

2005-11-10 Thread Mike Meyer
Samuel Yin <[EMAIL PROTECTED]> writes: > Hi, guys, > > This should be a simple problem, but I just can not resolve it. I just > want to use a python script to change my working directory. see my > following code: > > # mycd.py > 1) destdir = "" > 2) command = "cd "+ destdir > 3) os.system(c

Re: Hi, from my login i want to login as a other user ,

2005-11-10 Thread Ganesan Rajagopal
> sumi <[EMAIL PROTECTED]> writes: > Hi, i am very new to python , it is just 2 days i started reading abt > it. I did not understand the above statement. Just read the document at the URL given to you. > what i want to do is , i want to login as a super user eg : $su xyz , and > then i n

Re: Abstract Base Classes

2005-11-10 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes: > I've tried doing this in the __init__(): > > class FooException(Exception): > """ Base class for all FooModule exceptions """ > def __init__(self): > raise NotImplementedError, \ > "%s is an abstract class for

Re: Abstract Base Classes

2005-11-10 Thread Ben Finney
Mike Meyer <[EMAIL PROTECTED]> wrote: > class FooException(Exception): > def __init__(self): > if self.__class__ == FooException: > raise NotImplementedError, >"FooException is an abstract class for exceptions" Shall try this when I get the chance.

Re: Command-line tool able to take multiple commands at one time?

2005-11-10 Thread Fernando Perez
Peter A.Schott wrote: > Per subject - I realize I can copy/paste a line at a time into an interactive > session when I'm trying to debug, but was wondering if there is any tool out > there that allows me to copy sections of working Python scripts to paste into > my interactive console and let thos

Re: exceptions, internals (introspection?)

2005-11-10 Thread Fernando Perez
ej wrote: > I have often wondered how to get at other internals, such as the name of > the current function, file, line number I am in? The arguments to the > current function, etc. I browsed through the table of contents of both the > Library Reference & Language Reference. I see section 18

Re: : detecting modifier keys?

2005-11-10 Thread MackS
Hi Dennis, Thanks for your help, what is happening is clear now. Just found that calling curses.raw() lets you get all scan codes. Cheers Mack -- http://mail.python.org/mailman/listinfo/python-list

Re: How to set program name in Python? ($0 in Perl)

2005-11-10 Thread jmdeschamps
This is not directly what the OP wanted in regards to Perl, but to see what one could do if one needed to change the name of the running program, I wrote this: ## START PROGRAM import sys import os.path import shutil import os def testChangingName(appname): hopedfornameis = appname mylongn

Re: need an example of Python numarray to C++ and back again, Boost / SWIG?

2005-11-10 Thread Fernando Perez
PL wrote: > I looked at Stefan's post - but he remarks that "Unfortunately, Blitz > jealously guards its data (restricted pointers), so that it is not so > easy to do the conversion in the other direction. If anyone knows an > answer to this problem, I'd be glad to hear it" > > I've previously l

Re: Python obfuscation

2005-11-10 Thread Alex Martelli
petantik <[EMAIL PROTECTED]> wrote: ... > I think that is not workable because it is easy to say the the internet > is available everywhere. This implies that, if it were difficult to say it, then the scheme WOULD be workable... which I doubt is what you mean, of course;-) > It is not availab

Re: Python obfuscation

2005-11-10 Thread Alex Martelli
Yu-Xi Lim <[EMAIL PROTECTED]> wrote: ... > My brother is bugged by Civilization IV's copy protection. A couple of > days ago, after consulting me on what other options he could try, he > finally said in frustration, "Maybe I should go buy the game." It's interesting, in this context, that Civi

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>> list (x for x in xrange(20) if x<5 or iter([]).next()) > > [0, 1, 2, 3, 4] > > > > Or a bit more readably: > > >>> def stop(): raise StopIteration > > ... > > >>> list (x for x in xrange(20) if x<5 or stop()) > > [0, 1, 2, 3, 4] > > > > IO

LARGE numbers

2005-11-10 Thread Tuvas
I've been thinking about writing a program to generate the world's largest prime numbers, just for the fun of it. This would require being able to hold an 800 digit number into memory (25 megabits, or a little over 3 megs of memory for just one variable...) I would also need several smaller var

Re: Change directory not successfully done

2005-11-10 Thread Samuel Yin
Thanks for your answer. I know why the why os.system or os.chdir failed change my directory. But Sorry for my un-clear description of my problem. Currently I work in window platform, use cmd.exe instead of bash. I mentioned bash just as a example to illustrate my problem.     Thanks and Reg

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-10 Thread casevh
I've created Windows binaries for Python 2.3 and 2.4. It should be compatible with PentiumPro or later processors. They can be found at http://home.comcast.net/~casevh/ Case -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
oops, stand corrected. I was under the impression that an exception would break out of the current expression and forgot that the "for" would contain it(that StopIteration is a condition to it expects to stop it). thanks, this is the functionality I am looking for. Alex Martelli wrote: > Can you

Re: LARGE numbers

2005-11-10 Thread casevh
For more information on how the largest prime number was found, see www.mersenne.org. Python does support large numbers, but it's not very fast for such large numbers. There is a Python module called GMPY that uses the GMP (Gnu Multiple Precision) library for faster operations on large numbers. B

how can i get system time?

2005-11-10 Thread [EMAIL PROTECTED]
Hi, Can I get a system date time? I want to get current time, like the target string should looks like: the output of : `date +"%Y%m%d %H:%M:%S"` how can i do this? thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Bengt Richter wrote: > IOW, your "when condition(x)" (IIUIC) can be spelled "if condition(x) or > stop()" neat trick. -- http://mail.python.org/mailman/listinfo/python-list

Good python reference?

2005-11-10 Thread derek
Hello! I'm new to the group and am looking for a decent reference for information about the history / evolution of the Python language and its features. Typing, scoping, etc... I'd appreciate any good links. Thanks! - Derek -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread LB
>it looks like LB has configured his browser to pass all gz files to some >ancient VRML plugin; see e.g. You are right! And now it's fixed. But till yesterday I did download of .gz file with no problems at all... Thanks, LB -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread LB
>it looks like LB has configured his browser to pass all gz files to some >ancient VRML plugin; see e.g. You are right! And now it's fixed. But till yesterday I did download of .gz file with no problems at all... Thanks, LB -- http://mail.python.org/mailman/listinfo/python-list

PYTHON Engineers, BitTorrent, Inc. San Francisco, CA

2005-11-10 Thread dan_crask
PYTHON Engineers, BitTorrent, Inc. lace w:st="on">San Francisco, CAlace >Interested candidates should forward their resumes to [EMAIL PROTECTED]>>for immediate consideration.  No resume?  No problem…..Tell us about your Python skills and how you may have contributed to the Open Source community

Job - PYTHON Engineers, BitTorrent, Inc., San Francisco, CA

2005-11-10 Thread camdenjobs
PYTHON Engineers, BitTorrent, Inc., San Francisco, CA Interested candidates should forward their resumes to [EMAIL PROTECTED] for immediate consideration. No resume? No problem…..Tell us about your Python skills and how you may have contributed to the Open Source community. WHO WE ARE: BitT

Re: A Tcl/Tk programmer learns Python--any advice?

2005-11-10 Thread Svenn Are Bjerkem
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Why does there need to be OO "in the core"? That is one thing I have > never understood. If you want OO, get a package that fits your style of > OO and "package require" you are off and running. That probably isn't > what you would be loo

Re: Recompile AST?

2005-11-10 Thread Bengt Richter
On 10 Nov 2005 16:07:56 -0800, "Paul Boddie" <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> I've also posted sporadic musings about the possibilities for >> AST-transforming >> custom import functions to do optimizations and macros and special forms >> etc., >> but no one seemed much intere

Re: how can i get system time?

2005-11-10 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Hi, Can I get a system date time? time.time() > I want to get current time, like > the target string should looks like: > the output of : `date +"%Y%m%d %H:%M:%S"` > > how can i do this? >>> time.strftime("%Y%m%d %H:%M:%S") '2005 02:44

modify dictionary while iterating

2005-11-10 Thread s99999999s2003
hi I wish to pop/del some items out of dictionary while iterating over it. a = { 'a':1, 'b':2 } for k, v in a.iteritems(): if v==2: del a[k] the output say RuntimeError: dictionary changed size during iteration how can i suppress this message in an actual script and still get the final

<    1   2   3