Re: [Tutor] application with tabs

2010-05-15 Thread Alan Gauld
"Luke Paireepinart" wrote in message And a new TKGui builder that includes support for Python - I haven't tried this yet... http://puretkgui.sourceforge.net/ I've now had a play and it looks promising but does not currently support Tkinter - option is greyed out. It is still at version 0.10

Re: [Tutor] ttk printing (was Re: application with tabs)

2010-05-15 Thread ALAN GAULD
needed I agree. Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ From: Steve Willoughby To: Alan Gauld Cc: tutor@python.org Sent: Saturday, 15 May, 2010 19:24:29 Subject: ttk printing (was Re: [Tutor] application with tabs) I've

Re: [Tutor] ttk printing (was Re: application with tabs)

2010-05-15 Thread Alan Gauld
"ALAN GAULD" wrote For most of my GUI needs printing is rarely an issue and if I do need to print I generate an HTML document I meant to add that this is similar to the traditional way of priniting in Unix which was to generate a [gnt]roff document and then send it to print via

Re: [Tutor] ttk printing (was Re: application with tabs)

2010-05-15 Thread ALAN GAULD
> > HTML is the modern equivalent to troff... > > Yeah, but like troff, it's wholly inadequate for a lot of applications, Well at least with troff you can do arbitrarily complex graphics etc (albeit with great difficulty using pic!) but in HTML you are much more limited and often have to resort

Re: [Tutor] Help

2010-05-15 Thread Alan Gauld
considered sorted? What is the sorting criteria? It is not obvious to me! -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription opt

Re: [Tutor] updating python on a mac

2010-05-16 Thread Alan Gauld
If so you probably need to edit your ~/.profile or ~/.bashrc or ~/.cshrc depending which shell you use. HTH -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change su

Re: [Tutor] Trying to get this to work - attached is the source code

2010-05-17 Thread Alan Gauld
acing will be all messed up and it won't look right. Could that be the problem? -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ Peter --- Hello, I am at the ve

Re: [Tutor] PYTHON 3.1

2010-05-18 Thread Alan Gauld
f and send it here every time something breaks. Read the documents first so you know what to expect. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk ___ Tutor maillist - Tutor@python.org To unsubscribe or change su

Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread Alan Gauld
t does not cover break/continue because they are not really necessary to write programs, simply convenience features so I don't cover them till much later. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor mai

Re: [Tutor] Fwd: Learning python using Michael Dawson's book

2010-05-19 Thread Alan Gauld
I thought I had posted a reply on this but I don't see it in the archive... You should make sure your font is set to a mono-spaced variety for this kind of thing otherwise it gets very difficult to align everything... -- Alan Gauld Author of the Learn to Program web site http://www

Re: [Tutor] SetTopWindow

2010-05-19 Thread Alan Gauld
historical accidents that creep into programming languages. Learn to love them! :-) HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-21 Thread Alan Gauld
"Neven Gorsic" wrote I run into Python error in rounding and not know how to predict when it will occur in order to prevent wrong result. It depends how you define wrong. When I was at scvhool the rules f or rounding decimals said that if it ended in 5 you rounded to the nearest even digit.

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-21 Thread Alan Gauld
"Neven Goršić" wrote It's pity that Python has such unreliable functions so you never know in advanced when you will hit new one ... The functions are not unreliable. That would imply they give out unpredictable answers. In fact the answers are completely predictable and consistent and correc

Re: [Tutor] writing csv files

2010-05-22 Thread Alan Gauld
"prasad rao" wrote I got a problem writing csv file. I can't help with that specifically but... for x in csvr: ...y=lambda x: ''.join([x.split()[3],x.split()[-3],x.split()[-6]]) ...csvw.write(y) lambdas are intended for anonymous functions so if you are not going to pass the la

Re: [Tutor] class methods: using class vars as args?

2010-05-23 Thread Alan Gauld
defArg = 42 def __init__(self, arg1, arg2): self.arg1=arg1 def doSomething(self, arg3=defArg): ... HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk ___ Tutor maillist - Tutor@python.org To unsubscribe o

Re: [Tutor] i need help with a code

2010-05-24 Thread Alan Gauld
Else If choice == 5 Then Display "Goodbye!" Else Display "Invalid input - please try again." End If End While -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] PYTHON 3.1

2010-05-24 Thread ALAN GAULD
> Well, I'd use the raw_input function instead of the input function. input is raw_input in Python 3.1. raw_input doesn't exist. Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailm

Re: [Tutor] problem with cherrypy

2010-05-24 Thread Alan Gauld
"Rayon" wrote I am trying to get and set some session variables in ram with cherrypy Here is my code: import cherrypy #cherry.session.get('user') #cherry.session.get('password') You import cherrypy but you use cherry? Should it maybe be: cherrypy.session? or maybe even cherrypy.cherr

Re: [Tutor] circular looping

2010-05-24 Thread Alan Gauld
trick to get cyclic indices is to use the mod operator with the length of the list (and maybe adding a constant) So L = "RNLCM" y = 0 -> (y+1) % len(L) -> 1 y = 1 -> 2 ... y = 4 -> 0 y = 5 -> 1

Re: [Tutor] Program_to_catch_changes_in_webpage

2010-05-27 Thread Alan Gauld
? I suspect the second option is easier, but could make you unpopular with the admin team! HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscriptio

Re: [Tutor] Recursion - Beginner

2010-05-28 Thread Alan Gauld
call of glee. From there its a short step to tracing the return values etc. Also, I'm not really sure what a question like this is asking... getLeaves ( jenny ) [5,3,0,9] getLeaves ( joshua ) [15,17,19,11,13] Me neither - I don't even see a question?! BTW My tutorial has a

Re: [Tutor] Homework Problem

2010-05-29 Thread Alan Gauld
ursion, map and filter. Now what do you not understand? What have you tried? FWIW My tutorial covers map and filter in the "Functional Programming" topic. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___

Re: [Tutor] class methods as static methods?

2010-05-30 Thread Alan Gauld
and manage than instanceless classes! HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] SENTINEL, & more

2010-05-30 Thread Alan Gauld
e same reason as Python names don't work.) But even with static vars you can have multiple references to the static object so it breaks down again... -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillis

Re: [Tutor] playing game across internet: suggestions for design?

2010-05-31 Thread Alan Gauld
ignificant in size - lots of commands - its best to define the message strings as constants in a shared module that both client and server can read. Python's string formatting characters make a useful templating language. HTH, -- Alan Gauld Author of the Learn to Program web site http://w

Re: [Tutor] playing game across internet: suggestions for design?

2010-06-01 Thread Alan Gauld
"Alex Hall" wrote Actually since there are only two players in Battleships you could dispense with a server and do a peer to peer game. When you say 'peer to peer', is this still with Python sockets? It sounds like what I am looking for! Yes, it just means both participants use the same pro

Re: [Tutor] OOP clarification needed

2010-06-01 Thread Alan Gauld
ind of object was passed into viewer. As the comment says this could be the top level window Tk or a generic Frame container or the default Toplevel. So long as the new object supports all the methods that will be invoked Python doesn't care. This is poly

Re: [Tutor] Generating Birthdays

2010-06-01 Thread Alan Gauld
uot;? What makes it different to a random date? And do you know how to generate randomness in your programs? -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or cha

Re: [Tutor] Misc question about scoping

2010-06-03 Thread Alan Gauld
side the function. If the assignment is inside a function and the definition of isThumbnail is outside then you need to use global. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.o

Re: [Tutor] parse text file

2010-06-03 Thread Alan Gauld
nly applies to text. So it may be the same result as using read() Try looping using read(n) where n is some buffer size (1024 might be a good value?). HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maill

Re: [Tutor] sockets, servers, clients, broadcasts...?

2010-06-03 Thread Alan Gauld
ustrating and confusing tangle of Socket objects and low-level calls, Get the basics first. You still need to work out your command protocol to play the game. That will be challenging enough to start with. HTH, -- Alan Gauld Author of the Learn to

[Tutor] Fw: Misc question about scoping

2010-06-03 Thread ALAN GAULD
; list,dict, or whatever outside of if/while/for in block to use later. So, >> I'm cleaning those places up. >> >> For example, my present code looks like: >> L = [] # Needed or L doesn't exist outside of for loop below >> for o in a: >

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Alan Gauld
rily complicated and verbose way of doing a simple assignment, In the case of an equality test I agree. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe o

Re: [Tutor] Misc question about scoping

2010-06-04 Thread ALAN GAULD
> > flag = True if (someValue or another) else False > > > I'd prefer the form: > >flag = not not (someValue or another) Eek! no I'd just cast to a bool: flag = bool(someValue or another) but the if/else form has the Pythonic virtue of explicitness. Alan G. __

Re: [Tutor] sockets, servers, clients, broadcasts...?

2010-06-04 Thread Alan Gauld
eads but services two separate clients without lockup. (Albeit it doesn't care about context...) -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscript

Re: [Tutor] Misc question about scoping

2010-06-04 Thread ALAN GAULD
> Are you arguing that the if/else form is better than simply casting > to bool because it is more explicit? No, I'm simply offering a reason to use if/else in the general sense. In practice, for this specific case, I'd go with the bool(expr) form. Alan Gauld Author of the

Re: [Tutor] sockets, servers, clients, broadcasts...?

2010-06-04 Thread ALAN GAULD
> Look at the example in my tutorial. It doesn't use threads but What is the link for the tutorial? In my sig. Go to the V2 version and look for the Network Programming topic. > what is a context? I dealt with them a lot in Android programming Nothing to do with Android contexts I'm simply u

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Alan Gauld
n you have something that works but looks a mess... rethink it for Lisp and see what's different. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subs

Re: [Tutor] Misc question about scoping

2010-06-05 Thread ALAN GAULD
sper then moved to the Seasoned Schemer. There is a third volume, The Reasoned Schemer, which I also have but I haven't even opened it yet... Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@pyth

Re: [Tutor] JS for location detection

2010-06-06 Thread Alan Gauld
"Gaurav Kalra" wrote The list was suggested to me by a friend and he said that it's for General Programming discussions as well. Am sorry if I broke the laws of the list. But since I have already posted, if anyone up here is with a solution; please PM me. It is for general programming dis

Re: [Tutor] while loops causing python.exe to crash on windows

2010-06-07 Thread Alan Gauld
f you are doing any significant GUI work in wxPython it will be helpful to buy the wxPython in Action book. It is very clear and includes examples of using Timers etc. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tut

Re: [Tutor] Tkinter - master attribute

2010-06-08 Thread Alan Gauld
sentially arbitrary and follows the usual Python naming conventions. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Removing an archived message

2010-06-09 Thread Alan Gauld
I tried to send a reply to you directly but my mail server errors on your gmail account. Can you please reply to me directly (preferably from another account!) and I'll see what can be done. Alan G. List Moderator "Eddie" wrote in message news:aanlktilszazlhrymmaui3p1qjuzvufcyo085rbip6...@mai

Re: [Tutor] Looking for duplicates within a list

2010-06-11 Thread Alan Gauld
ount(item)) for item in mylist if mylist.count(item) > 1) Seems to work... HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread ALAN GAULD
> > counts = > > set(( item, mylist.count(item)) for item in mylist if mylist.count(item) > > Whee, this is great! I learned a lot today. I should have added that although thats a one liner in code terms it does involve iterating over the list twice - in count() - for each element. So it

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread Alan Gauld
tem in set(List): n = List.count(item) if n > 1: print item, n which is still pretty clear. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] Python a substitute/alternative for PhP?

2010-06-12 Thread Alan Gauld
superior to PHP - but less widely supported on ISP servers. I mean, can I start learning python by trying to do the things I've learned with PHP? You can, but the web elements will be very different. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] New to Programming

2010-06-12 Thread Alan Gauld
ut even if you branch out to others the principles you learn in Python will translate easily. There are a bunch of tutorials for absiolute beginners listed on the Python web site (including mine) Try here (or follow my .sig): http://wiki.python.org/moin/BeginnersGuide/NonProgrammers -- Alan Ga

Re: [Tutor] Better construct? (was no subject)

2010-06-12 Thread Alan Gauld
ction name. (Unless these are factory functions returning another function but I don't think that was the intent! :-) funcs = (doSomething, doSomethingElse) for func in funcs: getid() func() HTH, -- Alan Gauld Author of the Learn to Program web site http://w

Re: [Tutor] Adding line numbers to a Python Script

2010-06-12 Thread Alan Gauld
- What does '%2" mean ? - Is that 2 cursor spaces of width ? Close but again Read the docs, try it, experiment. See for yourself. "%2i" % 7 HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _

Re: [Tutor] Tutor Digest, Vol 76, Issue 31

2010-06-12 Thread Alan Gauld
Please do not send the entire digest when replying rto a single email. Use your editor to remove the redundant material. "saurabh agrawal" wrote You can use method name count in list also for getting the repeats. #!/usr/bin/python li=[1,2,3,1,4,5,7,3,4,1] for i in range(l

Re: [Tutor] Problems with Importing into the Python Shell

2010-06-12 Thread Alan Gauld
ings with the same name. It is better to use import foo and then use foo.name to access things. It is more typing but much safer and more reliable. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor ma

Re: [Tutor] large file

2010-06-13 Thread Alan Gauld
le in the file handling topic of my tutorial... HTH -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Better construct?

2010-06-14 Thread Alan Gauld
"Advertising Department" wrote repeat WHILE is exactly what I needed. I got BASIC stuck in my head. GOTO line# YUCK! BASIC has a WHILE/WEND construct too :-) Even GW Basic supported that. Alan G. ___ Tutor maillist - Tutor@python.org To unsub

Re: [Tutor] Structuring a class

2010-06-15 Thread Alan Gauld
a database is a better bet. You mght still create a Student class to structure the data coming back from the database but the other classes will probably be overkill and your double dict will be as effective. HTH, -- Alan Gauld Author of the Learn to Program web site http://w

Re: [Tutor] conventions for establishing and saving default values forvariables

2010-06-15 Thread Alan Gauld
h an ini/resource file in the users home directory as being the most consistent and simplest solution. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe o

Re: [Tutor] Tkinter - master attribute

2010-06-15 Thread ALAN GAULD
> I still am having trouble understanding the use of "master" in > Tkinter. I think the problem is I can't find any reference that explains the > concept around master, If you read the GUI topic in my tutorial it explains the concept of a containment tree that is common to ost GUI frameworks

Re: [Tutor] conventions for establishing and saving default valuesfor variables

2010-06-16 Thread Alan Gauld
ts to the users Settings folder. Effectively their home directory in unix terms, so you could store the config file there. But you couldn't store the kind of data you would store in the registry? I'm confused. -- Alan Gauld Author of the Learn to Program web sit

Re: [Tutor] How to model objects aimed to persistence?

2010-06-16 Thread Alan Gauld
hen to anyone who imports your code... -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to model objects aimed to persistence?

2010-06-17 Thread Alan Gauld
don;t need the references, you can just pickle the list of objects, or whatever. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Importing files not located on the home directory orstandardard library

2010-06-17 Thread Alan Gauld
g the PATH variable (You do the same but for PYTHONPATH, the only difference is you might need to create it if it doesn't already exist!) Otherwise, Where are you having problems? -- Alan Gauld Author of the Learn to Program web site http://w

Re: [Tutor] sqlite3 select extra characters

2010-06-18 Thread Alan Gauld
Cleese, John It seems a shame to have to run the answers through a stip process. It's hardly a major effort to index the item? print name[0] instead of print name HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] pydoc?

2010-06-18 Thread Alan Gauld
detailed instructions and links to some help info in the "Getting Started" topic of my tutorial. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To uns

Re: [Tutor] Question

2010-06-19 Thread Alan Gauld
nd as a comparative languiage!) -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question

2010-06-19 Thread ALAN GAULD
> belt, then go ahead and learn anything else you like. But even then, if you > have > to learn two new ones at the same time, I'd recommend they be very unlike. > So you could learn Lisp or Forth at the same time as you were learning Ruby, > but > I'd not try to learn Perl and Python at th

Re: [Tutor] Question

2010-06-20 Thread Alan Gauld
er than the mechancs made sense. 2 years ago that surely wouldn't have been true! But maybe the prof harked back to those "golden days"... -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - T

Re: [Tutor] Question

2010-06-20 Thread Alan Gauld
"Mark Lawrence" wrote ...I take issue with this "learn a language in five minutes" bit. It took me five years to get to grips with plain old C. C is non trivial but not hard (certainly compared to C++) But 5 years is enough to do a lot more than "get to grips with" a language, that's what I'd

Re: [Tutor] Question

2010-06-20 Thread Alan Gauld
Python and Java code in some way. And if you are doing that you probably need to know Java too. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscripti

Re: [Tutor] New to this

2010-06-20 Thread Alan Gauld
ethod inp.seek(0) Now readlines() will return the data again. I'll try to write that up a bit more clearly and add it to the files topic. HTH< -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist

Re: [Tutor] Data exchange formats...

2010-06-20 Thread Alan Gauld
e crypto algorithms available. It all depends on what you want to do. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] New to this

2010-06-20 Thread Alan Gauld
("menu.txt", "r") *What is inp? What does it now contain?* inp is a variable and it is referencing the file object you created using the file() function. (As the tutor points out you could also use open() and in fact open() is now preferred over file() ) HTH, -- Alan Gauld Auth

Re: [Tutor] split struggle

2010-06-22 Thread Alan Gauld
indexes] You don't need the list comp print(indexes) for i in indexes: print(lst[int(i)]) Will do what you want. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.

Re: [Tutor] Calling a number's methods

2010-06-22 Thread Alan Gauld
"Mark Young" wrote I searched the internet, and found someone suggest adding spaces after each number, which indeed works properly. answer = 6 .__sub__(7 .__neg__()) answer 13 Why does this work? I don't even understand why python recognizes that I'm trying to access the numbers' __sub__

Re: [Tutor] Reading Excel Files

2010-06-22 Thread Alan Gauld
er Windows with Excel installed on the same machine... Just a thought, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.

Re: [Tutor] Repeat function until...

2010-06-23 Thread Alan Gauld
rinciple is good and definitely the easiest option. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] TypeError when io.open is used

2010-06-24 Thread Alan Gauld
t see any reason for it to fail but I'd like to be sure I'm looking at the right place! Also is there any reason why you explicitly call io.open() instead of just using the built-in open() directly? I know they are the same function but its quite unusual to use the io version explic

Re: [Tutor] Use flag to exit?

2010-06-24 Thread Alan Gauld
catches sys.exit(). That's OK, it's intended to print that message rather than exit so that you can debug the code if necessary, but it won't do it if you run the code from the OS prompt it will just exit silently as expected. HTH, -- Alan Gauld Author of the

Re: [Tutor] Use flag to exit?

2010-06-24 Thread Alan Gauld
in a development tool. Just run the programs outside IDLE and they won't get caught and you won't get error messages. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org

Re: [Tutor] os.startfile?

2010-06-24 Thread Alan Gauld
ss module. That is the platform independant way to run external programs and communicate with them. There are lots of examples in the documentation and you can find some basic info in the OS topic of my tutorial (Python v2 only so far for that one) -- Alan Gauld Author of the Learn to Progra

Re: [Tutor] Use flag to exit?

2010-06-25 Thread ALAN GAULD
> But I usually prefer to run the programs I write > in an IDE's shell, unless they are GUI's, of course. Why? That seems like a real pain to me! > What are my options for running my > scripts outside of an IDE? Double click them in Windows explorer. Put a shortcut on your desktop. All the

Re: [Tutor] Use flag to exit? (OT - PEP 8 Gripe)

2010-06-26 Thread Alan Gauld
"Richard D. Moores" wrote left-drag over the desired text. Right click to copy to clipboard Right click again to paste into current cursor position Hey, terrific! Thanks, Dave! I didn't see any help available. Where'd you learn this? There is a fair amount of help in Wiindows Help. Start

Re: [Tutor] need computer advice from wise Tutors

2010-06-26 Thread Alan Gauld
"Richard D. Moores" wrote Sorry about the OT, but I'm really nervous about the possibility of screwing up my laptop by upgrading the OS from Vista to 7, and can't think of a better place than Tutors to ask for advice. Going from Vista to Windows 7 is a relatively painless process - unlike goi

Re: [Tutor] Running external commands from Python

2010-06-26 Thread Alan Gauld
ews is that the complexity offers a very rich set of tools that can do pretty much anything tyou could imagine in the way of working with external programs. The "Working with the OS" topic in my tutorioal(V2 only) has some basic examples of both the older techniques and the subprocess met

Re: [Tutor] Advice on math

2010-06-26 Thread Alan Gauld
"Eduardo Vieira" wrote Right now I think I need a better understanding of logarithm, arrays (matrixes), and even probability. What links would you all recommend that would be useful for me to learn these things in a newbie-friendly way? Wikipedia? Pretty good on most things math and scienc

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Alan Gauld
"Steven D'Aprano" wrote having no default email client (what sort of two-bit operating system doesn't have an email client in 2010?); To be fair to MS - and it pains me to do so - they have been beat up so much by the lawyers that its hardlly surprising. After all they have been forced to r

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Alan Gauld
"Marc Tompkins" wrote having no default email client (what sort of two-bit operating system doesn't have an email client in 2010?); Jesus, you _miss_ Outlook Express? Seriously: the new default is webmail. Like it, don't like it, but it's really not as if you can't get your mail. I will

Re: [Tutor] socket

2010-06-27 Thread Alan Gauld
the networking topic in my tutorial;(V2 only) and see a simple explanation with examples. It might be helpful to read the previous two topics as well as a general background to communicating between processes. -- Alan Gauld Author of the Learn to Program web site http://w

Re: [Tutor] What is super for?

2010-06-28 Thread Alan Gauld
"Adam Bark" wrote I can't figure out how super(C, self).__init__() is any better than C.__init__(self), is there a preference? Does super do something special? Whoops I should really think about these things for a minute first, you don't have to know the superclass in advance is presumabl

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-29 Thread Alan Gauld
o be very conscious of the impact of gratuitous downloads and consider caching strategies etc. We can't do a lot about other people streaming videos other than minimise our network requirements. But we should at least be conscious of how network habits affect other users. -- Alan Gauld Author of t

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-29 Thread Alan Gauld
enges for programmers. We all need to be aware of the bottlenecks ion our designs and currently network bandwidth (and latency but that's another debate) is the biggest bottleneck for many applications. (And its nice to see an OT thread come back on topic! :-) -- Alan Gauld Aut

Re: [Tutor] What is super for?

2010-06-29 Thread Alan Gauld
the option of MI than not. In those cases where you really need it is vastly preferable to mass delegation - easier to write and easier to maintain. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist -

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-29 Thread Alan Gauld
"David Hutto" wrote > Or if the network is shared with other users or other applications So, the bandwidth supplied(better question for my own ISP) is like a drop cord, even with alleged T1 connections plugged in, it drop in accordance with usage that exceeds the max capacity even though they

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-29 Thread Alan Gauld
as drivers need to recognise the impact of bad driving on other road users. Email is, as someone pointed out a relativel small consumer of bandwidth, much worse would be somebody leaving a streaming video source on auto repeat! But having said that the latest figures still place text services as

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-30 Thread ALAN GAULD
> > If its a typical ADSL line it will be conneced to a DSLAM at > > the centeral office(by the telco) and that will be shareed. > > > ADSL also loses bandwidth the further you are from the office > process has to be diversified for each customer, because it > all travels at the speed of lig

Re: [Tutor] (no subject)

2010-06-30 Thread Alan Gauld
ith 7? Yes, and I would recommend you get yours from the Activestate.com web site rather than python.org since the Activestate version is much more Windows friendly. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___

Re: [Tutor] Decorators

2010-06-30 Thread Alan Gauld
cially if you are on *nix. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] (no subject)

2010-07-02 Thread Alan Gauld
"Richard D. Moores" wrote Yes, and I would recommend you get yours from the Activestate.com web site rather than python.org since the Activestate version is much more Windows friendly. Alan, I'm interested. Could you tell us more about how it's more Windows friendly? It comes with the Wi

Re: [Tutor] Reading a file

2010-07-02 Thread Alan Gauld
ove. However even if you did want to do that using enumerate() would probably be more effective. So slightly mofdifying Steven's code: f = open("filename.txt") for number, line in enumerate(f): print "%5d%s" % (number, line) f.close() Is that close? -- Alan Gaul

Re: [Tutor] Help with choices for new database program

2010-07-02 Thread Alan Gauld
atabase focused app I'd take a look at Dabo. It has a GUI builder but also has links to database tables etc. http://dabodev.com/ I've only played with it briefly (followed the tutorial) since I don't do much database work in Python but it did look like a good tool for data centric

Re: [Tutor] Help with exercises from learning to program pythonwikibooks

2010-07-04 Thread Alan Gauld
. Until recently I'd have said go with v2 but I think v3 is becoming sufficiently mature that I'd now suggest upgrading. By the time you are fluent the external libraries etc should have mostly caught up. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/

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