Re: Getting a function name from string

2005-11-02 Thread Mike Meyer
"Paul McGuire" <[EMAIL PROTECTED]> writes: > "David Rasmussen" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> If I have a string that contains the name of a function, can I call it? >> As in: >> >> def someFunction(): >> print "Hello" >> >> s = "someFunction" >> s() # I know this

Re: How to print random strings

2005-11-02 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Im at the end of chapter 3 of "Python Programming For The Absolute > Beginner, Michael Dawson " and he asks to make a fortune program that > displays a fortune each time its ran, and to have 5 unique fortunes. > > Whats confusing is that, he never discussed how to do th

Re: reading internet data to generate random numbers.

2005-11-02 Thread Mike Meyer
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2005-11-02, Neil Schemenauer <[EMAIL PROTECTED]> wrote: >> Grant Edwards <[EMAIL PROTECTED]> wrote: >> Using data from the Internet is just a bad idea. > I think that the timing of certain network events is one of the > Linux kernel's entropy sources.

Re: another beginner sort of question

2005-11-02 Thread Mike Meyer
John Salerno <[EMAIL PROTECTED]> writes: [Wants to learn C# and Python simultaneously.] > So my question is, is this feasible? Should be. It might be faster to do them sequentually. > Or does learning Python require (or entail) learning all the details > behind it? Not really. There are some tra

Re: Pychecker Re: Nested List Question

2005-11-02 Thread Mike Meyer
Roman Suzi <[EMAIL PROTECTED]> writes: > On Thu, 3 Nov 2005, Chris McCoy wrote: >>> gridSystemId = [[None]*columns]*rows >> You've made gridSystemID a list of `rows` references to the SAME "inner" >> list, so the behavior you observe is the only possible one. >> If you want copies instead, ASK for

Re: Getting a function name from string

2005-11-03 Thread Mike Meyer
[EMAIL PROTECTED] (Bengt Richter) writes: >>For a lot of uses, it'd be better to build the dictionary by hand >>rather than relying on one of the tools that turns a namespace into a >>dictionary. > IMO it would be nice if name lookup were as cleanly > controllable and defined as attribute/method lo

Re: Class Variable Access and Assignment

2005-11-03 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >> What would you expect to get if you wrote b.a = b.a + 2? > I would expect a result consistent with the fact that both times > b.a would refer to the same object. Except they *don't*. This happens in any language that resolves references at run time. Cha

Re: Can Anyone Help me on this

2005-11-03 Thread Mike Meyer
for you: list2 = list(list1) or list2 = list1[:] >>> list2.reverse() >>>> list1 > ['1', '2', '3', '4', '5', '6', '7', '8', '9'] >>>> list2 > ['9', '

Re: Class Variable Access and Assignment

2005-11-03 Thread Mike Meyer
"Graham" <[EMAIL PROTECTED]> writes: > I just seems to me that . shouldn't defer to the class > variable if > an instance variable of the same name does not exists, it should, at > least how i > understand it raise an exception. > > Is my thinking way off here? Yes. This behavior is how you get in

Re: Class Variable Access and Assignment

2005-11-03 Thread Mike Meyer
"Graham" <[EMAIL PROTECTED]> writes: > Many thanks your explaination cleared up many of the questions I had. > I know think i can understand the purpose, regardless of my opinion, i > do however think that one should be able to assign the value in the > same way it is accessed. That's not true in

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-11-03, Mike Meyer schreef <[EMAIL PROTECTED]>: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >>>> What would you expect to get if you wrote b.a = b.a + 2? >>> I would expect a result consistent with

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
> Would it be too much to ask that in a line like. > > x = x + 1. > > both x's would resolve to the same namespace? Yes. That's to much bondage for programmers who've become accustomed to freedom. Explain why this should be illegal: >>> class C: ... def __getattr__(self, name): ... x = 1

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> I've already argued that the kludges suggested to "solve" this problem >> create worse problems than this. > The most obvious solution is to permit (or even r

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-11-04, Mike Meyer schreef <[EMAIL PROTECTED]>: >> >>> Would it be too much to ask that in a line like. >>> >>> x = x + 1. >>> >>> both x's would resolve to the same nam

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-11-04, Mike Meyer schreef <[EMAIL PROTECTED]>: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >>> Op 2005-11-03, Mike Meyer schreef <[EMAIL PROTECTED]>: >>>> Antoon Pardon <[EMAIL PROTECTED]&

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > equal? Some things are a matter of objective fact: should CPython use a > byte-code compiler and virtual machine, or a 1970s style interpreter that > interprets the source code directly? For the record, I've only seen one interpreter that actually inte

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
[EMAIL PROTECTED] (Bengt Richter) writes: > On Thu, 03 Nov 2005 13:37:08 -0500, Mike Meyer <[EMAIL PROTECTED]> wrote: > [...] >>> I think it even less sane, if the same occurce of b.a refers to two >>> different objects, like in b.a += 2 >> >>That's

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
[EMAIL PROTECTED] (Bengt Richter) writes: > On 04 Nov 2005 17:53:34 -0800, Paul Rubin wrote: >>[EMAIL PROTECTED] (Bengt Richter) writes: >>> Hm, "the" fix? Why wouldn't e.g. treating augassign as shorthand for >>> a source transformation (i.e., asstgt = expr becomes by si

Re: Class Variable Access and Assignment

2005-11-04 Thread Mike Meyer
Paul Rubin writes: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> It also allows you to do something like this: >> class ExpertGame(Game): >> current_level = 100 > >> and then use ExpertGame anywhere you would have used Game with no problems. > Well, let's say you s

Re: re sub help

2005-11-04 Thread Mike Meyer
tartdelim] and [enddelim] to ''. I only want to get rid of the > '\n' everywhere else. Well, I'm not an expert on re's - I've only been using them for three decades - but I'm not sure this can be done with a single re, as the pattern you'r

Re: re sub help

2005-11-04 Thread Mike Meyer
[EMAIL PROTECTED] writes: > hi > > i have a string : > a = > "this\nis\na\nsentence[startdelim]this\nis\nanother[enddelim]this\nis\n" > > inside the string, there are "\n". I don't want to substitute the '\n' > in between > the [startdelim] and [enddelim] to ''. I only want to get rid of the > '\n

Re: re sub help

2005-11-05 Thread Mike Meyer
[EMAIL PROTECTED] writes: > i am still interested about using re, i find it useful. am still > learning it's uses. > so i did something like this for a start, trying to get everything in > between [startdelim] and [enddelim] > > a = > "this\nis\na\nsentence[startdelim]this\nis\nanother[enddelim]thi

Re: Using Which Version of Linux

2005-11-05 Thread Mike Meyer
blahman ([EMAIL PROTECTED]) writes: > ok, i m going to use Linux for my Python Programs, mainly because i > need to see what will these fork() and exec() do. So, can anyone tell > me which flavour of linux i should use, some say that Debian is more > programmer friendly, or shold i use fedora, o

Re: Using Which Version of Linux

2005-11-05 Thread Mike Meyer
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2005-11-05, Mike Meyer <[EMAIL PROTECTED]> wrote: >> "Programmer-friendly" is pretty vague. Gentoo is the only Linux distro >> I've run into (which excludes a *lot* of Unix distros) that I'd >> c

Re: Python doc problem example: gzip module (reprise)

2005-11-05 Thread Mike Meyer
"Andrea Gavana" <[EMAIL PROTECTED]> writes: > I tend to agree with you, Rick. I usually don't like Xah's "posting > behavior", but this time he has done, in my opinion, a "constructive" > criticism (and he didn't even say *fuck* once in the whole post!!!). I am > quite a newbie in Python, I usuall

Re: Python doc problem example: gzip module (reprise)

2005-11-05 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> The thing is, the library documentation that Xah Lee is complaining >> about is a *reference document*. It says so right in the title: >> "Python Library Refere

Re: Python doc problem example: gzip module (reprise)

2005-11-05 Thread Mike Meyer
Paul Rubin writes: >> To my knowledge the PSF isn't doing anything about including the >> documentation with their distribution, so they shouldn't care about >> the licenses. Wanting to bundle a good tutorial for everything in >> the library might be on the list, but the

Re: Python doc problem example: gzip module (reprise)

2005-11-05 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> > It's only -because- of those licenses that there's any reason not to >> > bundle. >> Actually, there are other reasons, just as there are reasons besides

Re: Using Which Version of Linux

2005-11-06 Thread Mike Meyer
Terry Hancock <[EMAIL PROTECTED]> writes: > Similarly, I see RPMs by ones and twos all over the place, > and only a few places with DEBs. But the DEB repositories > are HUGE. Try rpmfind.net. It's not clear where the rpms reside, but it's not really important - it's a huge collection of RPMs.

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread Mike Meyer
"vinjvinj" <[EMAIL PROTECTED]> writes: > 1. restrict the user from doing any file io, exec, import, eval, etc. I > was thinking of writing a plugin for pylint to do all the checks? Is > this is a good way given that there is no restricted python. What are > the things I should serach for in python

Re: Web automation

2005-11-07 Thread Mike Meyer
[EMAIL PROTECTED] writes: > but I supposed the everyone knew that web automation (and in general > "automation") is only a problem in Linux. I don't know it. I don't believe it, either. I automate web tasks on Unix systems (I don't use many Linux systems, but it's the same tool set) on a regular b

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread Mike Meyer
"vinjvinj" <[EMAIL PROTECTED]> writes: > While I understand 2 is very hard (if not impossible) to do in single > unix process. I'm not sure why 1 would be hard to do. Since I have > complete control to what code I can allow or not allow on my grid. Can > i not just search for certain strings and d

Re: Application monitor

2005-11-07 Thread Mike Meyer
"dcrespo" <[EMAIL PROTECTED]> writes: > Main application starts > This one starts the App Monitor of itself. (This means that if Main > Application closes, the App Monitor restart it) > > And viceversa means that if App Monitor closes, the Main application > restart it. > > How can I accomplish thi

Re: Map of email origins to Python list

2005-11-07 Thread Mike Meyer
Claire McLister <[EMAIL PROTECTED]> writes: > Thanks, Alan. You are absolutely right, we are not using the > NNTP-Posting-Host header for obtaining the IP address. Yes, but what are you using? > The Python list is unique among the lists that we have handled so far, > in that it has a cross-postin

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Mike Meyer
Claire McLister <[EMAIL PROTECTED]> writes: > An interesting perspective. Not to increase your sense of 'creepy', > but a lot of big corporations now have access to this kind of > information and more. You mean my creditors are going to be looking for me in San Francisco, even though I'm in Virgin

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-07 Thread Mike Meyer
"python" <[EMAIL PROTECTED]> writes: > i am a long time windows user and have had a great way to learn new api. There's a better way. See below. > to write some code and then run it. > if there is an error, the debugger will load. > then i can figure out what the eror is, just touch up the ocde a

Re: Web automation

2005-11-07 Thread Mike Meyer
"Paul Boddie" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> [EMAIL PROTECTED] writes: >> > but I supposed the everyone knew that web automation (and in general >> > "automation") is only a problem in Linux. >> I don't know

Re: problem generating rows in table

2005-11-07 Thread Mike Meyer
[EMAIL PROTECTED] writes: > hi > i wish to generate a table using cgi > toprint = [('nickname', 'justme', 'someplace')] > print ''' > > User > Name > Address > > > ''' > > for i in range(0,len(toprint)-1

Re: which feature of python do you like most?

2005-11-08 Thread Mike Meyer
"James" <[EMAIL PROTECTED]> writes: > Most of the responses are of the "Why Python is more pleasant than C++" > variety, but the original poster specifically said he had experience > with Perl. As such, arguments like "automatic memory management" don't > carry any weight. > >>From my experience

random number generator thread safety

2005-11-08 Thread Mike Brown
nted. I'm not in a position to submit a patch, but will submit a documentation bug report if so advised. Thanks, Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: Web automation

2005-11-08 Thread Mike Meyer
[EMAIL PROTECTED] writes: > answering to Mike Meyer who replied to the following > assertion on my part: > >> but I supposed the everyone knew that web automation > >> (and in general "automation") is only a problem in Linux. > with...: >> I don't

Re: Web automation

2005-11-08 Thread Mike Meyer
"Paul Boddie" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> "Paul Boddie" <[EMAIL PROTECTED]> writes: >> > The problem on non-Windows systems is the lack of a common (or >> > enforced) technology for exposing application object mod

Re: Python doc problem example: gzip module (reprise)

2005-11-08 Thread Mike Meyer
"Xah Lee" <[EMAIL PROTECTED]> writes: > Newsgroups: comp.lang.perl.misc > PS: I won't cross-post as I'm not subscribed to the Python group. Very wisely done. Then from Xah Lee, we get; > I have cross posted it for you. Proving once again that he's stupider than spam. Please help google find him

Re: Application monitor

2005-11-08 Thread Mike Meyer
"dcrespo" <[EMAIL PROTECTED]> writes: >> Personally, I use init as an app monitor. It doesn't need monitoring > What's "init"? Sorry about my ignorance. init is the first Unix process, and all other processes are descended from it. It is the alpha and the omega of Unix processes. Uh, wait a second

Re: user account logon from python

2005-11-08 Thread Mike Meyer
"Philippe C. Martin" <[EMAIL PROTECTED]> writes: > Jeff, > > 1- I cannot find getpwent in the documentation getpwent is a Unix library call. For python, you want the pwd module. The docs are http://docs.python.org/lib/module-pwd.html >. > 2- crypt will not work if the system does not have shadow

Re: Invoking Python from Python

2005-11-08 Thread Mike Meyer
[EMAIL PROTECTED] (Cameron Laird) writes: > In article <[EMAIL PROTECTED]>, > Thomas Guettler <[EMAIL PROTECTED]> wrote: >>creating source code with a script, is no good solution. >>Once I had to maintain lisp code which stored its data in lisp code, too >>(incl. conditions and loops). It was a n

Re: user account logon from python

2005-11-08 Thread Mike Meyer
"Philippe C. Martin" <[EMAIL PROTECTED]> writes: > Hi Mike, > Mike Meyer wrote: >>> 1- I cannot find getpwent in the documentation >> getpwent is a Unix library call. For python, you want the pwd >> module. The docs are http://docs.python.org/lib/module

Re: Goto XY

2005-11-08 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Is there some command in python so that I can read a key's input and > then use a gotoxy() function to move the cursor on screen? e.g.: > (psuedo-code) > > When the right arrow is pushed, cursor gotoxy(x+1,y) You want curses. A version is included in the standard libr

Re: random number generator thread safety

2005-11-08 Thread Mike Brown
Raymond Hettinger wrote: > Mike Brown wrote: > > I have questions about thread safety in the 'random' module. > > > > When using the random.Random class (be it Mersenne Twister or Wichmann-Hill > > based), is it sufficiently thread-safe (preserving entropy and

Re: append to non-existing list

2005-11-09 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Fredrik Lundh wrote: >> x = "10" + 20 # should this be 30 or 1020 or "1020" or ...? >> > I think Perl handles this case pretty well and sane. > > In fact, this strict but dynamic type checking is quite painful to work > with, especially the new

Re: Invoking Python from Python

2005-11-09 Thread Mike Meyer
[EMAIL PROTECTED] (Cameron Laird) writes: > I'll rein myself in and suggest an even easier introduction > to this subject: configuration files. RARELY is the correct > answer to create a new syntax, although many development > organizations give the impression that's their first choice. > ".ini"-

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-09 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > Steven D'Aprano wrote: >> On Tue, 08 Nov 2005 13:38:28 -0500, python wrote: > [...] >>>as i mentioned even micro$soft can do this using statically type languages >>>like visual basic and csharp. >>> also, both visualbasic and csharp have goto statements,

Re: Web automation

2005-11-09 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Hi Mike, > thank you very much for your reply. > I know that mine could be considered >> a "very" silly way to define automation. > but I'm not a purist nor a professional > programmer. Yes, but you still need to communicate wi

Re: append to non-existing list

2005-11-09 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: > >> Float doesn't handle implicit conversion to anything but but builtin types. >> In particular, it doesn't check to see if the object beinng added has a >> __float__ metho

Re: Python obfuscation

2005-11-09 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > How effective can it be when python is designed to make writing this > kind of code hard(hopefully impossible) ? The most effective would be > renaming function and may be variables but if the functions are kept > short, they would at most looks lik

Re: how to identify a particular directory / file on remote machine

2005-11-09 Thread Mike Meyer
"Swarna" <[EMAIL PROTECTED]> writes: > Hi all, > > I am trying to find out whether a particular directory is present on a > remote machine or not from my local Python script in Linux . Can anyone > help me with the command that i need to issue to os.system in my python > script to acheive this? L

ANN: P(x) 0.2 applet builder

2005-11-09 Thread Mike Meyer
P(x) is hard to describe. It might be called a "Framework", but that's a grandiose word for a couple of hundred lines of code. It might be called a programmable calculator, but it has none of the things one associates with calculators. It might be called a programming language, but it's just Python

PySol --> SuSE 10.0

2005-11-10 Thread Mike T.
Hi, I'm trying to install PySol on 10.0. I've tried two routes: the RPM and building from source. First, from RPM. I su'd to root and run the following: linuxdell:/home/mike # rpm -i pysol-4.82-1.noarch.rpm error: Failed dependencies: tkinter >= 2.2 is needed by pyso

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > LB wrote: >>>The tarball can be found at >>http://www.mired.org/downloads/P(x)-0.2.tar.gz >. >> Something doesn't work with the link. >> LB >> > Copy the whole string up to and including the ".gz" at the end and > paste that into your browser's location wi

Re: Addressing the last element of a list

2005-11-10 Thread Mike Meyer
[Context recovered from top posting.] "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Daniel Crespo wrote: >> Well, I hope that newcomers to Python don't confuse himselves :) > This mutable/immutable object and name/variable is confusing. Only if you have to overcome a conviction that variables

Re: append to non-existing list

2005-11-10 Thread Mike Meyer
Yves Glodt <[EMAIL PROTECTED]> writes: > Which raises another question... :-) > > Is there a possibility to bring together apache and python in a way > that I can embed python into html? Lots of ways. Most of them aren't really Python, but look a lot like it. PSP is most like PHP/ASP/etc., and I

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-10 Thread Mike Meyer
Magnus Lycka <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> In that case, you're using the wrong IDE. I run the Python interpeter >> inside of Emacs. I edit my code in another buffer. In the source code >> buffer, I hit M-C-x, and the current version of the f

Re: Python obfuscation

2005-11-10 Thread Mike Meyer
"petantik" <[EMAIL PROTECTED]> writes: > Perhaps a comprehensive protection for interpreted languages can never > be built because of their high level nature? Nah. Compiling/interpreting is an implementation detail, and orthogonal to the issue of "high level". There are compilers for high level la

Re: Python obfuscation

2005-11-10 Thread Mike Meyer
"Ben Sizer" <[EMAIL PROTECTED]> writes: > For example, I'd like to write a game in Python. I'd like to give the > game away free and charge for extra content. In C++ I can make it > difficult for users to share content with others who haven't paid for > it, with cryptographic hashes and the like. N

Re: Python obfuscation

2005-11-10 Thread Mike Meyer
secured? >> Previous version of these software products used sophisticated >> client-side programming to try and be secure, but the security was >> nonexistant. Users share keys and cracks with each other. > Mike Meyer wrote: > > What makes you think this is the case? T

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: 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: 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: 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

Re: LARGE numbers

2005-11-11 Thread Mike Meyer
"Tuvas" <[EMAIL PROTECTED]> writes: > 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 varia

Re: Python obfuscation

2005-11-11 Thread Mike Meyer
"Ben Sizer" <[EMAIL PROTECTED]> writes: >> A recent, heavily >> publicized case where Sony added copy protection to a product cost >> them sales, and from what I've heard, even legal fees. > I think that's a poor example - the cost hasn't come from the mere act > of adding protection, but the metho

Re: Python obfuscation

2005-11-11 Thread Mike Meyer
"Ben Sizer" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> There are ways to distribute >> Python modules so that the user can't just open them in a text >> editor. There are also ways to get cryptographic security for >> distributed modules. &g

Re: os.chown()

2005-11-11 Thread Mike Meyer
James Colannino <[EMAIL PROTECTED]> writes: > Hey everyone. I tried to use os.chown() in the following manner: > > os.chown('filename', 'username', 'groupname') > > I got an error, and when I googled for this function I realized that I > must pass the numerical uid and gid. My question is, is th

Re: weird problem with os.chmod

2005-11-11 Thread Mike Meyer
James Colannino <[EMAIL PROTECTED]> writes: > James Colannino wrote: > >> So then I entered the command print 0600, and saw that the actual >> number being output was 384 (why would it output 384?!) >> >> > > Ok, so further research revealed that 0600 is actually the octal > representation for 384

Re: changeing users on linux

2005-11-11 Thread Mike Meyer
[EMAIL PROTECTED] writes: > how would i go about makeing a program in python that asks for username > and password and changes to that user? For some definition of "changes to that user": # Untested code from pwd import getpwnam from os import setuid setuid(getpwnam(raw_input("Who do you want to

Re: Python obfuscation

2005-11-11 Thread Mike Meyer
My, we're about to get *seriously* off topic. Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Fri, 11 Nov 2005 11:17:43 -0500, Mike Meyer wrote: >>> I'd just like to make it non-trivial to make or use additional copies. >> How do you do that without infri

Re: Python obfuscation

2005-11-12 Thread Mike Meyer
n > recuperated your costs. If you don't, you probably lost 5 minutes of > development time. Is this a worthwhile gamble? I believe so. And if instead you lose one customer because you've denied them their fair use rights, then your copy protection has lost you more in the form of a c

Re: changeing users on linux

2005-11-12 Thread Mike Meyer
[EMAIL PROTECTED] writes: > the password is for loging into root The setuid call will fail unless you're already root. You can't, as some user other than root, change your userid, so the answer to the original question with the added restriction is "You can't". http://www.

Re: passing values from one form to another

2005-11-12 Thread Mike Meyer
[EMAIL PROTECTED] writes: > In main.py, i am able to check for the value of the user and password > field, eg > > if form.has_key("user") and form["button"].value == "Login" and > form.has_key("password"): > # show all fields > > how can i also check for the user field in the results.py script? i

Re: newbie how do I interpret this?

2005-11-12 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Here's a small session > import re p=re.compile('[a-z]+') m=p.match('abb1a') dir(m) > ['__copy__', '__deepcopy__', 'end', 'expand', 'group', 'groupdict', > 'groups', 'span', 'start'] help(m.groups) > Help on built-in function groups: > > groups(

Re: Python obfuscation

2005-11-12 Thread Mike Meyer
Paul Rubin writes: > "The Eternal Squire" <[EMAIL PROTECTED]> writes: >> Without copyright, how could one possibly earn a living writing a >> novel? > This guy seems to be doing ok: http://craphound.com > His publishers are the only ones allowed to sell his novels comm

Re: Proposal for adding symbols within Python

2005-11-12 Thread Mike Meyer
Pierre Barbier de Reuille <[EMAIL PROTECTED]> writes: > Please, note that I am entirely open for every points on this proposal > (which I do not dare yet to call PEP). > > Abstract > > > This proposal suggests to add symbols into Python. You're also proposing adding a syntax to generate s

Re: Multikey Dict?

2005-11-12 Thread Mike Meyer
David Rasmussen <[EMAIL PROTECTED]> writes: > If I have a collection of dicts like: > john = {'id': 1, 'name': "John Cleese", 'year': 1939} > graham = {'id': 2, 'name': "Graham Chapman", 'year': 1941} > I could store all of them in a list. But for easy lookup, I might > store all these in a dict i

Re: Copyright [was Re: Python obfuscation]

2005-11-12 Thread Mike Meyer
"The Eternal Squire" <[EMAIL PROTECTED]> writes: >>Copyright is a gift granted by the government, not the natural state of >>the world. When kings and emperors and presidents give commercial and >>economic gifts, like monopolies, they rarely are for the benefit of the >>majority. > Last I knew, we

Re: Proposal for adding symbols within Python

2005-11-13 Thread Mike Meyer
Pierre Barbier de Reuille <[EMAIL PROTECTED]> writes: >>>In LISP : Symbols are introduced by "'". "'open" is a symbol. >> No, they're not. "'(a b c)" is *not* a symbol, it's a list. Symbols in >> LISP are just names. "open" is a symbol, but it's normally evaluated. >> The "'" is syntax that keeps t

Re: Copyright

2005-11-13 Thread Mike Meyer
"The Eternal Squire" <[EMAIL PROTECTED]> writes: >>Further, recent evidence is that this is no longer true in that >>country, assuming it ever was. > Wow, how Machiaviellian. Just an observation on the state of the US. It's been a long while since the people running the country did so for the peop

Re: Copyright

2005-11-13 Thread Mike Meyer
Erik Max Francis <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Further, recent evidence is that this is no longer true in that >> country, assuming it ever was. > Oh, please. Take the political crap elsewhere. It's got as much right to be here as the copyright

Re: Addressing the last element of a list

2005-11-14 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-11-10, Mike Meyer schreef <[EMAIL PROTECTED]>: >> [Context recovered from top posting.] >> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >>> Daniel Crespo wrote: >>>> Well, I h

Re: Python obfuscation

2005-11-14 Thread Mike Meyer
"Ben Sizer" <[EMAIL PROTECTED]> writes: >> It is? Is the Python disassembler so much advanced over the state of >> the art of binary disassemblers, then? Or maybe it's the Python >> decompilers that are so advanced? > Decompyle (http://www.crazy-compilers.com/decompyle/ ) claims to be > pretty adva

Re: Addressing the last element of a list

2005-11-15 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >>> Like having an assignment operator (let use @= for it) next to a >>> (re)bind operator. >>> We could then have something like the following. >>> a = 5 >>> b = a >>> a @= 7 >>> b ==> would result in 7. >> You've just overwritten the object referred to by

Re: Python obfuscation

2005-11-15 Thread Mike Meyer
"Ben Sizer" <[EMAIL PROTECTED]> writes: >> But we can be >> explicit if you want: How do you do that without requiring that your >> software be given special consideration in the distaster recovery and >> preparedness planning? > I should state that I am not at all claiming a "one size fits all" >

Re: Default method arguments

2005-11-15 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Hello everybody! > I have little problem: > > class A: > def __init__(self, n): > self.data = n > def f(self, x = ) > print x > > All I want is to make self.data the default argument for self.f(). (I > want to use 'A' class as following : St

Re: Default method arguments

2005-11-15 Thread Mike Meyer
Benji York <[EMAIL PROTECTED]> writes: > I'll add my 2 cents to the mix: > > default = object() > > class A(object): > def __init__(self, n): > self.data = n > > def f(self, x=default): > if x is default: > x = self.data > print x There were a lot

Re: newbie - How do I import automatically?

2005-11-15 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I have written some functions in a file called btools.py. I would like > to import them automatically when I start up Python shell. Today I must > do it by hand like this > from btools import * dir() > ['__builtins__', '__doc__', '__name__', 'func1', 'func2',

Re: Default method arguments

2005-11-15 Thread Mike Meyer
"Gregory Petrosyan" <[EMAIL PROTECTED]> writes: > I'm not very familiar with Python, so please explain me why should > containers be used? > For example in one of Paul Graham's essays there's an example of > 'generator of accumulators' in Python: > > def foo(n): > s = [n] > def bar(i): >

Re: newbie - How do I import automatically?

2005-11-15 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I've tried as you said but it doesn't work. I'm working with Windows > XP. I right click at my computer go to Advanced, choose Environment > Variables and set PYTHONSTARTUP variable to C:\Python24\binit.py. It > looks like this > > # binit.py > from btools import * > > I

Re: Python obfuscation

2005-11-15 Thread Mike Meyer
Erik Max Francis <[EMAIL PROTECTED]> writes: > Chris Mellon wrote: >> I don't know about you, but I own the copyright to almost nothing that >> I have written and been paid for, and further, none of has it's >> copyright exploited to make money for the entity that does own the >> copyright. > But t

Re: Newb ?

2005-11-15 Thread Mike Meyer
"Chad Everett" <[EMAIL PROTECTED]> writes: > print "\n\nWelcome to the Backwards Message Display." > print > message = raw_input("\nPlease Enter a Message.") Since you said it wasn't a school assignment, and I'm a trusting soul, the next line could be: print message[::-1]

Re: Addressing the last element of a list

2005-11-16 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-11-15, Mike Meyer schreef <[EMAIL PROTECTED]>: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >>>>> Like having an assignment operator (let use @= for it) next to a >>>>> (re)bind operat

Re: using openurl to log into Yahoo services

2005-11-16 Thread Mike Meyer
it', intag['value'])) else: print "Login form had unrecognized input tag:", str(intag) out = BeautifulSoup(urlopen(form['action'], urlencode(postdata)).read()) out.done() return out def meta_redirect(value): ""&quo

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