Re: [Tutor] how to graph percentile -- matplotlib, Inkscape, or what?

2010-02-06 Thread Alan Gauld
or progress bar widget to indicate the result. -- 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 graph percentile -- matplotlib, Inkscape, or what?

2010-02-06 Thread Alan Gauld
"David" wrote in message news:4b6d37e4.9050...@gmx.net... matplotlib. I guess the reason why I discarded it before is that I understood matplotlib to be a curve plotting tool, and not so much a tool to draw graphics. I will investigate! It is but a single point on a an axis is a pretty basic

Re: [Tutor] Uninstalling MatPlotLib? (Win7)

2010-02-06 Thread Alan Gauld
"Wayne Watson" wrote I should have installed NumPy before MPL. How do I uninstall it. I'm pretty sure it was an msi file. In that case it should be listed under Add/Remove programs in Control Panel. Alan G ___ Tutor maillist - Tutor@python

Re: [Tutor] why inline-only string literals?

2010-02-07 Thread Alan Gauld
le quote syntax) -- 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 clear contents of a file

2010-02-10 Thread Alan Gauld
e to do so? There may be a valid reason but I can't think of one. If you describe the wider problem we may be able to offer an alternative solution that does not require you to copy the code at all. -- Alan Gauld Author of the Learn to Program web site http://w

Re: [Tutor] string to list

2010-02-11 Thread Alan Gauld
the function can be expressed as a single expression. You will find more explanation and examples in the Functional Programming topic in my tutorial. HTH -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist -

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Alan Gauld
e "exe"s it becomes very inefficient way to storing programs - multiple versions of Python. There can be cases where it makes sense but there are more cases where it malkes more sense to just install Python. IMHO -- Alan Gauld Author of the Learn to Program we

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Alan Gauld
all any third party libraries as needed (in other words check to see if you can find them first) and add things like help files and readme documents. Finally it should offer to place an icon/entry in the start menu or desktop or where-ever is normal for the OS. But none of that requires the applica

Re: [Tutor] SMTP

2010-02-11 Thread Alan Gauld
"Grigor Kolev" wrote I try send a mail with smtplib Server work with postfix. I try it import smtplib s=smtplib.SMTP("localhost") This requires you to have an SMTP server running on localhost. Do you? I notice you say the server works with p

Re: [Tutor] Coin flip game

2010-02-11 Thread Alan Gauld
= coin + someFunction() It is very important in programming to be clear in your mind about these different concepts, especially when deciphering error messages. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tut

[Tutor] New Python testing book

2010-02-12 Thread Alan Gauld
Amazon have just brought to my attention the following title: Python Testing: Beginner's Guide Has anyone seen this? Is it any good? What test frameworks does it cover? Amazon are remarkably reticent about the actual contents. Its very new, only published on 22nd January. Alan G. __

Re: [Tutor] Tutor list as pair progamming plush toy

2010-02-12 Thread Alan Gauld
;t come you have the 2nd level support option of actually posting and getting replies! :-) -- 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 s

Re: [Tutor] batch file processing w/ python using cmd line executable?

2010-02-12 Thread Alan Gauld
Both are discussed in the Using the OS topic in my tutorial. -- 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] aliasing an imported module

2010-02-12 Thread Alan Gauld
refer to independant instances of the same class each with its own myvar variable inside. See the OOP topic of my tutorial for more on Object Oriented Programming HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ __

Re: [Tutor] Just a Note

2010-02-13 Thread Alan Gauld
"Randy Raymond" wrote By the way, Alan Gauld's emails generate an error in my system. His is the only emails I have a problem with so far. At first it tried to open a News service. Interesting. I am using the gmane news server but I've not heard of anyone else having problems. Is there

Re: [Tutor] Not understanding this code example. Help, please.

2010-02-13 Thread Alan Gauld
as the argument to both functtions, so noun gets applied as the word parameter to both functions. And yes it is a little mind bending and there are more straighforward ways to code it, but they require more code and don't show off the use of higher order functions. It depends on what the

Re: [Tutor] The Order of Imports and install order of modules and other matters (XP vs W7, ...)

2010-02-13 Thread Alan Gauld
"Wayne Watson" wrote There seems to be something of a general consensus in ordering import statements. Something like standard library imports first. I've never seen anything written down but its true I tend to do that. But its not been a conscious thing... tools like matlablib or tkinter

Re: [Tutor] The Order of Imports and install order of modules and other matters (XP vs W7, ...)

2010-02-13 Thread ALAN GAULD
> Another question on similar matters. If I write a program and "compile" it > for > distribution, and a user has 2.6 going to be able to execute it. I would like > to > the the compiled program is free of such restrictions. That is, it's an > independent program. I would like to think that

tutor@python.org

2010-02-13 Thread Alan Gauld
eroing all the other bits. Similarly >> 16 gets the top 16 bits and andintg with 255 processes bits 16-24 and zeros the rest. And so on for the other two groups of 8 bits. There is more on using bitwise operators and "masking" in my Using the OS topic in my tutorial(v2). (Look

tutor@python.org

2010-02-13 Thread Alan Gauld
r from time to time... It is good practice to restrict the range to the 8 bits needed by and'ing with 255 even when you think you should be safe. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist

tutor@python.org

2010-02-14 Thread Alan Gauld
"Steven D'Aprano" wrote They are not gone however there are still 32 bits in an integer so the top bits *should* be set to zero. No, Python ints are not 32 bit native ints. They're not even 64 bit ints. Python has unified the old "int" type with "long", so that ints automatically grow as n

Re: [Tutor] command error help

2010-02-14 Thread Alan Gauld
uot; \ "your name would become:" print called moon_weight = weight / 6.0 print "\nDid you know that on the moon you would weigh only", moon_weight, "pounds?" sun_weight = weight * 27.1 print "But on the sun, you'd weigh", sun_weight, "(but, ah...

Re: [Tutor] Getting caller name without the help of"sys._getframe(1).f_code.co_name" ?

2010-02-14 Thread Alan Gauld
"patrice laporte" wrote Maybe the fact I'm à pure C coder for a longtime prevent me from thinking in Python, ... And now, something different : what I want to do, and why. Based on that last line I think your brain is well on the way to thinking like a Python programmer! :-) Others have ad

tutor@python.org

2010-02-14 Thread Alan Gauld
t work in 2.5 or 2.6. You're probably trying this: 123.bit_length() Indeed, I tried using a variable and it worked. Thanks for that I hadn't come across bit_length() before. -- 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] A Stuborn Tab Problem in IDLE

2010-02-14 Thread Alan Gauld
"Wayne Watson" wrote When I use F5 to execute a py program in IDLE, Win7, I get a tab error on an indented else. What happens if you execute from a command line? Do you get the same error? If so look at the lines before. If not try closing and restarting IDLE HTH, Alan G _

Re: [Tutor] A Stuborn Tab Problem in IDLE

2010-02-15 Thread Alan Gauld
"Wayne Watson" wrote Thanks for the reminder on that. I haven't need the DOS box for 8 months. Just off on other non-programming efforts for the most part. Things have picked up of late. I was beginning to think for awhile that Win7 might have dropped it. I don't see any changes to it. Its

Re: [Tutor] Editing html using python

2010-02-15 Thread Alan Gauld
"Luke Paireepinart" wrote with BeautifulSoup were. Also I think beautifulsoup is part of the Python standardlib now, isn't it? Why do you think it is not maintained? I think you may be getting confused with element tree which is part of the standard lib? BS is still an add-on. Alan G.

Re: [Tutor] The Order of Imports and install order of modulesandother matters (XP vs W7, ...)

2010-02-16 Thread Alan Gauld
"Hansen, Mike" wrote I'm aware of Pep8. It's a good starting point. Anything more in-depth than Pep8 and the Zen of Python? There is the generic book "Code Complete" which is excellent, but definitely not short! And it's not Python specific - in fact doesn't even mention Python so far as I

Re: [Tutor] DOWHILE counter

2010-02-17 Thread Alan Gauld
reading - one number or two? And what does it do with these to "process them"? Is there any output? Can you write down what a typical execution of this program will look like to the user? Maybe doing that will clarify in your mind what it is you must do. -- Alan Gauld Author of th

Re: [Tutor] Python and algorithms

2010-02-18 Thread Alan Gauld
math to develop efficient algorithms. 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 and algorithms

2010-02-18 Thread Alan Gauld
"C.T. Matsumoto" wrote I'd say sharpening my problem solving skills. I thought that was often tied to building an algorithm. The example Walter Prins provided I thought fit what I was looking for. "To keep this simple and practical, as a suggestion, consider the problem of sorting a list (a

Re: [Tutor] Is it possible for a Python Program to send commands to thePython Interpreter?

2010-02-19 Thread Alan Gauld
available? 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] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-19 Thread Alan Gauld
utorial writer makes it a much safer option. 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] Is it possible for a Python Program to send commands to the Python Interpreter?

2010-02-19 Thread ALAN GAULD
Looks like the eval() will work great. Thanks so much for telling me. > >We normally warn against using eval/exec because they form a security risk. But in your case you are in control of the code that they execute so its ok. That is the kind of usage where they are the best solution. Be ve

Re: [Tutor] The Disappearing Program (py2exe)

2010-02-20 Thread Alan Gauld
"Wayne Watson" wrote File "matplotlib\__init__.pyc", line 478, in _get_data_path RuntimeError: Could not find the matplotlib data files <---What is this? C:\Users\Wayne\Sandia_Meteors\Sentinel_Development\Learn_Python\Py2exe_Test\dist> == I G

Re: [Tutor] ask

2010-02-20 Thread Alan Gauld
so you understand about expressions and arithmetic operations etc? Are you asking how to express that in Python? Have you tried just entering it as written? -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor

Re: [Tutor] Python 3.0

2010-02-20 Thread Alan Gauld
"Paul Whittaker" wrote Using the following script, the (Windows 7) PC echoes the key presses but doesn't quit (ever!) import msvcrt print('Press SPACE to stop...') while True: k = msvcrt.getch() # Strangely, this echoes to the IDLE window You will need to run it in an OS command wind

Re: [Tutor] Python 3.0

2010-02-20 Thread Alan Gauld
character. But he is running it in IDLE and msvcrt only works n the OS command window world. I've updated my tutorial page to point that out. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@

Re: [Tutor] Drawing faces

2010-02-22 Thread Alan Gauld
rnet faces in a single window,when i invoke drawFace(center,size,win) into def main(). Good for you. It sounds like an excellent practice exercise in using a GUI toolkit. (Or even ASCII art in curses!) BTW Which GUI toolkit are you using? And which widget within it? Is it the Canvas in Tkinter?

Re: [Tutor] What Editori?

2010-02-23 Thread Alan Gauld
"Steve Willoughby" wrote Actually, I suppose even ed and TECO qualify for some work models ;) I even use edlin occasionally - usually in batch files... But Teco is the only editor that I've given up on as being just to hard to use! And that's out of more than a couple of dozen editor

Re: [Tutor] What Editori?

2010-02-23 Thread Alan Gauld
is available in several tools. The only snag I found with Pyscripter is that its shell is hard coded to a Python release as far as I could tell. But thats not unusual, IDLE is too, as is Pythonwin. HTH, -- Alan Gauld Author of the Learn to Program web site http://w

Re: [Tutor] What Editori?

2010-02-23 Thread Alan Gauld
"spir" wrote ...and has the absolutely necessary duplicate feature ;-) (*). (*) Does anyone know another editor that has it? OK, I'll bite. What is the duplicate feature? :-) Alan G ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] What Editori?

2010-02-23 Thread Alan Gauld
"Wayne Werner" wrote I use vim - for me it's the hands-down best editor. I usually have two terminals (I run linux) open - one for ipython, and one for vim. I usually have vim split into several buffers for each of the files I'm editing, and I have some nice scripts and plugins that help me

Re: [Tutor] Cannot open SQLite database

2010-02-24 Thread Alan Gauld
k that APPDATA is actually set? # Connect to the database def db_connect(): conn = sqlite3.connect(os.path.join(PREFDIR, 'myapp.db')) # This Do you do an is file exists check before trrying to use it? And that the permissions on both directory and file are set up correctly? That would

Re: [Tutor] Strange list behaviour in classes

2010-02-24 Thread Alan Gauld
since the highest index there will be zero. You need to rethink your rules for generating the indexes remembering that they start at zero. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@pyt

Re: [Tutor] Verifying My Troublesome Linkage Claim between Python andWin7

2010-02-24 Thread Alan Gauld
are copying the files as a user. How are you doing that? - from a command window? - Or using Windows Explorer? - Using drag n drop or copy/paste? Still a lot of variables. What happens if you run the program from the command line rather than IDLE? Did you close and restart IDLE between runs? --

Re: [Tutor] ask

2010-02-24 Thread Alan Gauld
"Shurui Liu (Aaron Liu)" wrote in message news:2b9003cf1002231958s34b701b6sc69408a0b855a...@mail.gmail.com... This time is not my assignment, I promise. In python, when we want to list numbers, we use the command "range", like, if we want to list integer from 0 to 9, we can write: range(10);

Re: [Tutor] What Editori?

2010-02-24 Thread Alan Gauld
"Giorgio" wrote And, what about more powerful editors? I mean editors with features like SVN/GIT management and so on. THose aren't really editor features but IDE features. But thats probably splityting hairs. But emacs does that too and truly is a powerful editor. Certainly more so than

Re: [Tutor] common (sub)attributes

2010-02-24 Thread Alan Gauld
on. In the case of an instance the "local" or instyance barianle lasts for the life of the object. The class variable last for the life of the class. (and in Python you can del() a class... to end its life - but it will exist until the last instance is destroyed because each instance ha

Re: [Tutor] strange bidi requirement

2010-02-24 Thread Alan Gauld
tch() ans = ch+ans delete line print line, Hope thats enough to start. Another option for a known length is to use cursor positioning commands to move the cursor from right to left with each character. Finally you could use curses, but thats just a pseudo GUI for consoles! HTH, -- Alan

Re: [Tutor] Strange list behaviour in classes

2010-02-24 Thread ALAN GAULD
ange(len(self.value)): >square = (self.value[n] - average)**2 >self.square_list.append(square) >var = sum(self.square_list) / len(self.square_list) >return var > > > >On Wed, Feb 24, 2010 at 4:02 AM, Alan Gauld wrote: > > >>>>"James Reynolds" wro

Re: [Tutor] Strange list behaviour in classes

2010-02-24 Thread Alan Gauld
quare_list) / len(self.square_list) return var -- 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] Strange list behaviour in classes

2010-02-25 Thread ALAN GAULD
One point: class Statistics: def __init__(self, *value_list): >self.value = value_list >self.square_list= [] >def mean(self, *value_list): >try : >ave = sum(self.value) / len(self.value) >except ZeroDivisionError: >ave = 0 >return ave You don't use value_list here you use self.value. So you don't

Re: [Tutor] Cannot open SQLite database

2010-02-25 Thread ALAN GAULD
> > It is on Windows XP, and in the logfile it says it uses the directory: > > C:\Documents and Settings\user\Application Data\myapp > > > > That directory should always be writeable for the user, no? > > > > Not on my PC its Read Only > > > > And I have administrator rights.

Re: [Tutor] Omitting lines matching a list of strings from a file

2010-02-25 Thread Alan Gauld
_states. You probably want to add a break command after the print But I would do this with a list comprehension or generator expression (depending on your Python version): lines = [line for line in infile if line[146:148] not in omit_states] print '\n'.join(lines) HTH, -- Alan Gauld

Re: [Tutor] Omitting lines matching a list of strings from a file

2010-02-25 Thread Alan Gauld
"Christian Witts" wrote lines = [line for line in infile if line[146:148] not in omit_states] print ''.join(lines) Just remember that doing a list comprehension like that on a large file will drastically reduce the speed of your application as well as introduce memory bloat. Given he was

Re: [Tutor] wHY

2010-02-25 Thread Alan Gauld
"Kirk Bailey" wrote IS NOTHING FROM THE LIST COMING TO ME? Stating the obvious first - have you checked your subscription settings? Have you got delivery switched on? Have you tried switching it off then on again just to be sure? Alan G. ___

Re: [Tutor] Help me understand this tkinter related code

2010-02-26 Thread Alan Gauld
/pubs/tkinter/scale.html Which seems to confirm my theory :-) -- 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] Verifying My Troublesome Linkage Claim between Python and Win7

2010-02-28 Thread Alan Gauld
re I spend as little time as possible in the environment that I don't want to stay in. 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 subscri

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Alan Gauld
return True else: return False return bool(matchParam) instead of the if/else I am pretty sure that it can be simplify by using a dictionnary with the full path file as the key and the string 'include' nominal line expression as the value to construct the final file with filt

Re: [Tutor] CGI File Uploads

2010-02-28 Thread Alan Gauld
t;>> prompt. 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] CGI File Uploads

2010-02-28 Thread ALAN GAULD
> Alan, i don't know how to use it in this case. > > import cgi > form = cgi.FieldStorage() > fileitem = form['file'] > Function dir() lists all functions in a module, i could only use it for "cgi" It will list all the names in any kind of object not just a module. If you type the code abov

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Alan Gauld
e this point? Sure, the lines variable holds a reference to the list returned by readlines. There is no variable referring to the file object so immediately after readlines completes the file will be ready to be closed (at least in CPython as already pointed out by Lie) HTH, -- Alan Gauld Autho

Re: [Tutor] OOD - Another class question

2010-02-28 Thread Alan Gauld
the BankAccount example in the OOP topic of my tutor for more examples of subclasses calling superclass methods HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] Why is the max size so low in this mail list?

2010-03-01 Thread Alan Gauld
"Wayne Watson" wrote See Subject. 40K here, but other Python lists allow for larger (total) sizes. Presumably to discourage long posts or posts with large attachments? But I'm only guessing... Alan G ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-03-01 Thread ALAN GAULD
the > common langage evoluate. But sometimes you want to go beyond the language, to explore ideas and concepts that underlie everything we do in every language. Languages like Lisp and Python make that possible, if not exactly easy! HTH, Alan Gauld Author of the Learn To

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Alan Gauld
clude any item that is None you can use an if clause at the end of the comprehension: mylist = [irtem for item in aList where item != None] and aList is any list, which could be [x,y,z] in your example. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.al

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Alan Gauld
seemed to be the real issue within the question. -- 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] Bowing out

2010-03-03 Thread Alan Gauld
"kevin parks" wrote Wish Danny Yoo was still here too. Technically he is, but just keeps very, very quiet! :-) Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinf

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Alan Gauld
now, so once again we have managed to kill several sparrows with one round of buckshot... :-) -- 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 subsc

Re: [Tutor] object representation

2010-03-04 Thread Alan Gauld
hash funcs for string keys, and the one used in python? Wikipedia for generic and the source for Python? HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscr

Re: [Tutor] Python tutor

2010-03-04 Thread Alan Gauld
ist is the group. Just subscribe and send your questions. The group will try to answer. We don't do homework, but we will, even there, try to offer direction. When posting about errors please include the full error text and the code if not too long (otherwise use pastebin or similar). HTH,

[Tutor] My tutorial

2010-03-05 Thread ALAN GAULD
le if you are stuck... http://www.freenetpages.co.uk/hp/alan.gauld/ Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/ma

Re: [Tutor] My tutorial

2010-03-05 Thread Alan Gauld
It's back. Enjoy Alan Gauld Author of the Learn To Program website 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] Instantiating a list of strings into a list of classes

2010-03-06 Thread Alan Gauld
previously written code doen't get confused aboutt unexpected names appearing. -- 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://

Re: [Tutor] pgdb and console output

2010-03-07 Thread Alan Gauld
al. It should make most things clear. Last thing is can I define the classes in a separate files and reference them? Kinda like code reuse in .Net? I new to Python so bear with me. Yes, just define them in a file then import that file as a module. The standard tutorial explains that too.

Re: [Tutor] Really learn programming

2010-03-08 Thread Alan Gauld
! So yes professional grade programming takes a lifetime to learn (not least because it is constantly changing!) but an amateur can meet all their needs much more quickly and have a lot of fun in doing so. -- Alan Gauld Author of the Learn to

Re: [Tutor] variable inheritance

2010-03-08 Thread Alan Gauld
type and 3 subclasses, Tree,, Node1 and Node2 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] pgdb and console output

2010-03-10 Thread Alan Gauld
to interpret them. Thus if you know its a number you use int() to convert the string to an integer value In Python v3 raw_input has been renamed to input() See the Talking to the User topic in my tutorial for more detail on the differences. -- Alan Gauld Aut

Re: [Tutor] Macbook Pro+python programming

2010-03-10 Thread Alan Gauld
IDLE using the full path and explicitly calling python as described above. If that works then check your PATH/PYTHONPATH settings -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@pytho

Re: [Tutor] Feedparser and google news/google reader

2010-03-10 Thread Alan Gauld
"David Kim" wrote me CRAZY. I can't seem to pull more than 10 items from a google news feed. For example, I'd like to pull 1000 google news items (using some search term, let's say 'lightsabers'). The associated atom feed url, however, only holds ten items. And its hard to do some of the clu

Re: [Tutor] Recommendations on Workshops, Courses, Live Online Training

2010-03-11 Thread Alan Gauld
are considered legitimate... 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] Problem with turtle

2010-03-11 Thread Alan Gauld
w the wrong thing? Don't make us guess... -- 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] Opening a dos exe

2010-03-11 Thread Alan Gauld
"Emile van Sebille" wrote I've sometimes written python code to create wsh (and other) scripts that I then run from within python. WSH include a sendkeys command IIRC that works with dos/command/cmd windows. There's likely ways to use the win32 api as well (win32api.keybd_event?). Using

Re: [Tutor] Problem with turtle

2010-03-11 Thread Alan Gauld
test your functions at the interactive prompt (>>>). Put the functions in a file and import the file then you can call them directly and see whether they draw what you expect. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] Recommendations on Workshops, Courses, Live Online Training

2010-03-11 Thread Alan Gauld
"Tino Dai" wrote I do know of a place in North Carolina, and the president of the company spoke @ PyCon this year. I don't know if this is the correct venue to put that sort of information. Guidance please. :) I don't think I'd encourage regular announcements but where someone is speci

Re: [Tutor] use of __new__

2010-03-11 Thread Alan Gauld
"spir" wrote The issue is the object (self) is then a unicode one instead of my own type. I think you need to modify self in __new__ class Unicode(unicode): Unicode.FORMAT = "utf8" def __new__(self, text, format=None): # text can be str or unicode format = Unicode.FOR

Re: [Tutor] trouble with dates and python and databases

2010-03-12 Thread Alan Gauld
"Christopher Spears" wrote My problem is I'm not sure how to store and retrieve the dates. I assume the best way to record the date is to use datetime.date. If you are using a database I'd just use the database date functions. There should be functions to generate and store dates via SQL.

Re: [Tutor] First program

2010-03-12 Thread Alan Gauld
ts more readable IMHO and less typing for you. choice = input('\nPlease enter your choice: ') if choice.isdigit() ==True: choice = int(choice) Consider wrapping the whjole thing in a try/except structure. Then you can convert to int() as you read the input. Alternatively, since its only

Re: [Tutor] First program

2010-03-13 Thread Alan Gauld
ng data with presentation. One thing - you don't need all the str() calls in your example, print already calls str() for you. Also comma separators are better than + signs since the plus operation on strings is quite expensive - you create a new string for each addition. HTH

Re: [Tutor] Opening a dos exe

2010-03-13 Thread Alan Gauld
time via the command line if it accepts command line input. I don't think you can do the second option with a bat file. There is no way to interactively respond to the program once it starts. Thats why WSH is better for that kind of interactive input. Or just use subprocess.Popen... --

Re: [Tutor] First program

2010-03-13 Thread Alan Gauld
"Luke Paireepinart" wrote print "The area of a " + Choice + "is " str(Width) + " x " + str(Height) + " equals " + str(Width * Height) + " square feet" One thing - you don't need all the str() calls in your example, print already calls str() for you. Also comma separators are bett

Re: [Tutor] First program

2010-03-13 Thread Alan Gauld
"Ray Parrish" wrote As far as the capitalizations, it's just a habit I've held over from my Visual Basic days, and earlier programming. It's a little easier for me to pick out the individual words in a variable like ThisPerson as opposed to thisperson. thisPerson is fine for a variable

Re: [Tutor] Problem with little program

2010-03-13 Thread Alan Gauld
So show us the code that is not working! How are you importing the function? How are you accessing it? What error message do you get, if any? What happens? Please help me Please help us. We can't possibly guess what you might be doing wrong with no clues. -- Alan Gauld Author of the L

Re: [Tutor] Problem with little program

2010-03-13 Thread Alan Gauld
e can say that it is the problem here. Indeed so far as I can tell we don't even know what the problem here is other than that the OP is trying to call the function he has defined in another file. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ On 13 March

Re: [Tutor] Command not issued until after escape from loop

2010-03-15 Thread Alan Gauld
est for not val. See if that helps. -- 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] local var error

2010-03-15 Thread Alan Gauld
initialise it to a default value (zero?) outside the loop if it is only used inside a conditional. Or catch the exception if no sensible default exists. windArea=(math.sqrt(stdArea))*0.75 I am creating a variable in the for loop. Shouldn't it work outside it? It will if you crea

Re: [Tutor] Hi there :.)

2010-03-15 Thread Alan Gauld
lp to tell us which OS and Python version you are using 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 subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] raw_input()

2010-03-15 Thread Alan Gauld
you want directly? Unless you just want the learning experience. -- 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] browing windows registry

2010-03-17 Thread Alan Gauld
registry module... _winreg Or you can use the Win32 API directly from Pythonwin or use ctypes. But _winreeg is probably marginally easier. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tuto

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