[Tutor] Clash of the Titans and Mundane Matters

2005-01-19 Thread Michael Powe
Clash of the Titans >From "Dive into Python": __init__ is called immediately after an instance of the class is created. It would be tempting but incorrect to call this the constructor of the class. It's tempting, because it looks like a constructor (by convention, __init__ is the first method def

Re: [Tutor] How does import work?

2005-02-01 Thread Michael Janssen
import lapack_lite > ImportError: > /usr/local/lib/python2.3/site-packages/Numeric/lapack_lite.so: undefined > symbol: dgesdd_/ given the fact that I'm no c-programmer this seems to me like a broken c module. I would try to reinstall Numeric/ scipy (After hunting the problem dow

Re: [Tutor] carriage return on windows

2005-02-01 Thread Michael Janssen
;%-30s" % "step: %s" % (i**i) length = len(output) sys.stdout.write(output) # "print output," would be different, because of implizit spaces sys.stdout.write("\033[D"* (length)) sys.stdout.flush() time.sleep(.5) regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter questions

2005-02-02 Thread Michael Lange
> point size You can use any 3-tuple of the form (family, size, weight) as font descriptor; if the requested font is not found, the widget should fall back to some (probably ugly) default; tk guarantees that at least 'times', 'helvetica' and 'courier' fon

Re: [Tutor] i have a question???

2005-02-03 Thread Michael Janssen
ls, which (the number of intervalls) is plain integer. Then translate from current-intervall-number to pi'ish (sorry for that, my english ;-) value. regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] i have a question???

2005-02-03 Thread Michael Janssen
[the problem provided by alieks] > >>"EXERCISE 3.9 > >>Use the math library to write a program to print out > >>the sin and cos of numbers from 0 to 2pi in intervals > >>of pi/6. You will need to use the range() function." [Michael] > > You _can

Re: [Tutor] help with .get in Tkinter

2005-02-20 Thread Michael Lange
ot; (or however this is called) of the entry widget. You surely meant something like this: def go(): contents = e.get() print contents or simply: def go(): print e.get() I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] database programming

2005-02-21 Thread Michael Dunn
make a connection cursor = connection.cursor() # make a database cursor cursor.execute("select * from table1") # send a sql command to the database results = cursor.fetchall() # get a list with the results Cheers, Michael On Mon, 21 Feb 2005 18:42:22 +0800, Chris Mallari <[EMAIL PROTE

[Tutor] UnicodeDecodeError

2005-02-22 Thread Michael Lange
= _('No destination file selected'): UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 22: ordinal not in range(128) ## I've looked into PmwBase.py, but I couldn't fig

Re: [Tutor] How can i use both float and int?

2005-02-22 Thread Michael Dunn
rsion 2.4, you might find that the decimal type is what you need. As I understand it, it allows you to specify the precision of your number, so 1 will be come out as to 1. and not 1.0001 (or whatever). I'm not using 2.4 myself yet, so ask the list if you need examples or explanation.

Re: [Tutor] UnicodeDecodeError

2005-02-23 Thread Michael Lange
if I remove the german .mo file, so gettext uses the english strings. What seems really weird to me here is that it looks like both the translated gettext string and the special characters in my "filename" variable *can* be decoded, but not both at a time - but only under (rare) circumstanc

Re: [Tutor] UnicodeDecodeError

2005-02-23 Thread Michael Lange
ython-Unicode > cognoscenti and it makes your programs non-portable). Do this by creating a > file > site-packages/sitecustomize.py containing the lines > import sys > sys.setdefaultencoding('latin-1') > > Kent > Unfortunately the latter is no option, because I d

[Tutor] Unicode issues (was: UnicodeDecodeError)

2005-02-24 Thread Michael Lange
esult = result.encode(sys.stdin.encoding) result = unicode(result, 'utf-8') to avoid problems with unicode objects that have different encodings - or isn't this necessary at all ? I'm sorry if this is a dumb question, but I'm afraid I'm a complete encoding-idiot. Thanks and best regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Unicode issues

2005-02-24 Thread Michael Lange
On Thu, 24 Feb 2005 07:51:04 -0500 Kent Johnson <[EMAIL PROTECTED]> wrote: > Michael Lange wrote: > > I *thought* I would have to convert the user input which might be any > > encoding back into > > byte string first > > How are you getting the user input? Is

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Michael Dunn
e backslash so that the first line doesn't count. The "fill" and "wrap" functions of textwrap might also interest you: http://www.python.org/doc/2.3.5/lib/module-textwrap.html. Cheers, Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Reading Tutor with gmail: monospace fonts

2005-02-24 Thread Michael Dunn
s), add this snippet, and then select the file from the "Advanced" tab in Safari's Preferences. I don't know about other browsers, but the same sort of thing is almost certainly possible. Cheers, Michael ___ Tutor maillist - Tutor@pytho

Re: [Tutor] Recursive Tkinter buttons

2005-02-25 Thread Michael Lange
7;t help much, because you would probably get an AttributeError, saying something like "Tkinter.Button instance has no attribute 'append'". Even without this AttributeError nothing would be won, because the list's append() method returns None, so you would have: None = B

Re: [Tutor] Recursive Tkinter buttons

2005-02-27 Thread Michael Lange
On Sat, 26 Feb 2005 19:48:25 + Adam Cripps <[EMAIL PROTECTED]> wrote: > On Fri, 25 Feb 2005 12:21:18 +0100, Michael Lange > > > > > You see, in my example above I called the list "buttonlist" instead of > > "button"; maybe this naming

Re: [Tutor] Saving Entry fields in Tkinter

2005-03-01 Thread Michael Lange
g and trailing whitspace's incl. \n > > > In the loop you could perhaps populate the entry-widgets. > > HTH > > Ewald Or use the fileinput module: var_list = [] for line in fileinput.input(filename): var = Tkinter.StringVar() var.set(line) var_list.appe

Re: [Tutor] help

2005-03-07 Thread Michael Lange
Also novice to programming. I cant get the "/a" command to > > work. > > I don't know what the "/a" command is, please give more details. > > I get an elongated 0 in my Python interpreter, but no sound. > Sound? Maybe you meant print "

[Tutor] Using signal handlers

2005-03-08 Thread Michael Lange
I would prefer to have a more controlled exit, but as soon as I define a custom signal handler it's the same as before - it never gets called. Any help is much appreciated Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] stopping greedy matches

2005-03-17 Thread Michael Dunn
As Kent said, redemo.py is a script that you run (e.g. from the command line), rather than something to import into the python interpretor. On my OSX machine it's located in the directory: /Applications/MacPython-2.3/Extras/Tools/scripts Cheers, Mi

Re: [Tutor] Changing Keyboard output

2005-03-20 Thread Michael Lange
insert('insert', 't') return 'break' e.bind('', PtoT) the "return 'break'" statement prevents the event from being propagated to Tk's standard event handler; without it both "p" and "t" would be inserted in

Re: [Tutor] Python cgi doesn't get data from html form as expected

2005-03-22 Thread Michael Lasky
rogramming/feature_5min_python.html Hope that helps. Best Regards, Michael Lasky On Tue, 2005-03-22 at 14:02 +, Vicki Stanfield wrote: > I have recently started doing cgi in Python and have run into a problem. I > have an html form which has various widgets which accept data. I also have >

Re: [Tutor] Defining functions

2005-03-24 Thread Michael Dunn
Hi John, when you want user input, you almost always need raw_input(), not input(). Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Defining functions

2005-03-25 Thread Michael Dunn
to forget about input(). But if you really needed the current input() function, isn't eval(raw_input()) the same thing? And it leaves you space to check the input string for anything stupid or dangerous before you feed it to eval(). Perplexed, Michael __

Re: [Tutor] Tkinter and keyboard output

2005-03-25 Thread Michael Lange
ch would allow the code to determine which 'Key' was pressed > after Alt? > > Thank you. > Igor Do you mean something like this: >>> from Tkinter import * >>> r=Tk() >>> t=Text(r) >>> t.pack() >>> >>> def test(

Re: [Tutor] wxPython / Tkinter Grid

2005-04-01 Thread Michael Lange
rching on the Vaults of Parnassus or on the > ActiveState site if you are determined to try Tkinter... > > Alan G. > Or look here: http://tkinter.unpythonic.net/wiki/Widgets There is a number of links to table widget implementations in Tkinter o nthe wiki page. I hope t

Re: [Tutor] using the enter key

2005-04-05 Thread Michael Lange
rs the widget) and that the callback gets an event instance passed, so the function definition has to look like this: def submit(event): (...) I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] using the enter key

2005-04-07 Thread Michael Lange
ommand and as event handler for the entry, it needs an optional event instance as argument: def submit(self, event=None): (...) because the button's "command" doesn't pass an event to the callback, but the entry's event handler does. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Entry widgets

2005-04-10 Thread Michael Lange
t widget would be preferable? > If you just want one line to enter a number, I don't think so. > Also - how do I set the insertion symbol there already, so I don't need to > click there to enter the number? > You can use focus_set(): e = Entry(

Re: [Tutor] UselessPython 2.0

2005-04-11 Thread Michael Janssen
> if s1[index] in string.ascii_lowercase: > s2 += s1[index] or easier (much more readable, helps understanding the programm): for char in s1: if char in string.ascii_lowercase: s2 += char regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] UselessPython 2.0

2005-04-11 Thread Michael Janssen
On Apr 11, 2005 7:30 PM, Michael Janssen <[EMAIL PROTECTED]> wrote: > [what's bad about non-alphabetic characters?] I found it out for myself. To quote from Dick's post: "A man, a plan, a canal, Panama!" Seems like palindromes are allowed not to reflect whitespace

Re: [Tutor] Problems with encodings

2005-04-18 Thread Michael Lange
know a solution. I don't mind if I have to write only ASCII but I'm > not the only user for that tool, so... > Hi Olli, does it help if you change the second line into: # -*- coding: iso-8859-15 -*- ? I *think* that is the correct syntax (at least it works for me). Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] TKinter and things over Linux

2005-04-18 Thread Michael Lange
sic python RPM will be installed by default on RedHat 9 but probably not Tkinter ( I'm not sure how the RPM is called on RedHat, maybe python-tkinter or python-tk or tkinter or... ). Best regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] using TK to view an image and then close the window

2005-04-25 Thread Michael Lange
ve to > display them > > import glob > import thread > import Image > > import TKviewTest # the module to view the images > > > gifList = glob.glob("./*.gif") > print gifList > for image in gifList: >image = image[2:] # glob leaves ./ in file name > >newIm= Image.open(image) > >TK = TKviewTest >thread.start_new_thread(TK.TKview(newIm,mainTitle="image")) > > I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Re: Tkinter and Animation

2005-04-27 Thread Michael Lange
might come close to the kind of animation you want. It's probably tricky, but I think it's possible. Best regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter and Animation

2005-05-02 Thread Michael Lange
lf.update_idletasks() self.start() def test(): root = Tk() f = AnimatedFrame(root, width=300, height=300) f.pack() root.mainloop() if __name__ == '__main__': test() # I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] total newbie

2005-05-11 Thread Michael Cole
WARNING: TOTAL NEWBIE QUESTION BELOW   Had to warn ya, I just finished reading a book on learning python for beginners and decided to write a small game program as an exercise. The game I wrote was breakout (in case you dont know it, its a very simple game where there is several rows of brick

Re: [Tutor] help me on python + snack

2005-05-18 Thread Michael Lange
und = tkSnack.Sound(file='xyz.mp3') > #mysound.read() > mysound.play() > if __name__=='__main__': > main() > I works fine without any error but can't get any > sound. > > So friend help me, I don't know whats wroung with my > code. >

Re: [Tutor] finding path to resource files in a GUI application

2005-06-09 Thread Michael Lange
irectory of your main program file, with os.path.abspath() you can get rid of the "../../" stuff at the beginning of the path if the program is called from a link. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Buttons automatically executing

2005-06-15 Thread Michael Lange
need to keep a reference to the Button object you need to split the above into two statements: b1 = Button(can, ) b1.grid() If you don't need a reference you can simply do: Button(can,).grid(row=0,column=0) without creating a (quite useless) variable. I hope this helps Michael __

Re: [Tutor] Process problem

2005-06-16 Thread Michael Lange
, I think adding a "&" to the command to make it run in the background should do the trick. Best regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] (no subject)

2005-07-06 Thread Michael Huster
Desktop\myFile','r') I don't want to drill into c:\Documents and Setting\... because the user name is often obscure AND not all desktop files appear in the same subdir. of that. For example some are in 'All Users" or 'Default User'. Michael Huster, Si

[Tutor] Finding Desktop Files

2005-07-06 Thread Michael Huster
fp = open(r'c:\Windows\Desktop\myFile','r') I don't want to drill into c:\Documents and Setting\... because the user name is often obscure AND not all desktop files appear in the same subdir. of that. For example some are in 'All Users" or 'Default User&

[Tutor] Adding attributes to imported class

2005-07-06 Thread Michael Lange
on, is this a common way to add new attributes to existing classes or is it possible that this causes problems that I don't see at the moment? Thanks in advance Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Adding attributes to imported class

2005-07-07 Thread Michael Lange
On Thu, 07 Jul 2005 11:03:00 +1200 (NZST) [EMAIL PROTECTED] wrote: > Quoting Michael Lange <[EMAIL PROTECTED]>: > > > I'm trying to write a python wrapper for the tkDnD Tk extension to add > > drag and drop support > > Hi Michael, > > Just a side iss

Re: [Tutor] Tkinter Q's

2005-07-12 Thread Michael Lange
regular Tk() : root = Main() root.mainloop() And for something completely different: be careful mixing pack(side = LEFT / RIGHT) with pack(side = BOTTOM / TOP), you might not get the results you expected. For complex layouts you are probably better off using grid() ( or you will find that you ha

Re: [Tutor] Tkinter Q's

2005-07-13 Thread Michael Lange
#x27;config' > Just a guess: a common mistake among Tkinter beginners is: mylabel = Label(parent, text="Hello").pack() The problem here is, because pack() returns None you don't have a reference to the Label, but set the "mylabel" variable to No

Re: [Tutor] Tk -- which label clicked

2005-07-15 Thread Michael Lange
7;<1>', lambda event, t=text: callback(t)) or use event.widget to determine which label was clicked: def callback(event): print event.widget['text'] for text in ('foo', 'bar', 'baz'): lb = Label(master, text=text) lb.pack() lb.bind('<1>', callback) I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] HTML links from Tkinter

2005-07-15 Thread Michael Lange
ter table widgets (I have not tried any of these though): <http://tkinter.unpythonic.net/wiki/Widgets> Regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tk -- which label clicked

2005-07-15 Thread Michael Lange
On Fri, 15 Jul 2005 23:29:22 +1200 (NZST) [EMAIL PROTECTED] wrote: > Quoting Michael Lange <[EMAIL PROTECTED]>: > > > I don't think it will work this way, because you don't catch the event > > bind() passes to the callback > > (you also use a variable

Re: [Tutor] ListBox in Tkinter

2005-07-19 Thread Michael Lange
n" arrow buttons), the PanedWindow , which lets you dynamically add resizable frames and the LabelFrame, a Frame with a decorative border and a Label in one of its corners. Regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] This should be easy

2005-07-19 Thread Michael Dunn
I'm not sure why your first example worked: "Table" is a reserved word in SQL (i.e. it's used as a SQL command), so you shouldn't use it as a table name. Imagine a poor dumb computer trying to parse "create table table"... Cheers, Michael __

Re: [Tutor] Scrolling multilistbox help

2005-07-19 Thread Michael Lange
ction()[0])) where l is the first of the listboxes; this should make sure the selected item is visible (at least if you use selectmode=SINGLE). If keeping all lists in sync works, this should be enough to scroll all other lists, too (like I said, untested though). I hope this helps Michael >

Re: [Tutor] Tkinter event for changing OptionMenu items

2005-07-21 Thread Michael Lange
u (not very much tested though): oOptionMenu['menu'].bind('', getTableColumns) Otherwise you would probably have to call oOptionMenu['menu'].entryconfigure(command=...) on all menu entries. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter event for changing OptionMenu items

2005-07-23 Thread Michael Lange
On Thu, 21 Jul 2005 14:16:05 -0400 Bernard Lebel <[EMAIL PROTECTED]> wrote: > Hi Michael, > > Let say I have a MenuOption, that consists of 3 items. This MenuOption > sits on top of the Tkinter window. > > In the lower part, I have a bunch of widgets (text fields). When

Re: [Tutor] redirecting output to logfile and logrotate

2005-07-24 Thread Michael Janssen
27;s normal to configure syslogd and logrotate for a sysadmin user...). regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Custom metaclass?

2007-04-19 Thread Michael Hannon
etattr__ = no_new_attributes(type.__setattr__) (Beware line breaks introduced by email software.) Finally, my question: can somebody enlighten me as to how and why the "custom metaclass", class __metaclass__(type): does something useful? Thanks.

Re: [Tutor] Tkinter import error

2007-04-24 Thread Michael Lange
m with Tkinter configured already, that should be pretty > easy. Usually there is no need to pass extra arguments to configure. My guess is that you missed to install Tcl / Tk and/or the Tcl/Tk development packages before compiling python. Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] python exercises

2007-05-30 Thread Michael Revelle
g Python Programming for the Absolute Beginner by Michael Dawson . -- Michael Revelle ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] looking for some general advice

2007-06-10 Thread Michael Klier
/071ce76105.html Maybe someone likes to have a quick look at it. Thanks in advance for all feedback. Michael -- Michael Klier signature.asc Description: Digital signature ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] looking for some general advice

2007-06-10 Thread Michael Klier
te of python knowledge right now. > Othewise I don't see too much to complain about. > > Well done, a good first program. Thank you, and thanks for the reply. Regards Michael -- Michael Klier signature.asc Description: Digital signature ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] looking for some general advice

2007-06-11 Thread Michael Klier
m not so sure > that works for argv... I think a simple usage message and > exit with non zero is fine. Well, that`s an option I didn`t thought of yet, I think I`ll do it that way then. Thanks or all your feedback. Best Regards Michael -- Michael Klier signature.asc Description: Digi

Re: [Tutor] Off-Topic - Mutt and mailing lists

2007-06-11 Thread Michael Klier
Simon Hooper wrote: > Hi Michael, > > * On 11/06/07, Michael Klier wrote: > > Alan Gauld wrote: > > > I'm not surecwhy but your messages are coming through to me > > > as text attachments which makes quoting them tricky... > > > > Hmmm, I did

Re: [Tutor] (no subject)

2007-06-29 Thread Michael Sullivan
On Fri, 2007-06-29 at 09:54 -0400, Jason Bertrand wrote: > Please remove me from the mailing list. > > Thank you > > Jason P Bertrand > JPB Enterprises > www.businessloansandleasing.com > (860) 982-5334 No one can do that except you. Look at the list headers to see how. __

Re: [Tutor] How can I escape a pound symbol in my script?

2007-07-06 Thread Michael Connors
ely I'd have thought would be "sharp" as in music notation, which is where, I think, it originated. And this is really off-topic now! :-) Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question regarding syntax

2007-07-11 Thread Michael Klier
thon gettext docs [1] use it that way. [1] http://docs.python.org/lib/node732.html Kind Regards Michael -- Michael Klier mail: [EMAIL PROTECTED] www:http://www.chimeric.de icq:206179334 jabber: [EMAIL PROTECTED] key:http://downloads.chimeric.de/chi.asc key-id: 0x8308F55

[Tutor] python syntax: underscore

2007-07-12 Thread Michael Connors
t _ 4 So if I do this, _ = 10 4 4 print _ 10 What is this _ used for? If I assign something to the underscore, will it cause strange things to happen later? (Just curiosity) Regards, -- Michael ___ Tutor maillist - Tutor@python.org http://mail.

Re: [Tutor] Generators

2007-07-24 Thread Michael Sparks
ue" you get the same behaviour - python detects an immutable object in the condition and optimises it: >>> dis.dis(compile('while "True": pass', '', 'exec')) 1 0 SETUP_LOOP 3 (to 6) >>3 JUMP_ABSOLUTE

Re: [Tutor] Losing the expressiveness ofC'sfor-sta tement?/RESENDwith example

2007-08-10 Thread Michael Sparks
text is a naturally harsh medium, and also cultural norms are very different for different posters. One man's polite behaviour is another man's gravest insult. No one means to be rude, so it's worth remembering that. (And yes, I know, merely saying that can be considered rude

Re: [Tutor] Simple way to compare Two lists

2007-08-10 Thread Michael Sparks
le. Which is things is quickest will depend heavily on the likely structure of the data, likelihood of duplicate, ordering and likely similarities between data. Overall though you have two choices: * Exploit your knowledge of the distribution and ordering of values * Use psyco These aren&#x

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Michael Sparks
n where raw_input runs, this strikes me as highly unrealistic/unlikely. Why? Because if they can type on the keyboard of a machine that's running raw_input they have the ability to do far more damage that way than any other. (ability to use a re

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Michael Sparks
They could even write their own scripts to assist them in their devilish plans too, far exceeding the minor demon of eval ;-) Eval can however be an amazingly useful function, especially when combined with exec. Michael. ___ Tutor ma

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Michael Sparks
xious IMO. "Gosh, the person at the console might be able to get python do something which they can do anyway". (This is rather distinct from taking random crap from someone not on the local console and just doing it (eg from a network connection/external resource))

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-14 Thread Michael Sparks
sks where you are. > But if you parse a text file that you haven't reviewed... that's possible. Gosh, another completely different context, wonder if its relevant ;) In case you've missed it: * Rule: eval is for the majority of uses a potentially gaping security hole * Exception proving rule: eval based on user input of a user sitting at the keyboard able to run programs cf code with the form: eval(raw_input( ...)) where that user can run arbitrary programs on the machine. (which they normally would be able to if they can interact with "raw_input"). Code is never a security risk. Code in context almost always has a security risk. The level of risk has to be weighed against other risks. If the user can trash a machine because they're physically preset, what they type in an eval loop is the least of your worries. Michael. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-14 Thread Michael Sparks
k eggs is irritating. I've been evaluating security of network systems for 10 years and coding for 25 years. After all piece of code is never a security risk by itself. It's how that code is deployed and used that _can_ be. Michael. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] subprocess and su

2007-08-22 Thread Michael Meier
ou'd have to open a pseudo terminal: have a look at the pty module. cheers, Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python / CGI

2007-09-06 Thread Michael Connors
Hi, If you have your own server to run it on, I think it would make sense to use one of the Python web frameworks that are out there. I used cherrypy for my first web-based python project and I found it very easy to learn and develop in quickly. Regards, Michael On 06/09/07, Fiyawerx <[EM

Re: [Tutor] Problem with while loop

2007-09-07 Thread Michael Connors
You could use string formatting to output all pin numbers as 4 character strings. http://docs.python.org/lib/typesseq-strings.html On 07/09/2007, matte <[EMAIL PROTECTED]> wrote: > > Perfect... > > Thanks very much for your help... > > On 9/7/07, Michael Connors &

Re: [Tutor] Problem with while loop

2007-09-07 Thread Michael Connors
ing ? > > -m > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Michael Connors ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problem with while loop

2007-09-10 Thread Michael Connors
ot; ) > if pinPattern.match(howmany): > while counter < int(howmany): > pin = randint(,) > print pin > counter += 1 > else: > print "%s is not valid 4 digit integer"%howmany > > > -vishnuMohan > -- Michael Connors ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] calling class instances in functions

2007-09-12 Thread Michael Langford
newMicrobe = cls() #Now you find where they wish to drop it in the world print "Where do you want it in the world?" rawCoords = raw_input() #parse out the x and y # # Left to the reader to parse out # myWorld.insertAt(newMicrobe,x,y) #assuming you made a class for the world -

Re: [Tutor] Killing an instance

2007-09-13 Thread Michael Langford
ass that removes all the tokens that are life==0. I'd make a method in the cell like isDead(). The reap function for the world will remove all cells that isDead()==True. This is a better approach when your cells don't do very much more than they already do. --Michael On 9/13/07

Re: [Tutor] deleting one line in multiple files

2007-09-14 Thread Michael Langford
Sed is a little easier than python for this project, but python is more flexible. Sed would be sed -e "s/^.*\

Re: [Tutor] remove blank list items

2007-09-14 Thread Michael Langford
t.icq.com > chat.icq.com > chat.icq.com > > > labs.icq.com > download.icq.com > greetings.icq.com > greetings.icq.com > greetings.icq.com > games.icq.com > games.icq.com > > ------ > Get free emoticon packs and customisation from Wind

Re: [Tutor] remove blank list items

2007-09-15 Thread Michael Langford
You can use it quite readily without knowing every api of every module or every keyword. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/15/07, Luke Paireepinart <[EMAIL PROTEC

Re: [Tutor] referencing vars()

2007-09-15 Thread Michael Langford
trying to do the above, but of course get an error because vardict is > only referencing vars(), thus changes size... also, I tried > vardict=[vars()], but this fails as well?? > > Suggestions? > > > > _______ > Tutor maill

Re: [Tutor] Adding a GUI

2007-09-16 Thread Michael Langford
you'll need a book to use pythoncard. Its about as easy as VB to build a form with the WYSIWYG, and very pythonic to use the forms you've built. To get up an going, install a compatible version of wxPython use this link: http://pythoncard.sourceforge.net/walkthrough1.html

Re: [Tutor] Xml reference

2007-09-17 Thread Michael Langford
I've found Python Cookbook to be a good, modern resource for parsing as well as tricks for remote pages. Link at amazon: *http://tinyurl.com/2njsd9 --Michael Original url: http://www.amazon.com/gp/product/0596007973/102-1641864-7294551?ie=UTF8&tag=rowlab-20&linkCode=

Re: [Tutor] When to use a class

2007-09-17 Thread Michael Langford
apps. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/17/07, Eric Lake <[EMAIL PROTECTED]> wrote: > > I am still trying to understand when to use a class and when not

Re: [Tutor] Finding all the letters in a string?

2007-09-17 Thread Michael Langford
At first I totally misread this To get the set of letters, use import string string.ascii_letters Then do what you said in your algorithm. A shorthand way to do that is filteredString = ''.join([c for c in foo if c in string.ascii_letters]) -- Michael Langford Phone: 40

Re: [Tutor] Finding all the letters in a string?

2007-09-17 Thread Michael Langford
Not my night...the second sentence "To get the set of letters, use" should read "To get the filtered string".time for more Coke Zero. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com

Re: [Tutor] Finding all the letters in a string?

2007-09-17 Thread Michael Langford
amp;^TUHKLJDHFKJHS(*&987") Which would produce: afdlkjaljrokjlkjTUHKLJDHFKJHS --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/17/07, Michael Langford <[EMAIL PROTECTED]> wrote: > > The

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-18 Thread Michael Langford
classes. C++ has large issues for historical reasons on this front, as the implementation section of a class is largely revealed through the class definition. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirector

Re: [Tutor] sales tax

2007-09-18 Thread Michael Langford
This function can easily found using the google programming rule: I want a function that does 'action' Type: into google Look in top 5 results. If that doesn't work, try synonyms for 'action' --Michael PS: The function you're looking for is called round.

Re: [Tutor] sales tax

2007-09-18 Thread Michael Langford
.sourceforge.net/ is a project that implements it. I don't seem to see fixed point numbers in the python standard libraries, but then again, I'd not be surprised if they were there. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOne

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-19 Thread Michael Langford
ut the bathroom sink and a bidet too). --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/19/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Ric

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-19 Thread Michael Langford
won't have the whole picture either. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/19/07, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > > Michael Langford wrote:

Re: [Tutor] Finding prime numbers

2007-09-19 Thread Michael Langford
Attachments are a bad thing to send to open mailing lists in general. In your case, the list appears to have filtered off the code. Please paste it in inline. --Michael On 9/19/07, Boykie Mackay <[EMAIL PROTECTED]> wrote: > > Hi Guys, > > Could you please look over

<    1   2   3   4   5   6   7   8   9   >