Re: [Tutor] Problems with iterations and breaking loops.

2010-03-17 Thread Alan Gauld
or lists) Does that work for you? -- 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] Problems with iterations and breaking loops

2010-03-18 Thread Alan Gauld
t" + str(v2)) return something The above is all you need in your function. 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

Re: [Tutor] Self-intro and two short newbie questions

2010-03-18 Thread Alan Gauld
"Kevin Kirton" wrote know it varies depending on the person, but for example, how long would it take _you_?) (i) a simple guitar tuning program involving an image of a guitar and the playing of each of the standard strings of a guitar (E, A, D, G, B, E) upon key input by the user For a profe

Re: [Tutor] using pythnn to open a password protected website

2010-03-19 Thread Alan Gauld
ng near Firefox. -- 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] Efficiency and speed

2010-03-19 Thread Alan Gauld
ou inserted and remove it. Wow. yield i # send the position of that element back to the main So you really just want to find out where you would like to insert it in an already sorted/reversed list? Back to step one - can you improve the algorithm? -- Alan Gauld Author of the Learn to Pr

Re: [Tutor] Tutorial executable from python script.

2010-03-19 Thread Alan Gauld
wityh the oldest version of Python you need to run on. 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] Efficiency and speed

2010-03-19 Thread Alan Gauld
"James Reynolds" wrote Here's another idea I had. I thought this would be slower than then the previous algorithm because it has another for loop and another while loop. I read that the overhead of such loops is high, so I have been trying to avoid using them where possible. Thats often t

Re: [Tutor] Efficiency and speed

2010-03-22 Thread Alan Gauld
ect (try Source Forge) and grab the source code and read it, understand it and modify it. You could even try the standard library modules as a starter. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tut

Re: [Tutor] Python help please

2010-03-22 Thread Alan Gauld
ters - a dictionary maybe? Start with one character and try getting the most basic version running. If you get stuck show us the code plus any error messages and ask... -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___

Re: [Tutor] parsing pyc files

2010-03-23 Thread Alan Gauld
ecode. There are tools to generate it for a specific function so you can see what it looks like, but I don't know of any that can dynamically monitor execution. The profiler can also tell you what was executed after the fact. This is an unusual request can I ask why you need to do that? -- Ala

Re: [Tutor] characters

2010-03-31 Thread Alan Gauld
"Shurui Liu (Aaron Liu)" wrote In Python, could space be counted as a character same as a letter? In Python the fastest and most certain way to answer such questions is to try it at the >>> prompt. len('ab cd') # is it 4 or 5? 5 HTH, -- Alan Gauld A

Re: [Tutor] simple search and replace...

2010-03-31 Thread Alan Gauld
iple changes you might need that but I suspect a simple replace() will do. Even for multiple places, if it's only to add a \n then use a re.sub() to do it all in one call. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _

Re: [Tutor] simple search and replace...

2010-03-31 Thread ALAN GAULD
a loop over your patterns: for pat in ['PID','OBR',] h7string = h7string.replace('\n'+pat, h7string) Or even build a regex that does it all in one. (But the regex could get complex quickly!) Alan Gauld Author of the Learn To Program website http://www.a

Re: [Tutor] what's wrong in my command?

2010-04-01 Thread Alan Gauld
er importing it, trying to use a global attribute that's not there. Wild guess - do you have a file called marshal.py in your own code? And tell us about this too... -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ __

Re: [Tutor] Display in a text field using tkinter

2010-04-02 Thread Alan Gauld
n;t use grid() ion the same line as you create the widget. 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] Display in a text field using tkinter

2010-04-03 Thread Alan Gauld
x attributes are set to None. You must call grid after you create the widget. -- 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: ht

Re: [Tutor] Using TAB in Python IDLE

2010-04-03 Thread Alan Gauld
out any issues so we need more detailed information. -- 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] Menu data from file

2010-04-04 Thread Alan Gauld
anks, You're welcome. Or do you have a problem with implementing it? If so what? What did you try? What happened? Oh, and it will help to tell us which GUI toolkit you are using too? -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _

[Tutor] Fw: Menu data from file

2010-04-04 Thread ALAN GAULD
forwarding to the list. Please use Reply All when replying to the list otherwise it is only a reply to the original poster. Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ > >- Forwarded Message >From: Neven Goršić >To: Alan Gauld >

Re: [Tutor] constructor

2010-04-04 Thread Alan Gauld
. You can think of crit = Critter() as effectively being a call to Critter.__init__() There is a little bit more to it that that but most of the time its close enough. You can read an alternative explanation in the OOP topic of my tutorial... -- Alan Gauld Author of the Learn to Program web site http:/

Re: [Tutor] Matching zipcode in address file

2010-04-04 Thread Alan Gauld
"TGW" wrote I go the program functioning with lines = [line for line in infile if line[149:154] not in match_zips] But this matches records that do NOT match zipcodes. How do I get this running so that it matches zips? Take out the word 'not' from the comprehen

Re: [Tutor] Menu data from file

2010-04-04 Thread Alan Gauld
t edit the menu module when you want to modify the menu structure and the import will see it as Python data. 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] Matching zipcode in address file

2010-04-05 Thread ALAN GAULD
Please use Reply All whern responding to the list. > lines = [line for line in infile if line[149:154] not in match_zips] > >Nope. I tried that. I actually modified your comprehension >that you provided about a month ago. >Works great for NOT matching, but can't figure out how to match. >Do

Re: [Tutor] New class, how return value of x in interactive shell

2010-04-05 Thread Alan Gauld
ing object I have 2 questions 1, how do I do this? 2, how does print know what to do? If you look at your class definition that should become obvious. Are you sure this isn't a homework? -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ __

Re: [Tutor] New class, how return value of x in interactive shell

2010-04-05 Thread Alan Gauld
ject, as at the >>> prompt. So print b # calls b.__str__() whereas b # calls b.__repr__() HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscrib

Re: [Tutor] New class, how return value of x in interactive shell

2010-04-05 Thread Alan Gauld
why they have used an explicit new() class method rather than __new__()? -- 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] Simple bank account oriented object

2010-04-05 Thread Alan Gauld
I don't speak French so I'm struggling a bit with the variable names, however... "Marco Rompré" wrote in message class CompteBancaire: def __init__(self,nom,solde,interet): #Nous allons instancier et self.nom, self.solde, self.interet = nom,solde,interet def depot(self,somme

Re: [Tutor] Matching zipcode in address file

2010-04-06 Thread Alan Gauld
he file or add a \n to your source data when comparing it with file data. Personally I usually use strip() so that I'm working with 'clean' data both for source and reference. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] Extracting lines in a file

2010-04-06 Thread Alan Gauld
also occured in line 10) Pseudocode: for line in file: if trigger in line: marker = file.tell() file_jump(file, jumps[trigger]) process_file_data() file.seek(marker) # go back to original position HTH, -- Alan Gauld Author of the

Re: [Tutor] Where to start, running interactive bash script in Qt GUI

2010-04-07 Thread Alan Gauld
"Dotan Cohen" wrote I have an interactive bash script that asks for a password, then connects a remote machine via fuse with the supplied password. there a way to wrap a bash script with Python for a GUI, ask for a line of user input, then pass that to the bash script? Rather than wrap t

Re: [Tutor] Linux lib path

2010-04-10 Thread Alan Gauld
ould work... Does it work in your local .profile? -- 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] Declaring methods in modules.

2010-04-11 Thread Alan Gauld
nds on what the restof your code is doing and how data is being handled/stored etc. But we don;t have enough information to be sure. My guess is that a class will be handy because you will likely need several such methods all acting on common data - which is the definition of a class! HTH, --

Re: [Tutor] Speech recognition, and synthesis

2010-04-11 Thread Alan Gauld
sed them. and are there any open source versions? Yes. 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] Sequences of letter

2010-04-12 Thread Alan Gauld
ont out the variables. That might have helped you see what was going wrong. But inthis case it would be better to just forget the indexes and use the loop variables, i,j,k directly. I guess I should look over creating a function or something like that because when I run it I can't

Re: [Tutor] Sequences of letter

2010-04-12 Thread Alan Gauld
I think the repeated string is much clearer, and thus better, than the cryptogram thanks very much! :-) But I like the itertools solution. I really, really, need to spend some time playing with itertools. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ __

Re: [Tutor] Move all files to top-level directory

2010-04-12 Thread Alan Gauld
ples and description of both in the Using the OS 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] cherrypy

2010-04-13 Thread Alan Gauld
ext) Does it fail to execute? Where is my code from cherrypy.lib import sessions sess = sessions.Session() x = sess.id return x; HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@pytho

Re: [Tutor] Problems with creating XML-documents

2010-04-14 Thread Alan Gauld
it if you are creating it? Or is this after you read it back later? I don't understand the sequence of processing here. So I tried to use an external library jaxml, Did you try to use the standard library tools that come with Python, like elementTree or even sax? I think we need a few mo

Re: [Tutor] Loop comparison

2010-04-16 Thread Alan Gauld
s JVM will map closely to native CPU operations, Python is effectively calling functions. This is almost a pathalogical case for comparing the two languages. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor mailli

Re: [Tutor] Loop comparison

2010-04-16 Thread Alan Gauld
x27;t expect the compiler optimiser to be that clever) -- 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] Loop comparison

2010-04-16 Thread ALAN GAULD
> The precalculation optimisations are > taking place. If you pass it an argument to use for the upper limit of the > sequence the calculation time shoots up. I'm still confused about when the addition takes place. Surely the compiler has to do the addition, so it should be slower? I assume

Re: [Tutor] Loop comparison

2010-04-16 Thread Alan Gauld
"Steven D'Aprano" wrote (We can of course do some fancy math to speed this particular sum up since the result for any power of ten has a common pattern, but I wouldn't expect the compiler optimiser to be that clever) No fancy maths needed, The sum of 1,2,3,4,...,N is given by a simple for

Re: [Tutor] Loop comparison

2010-04-16 Thread Alan Gauld
> result = sum(range(10)) > > although it still took 10 minutes on my PC. Did you mean to say "minutes" or rather "seconds" here? And did you really mean to use "range" or rather "xrange" (or "range" in Py3)? Yes, minutes and in Python 3. And on a 2.8GHz 2 core CPU with 2G RAM su

Re: [Tutor] Loop comparison

2010-04-16 Thread Alan Gauld
"Lie Ryan" wrote A friend of mine suggested me to do the next experiment in python and Java. It's a simple program to sum all the numbers from 0 to 10. result = i = 0 while i < 10: result += i i += 1 print result Are you sure you're not causing Java to overflow here?

Re: [Tutor] Can Anyone help with SMTP processiing

2010-04-17 Thread Alan Gauld
his as a proper script rather than using IDLEs >>> prompt(if thats what you are doing.) And then I'd run it from a DOS box to remove IDLE as a variable. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _

Re: [Tutor] How to map different keys together ?

2010-04-17 Thread Alan Gauld
key = self.mapping[tag] # get file specific tag fileData[key] = value # and use it # or self.value = fileData[key] approach this. I know I could manually assign each key to a class property (using the @property tag) ... but this seems tedious: That would defin

Re: [Tutor] How to map different keys together ?

2010-04-18 Thread ALAN GAULD
ving trouble. I feel there may be a way to pass functions through > my tag_map dictionary (maybe a lambda?!) but I can't get my head > around what approach is best Does what I've shown make sense? Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ __

Re: [Tutor] Python root.

2010-04-18 Thread Alan Gauld
can read more about import and modules in the "Modules and Functions" topic of my tutorial and more detail still in the "Whats in a name?" topic. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___

Re: [Tutor] Raw string

2010-04-18 Thread Alan Gauld
th same effect as raw string marker, as my problem must be solved differently? You might get some help from the os.path library functions. But to be honest I can't see anything obvious... You might have to resort to character by character replacement... HTH, -- Alan Gauld Author o

Re: [Tutor] List index usage: is there a more pythonesque way?

2010-04-18 Thread Alan Gauld
"C M Caine" wrote for i in range(len(timetable)): numDict[timetable[i]] += 1 if spaceDict['1st'+timetable[i]] == 0: spaceDict['nth'+timetable[i]] = i for index, item in enumerate(timetable): numDict[item] += 1 if spaceDict[

Re: [Tutor] List index usage: is there a more pythonesque way?

2010-04-19 Thread ALAN GAULD
> That's two new things I've learnt. I didn't realise that for loops > could be used like that (with more than one... key?). Technically its still one key but enumerate returns a tuple of index and value and we use tuple unpacking to assign the values to the loop variables. That is we could writ

Re: [Tutor] List index usage: is there a more pythonesque way?

2010-04-19 Thread Alan Gauld
a dictionary via the keys() method. More recently you can do it directly - although the effect is the same. There is no guarantee of order only that you process every item once. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _

Re: [Tutor] Need some info

2010-04-21 Thread Alan Gauld
ry asp[ect Wikipedia is a good start. For Python try both python.org and Activestate.com 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 opt

Re: [Tutor] classes passing information

2010-04-21 Thread Alan Gauld
help with. The classes aspect is just an extra layer of fog. Try my tutorial topic on Methods and Functions, 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

Re: [Tutor] number distribution

2010-04-22 Thread Alan Gauld
s whatever code you have tried to work, we can offer comments and ideas. In the meantime try looking at the documentation for the "random" module. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ __

Re: [Tutor] Class Inheritance

2010-04-23 Thread Alan Gauld
Do not change the standard library modules - they work just fine as they are. And because they are used by other modules beeaking one is likely to cause an avalanche effect. If you really think you can improve on them make a copy with a new name and change it. HTH, -- Alan Gauld Author o

Re: [Tutor] Binary search question

2010-04-23 Thread Alan Gauld
"Hugo Arts" wrote A binary search requires data to be sorted, but works in O(log n), so It will always be faster than a naive linear search like the in operator performs. Being picky but 'in' could be faster if the item searched for happens to be very near the front of the list. "Always" is

Re: [Tutor] Binary search question

2010-04-23 Thread Alan Gauld
in L is like L2 = sorted(L) if L2[bisect.bisect_left(x)] == x # untested! Might need bisect_right()... But only testing and timing would tell which was faster. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___

Re: [Tutor] Binary search question

2010-04-23 Thread Alan Gauld
he simplest solution and only if it really needs to go faster then optimise it. -- 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: ht

Re: [Tutor] Binary search question

2010-04-23 Thread Alan Gauld
. So 'in' looks pretty effective 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 options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] smtplib help required

2010-04-23 Thread Alan Gauld
"James Chapman" wrote import smtplib and when I run it, I get this: import email.utils ImportError: No module named utils And I can also confirm that email.utils exists Definitely looks like a fault in the install/configure setup. Is there an __init__.py file in the emails folder? B

Re: [Tutor] Binary search question

2010-04-24 Thread Alan Gauld
for 999 and -5 would be insignificant, because in both cases you have to walk the entire list. And sure enough, both take about half a second on my PC: Yes, I did try other values too, but by the "heartbeat test" (you should patent it! :-) they were all 'constant' time

Re: [Tutor] Class Inheritance, Beat it into the Ground

2010-04-24 Thread Alan Gauld
specialised Frame to produce a ScrolledCanvas which it uses to display the turtle. 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] Class Inheritance, Beat it into the Ground

2010-04-24 Thread Alan Gauld
ned so you only need to use the bits you actually need. 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.pyt

Re: [Tutor] sqrt?

2010-04-25 Thread Alan Gauld
do square roots on a simple number like 4??? It does on my system. -- 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] Which Designer

2010-04-25 Thread Alan Gauld
er? Or are you already comfortable with command line/console programs and its only the GUI stuff that is new? To really help we need to know more. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist

Re: [Tutor] Which Designer

2010-04-26 Thread Alan Gauld
d Tcl so once learned is oportable c) It is best documented with many books etc featuring it d) It is easy to learn the basic GUI principles that are valid in any Framework (a bit like learning Python is good becauise it helps you learn other languages) HTH, -- Alan Gauld Author of

Re: [Tutor] Programming pic chips with python

2010-04-26 Thread Alan Gauld
ase. 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] For loop breaking string methods

2010-04-26 Thread Alan Gauld
value) for value in L] I'd say nowadays that the comprehension was most common. -- 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] Modify inherited methods

2010-04-27 Thread Alan Gauld
ou do have access to the superclass source then you can make an informed decision. In general I'm too lazy to go looking for it and just put the super call in :-) HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _

Re: [Tutor] (no subject)

2010-04-28 Thread Alan Gauld
t;magasinmodele.txt") File "F:\School\University\Session 4\Programmation SIO\magasingolfvues.py", line 23, in __init__ ItemsFrame(contexte, item) NameError: global name 'item' is not defined >>> -- Alan Gauld Author of the Learn to Program web site http://

Re: [Tutor] date problems

2010-04-28 Thread Alan Gauld
"Eric Meigs" wrote I don't see how to read in a string and get it into a format for comparison. Have you loked at the time and datetime modules? They should do all you need. -- Alan Gauld Author of the Learn to Program web site http://w

Re: [Tutor] Python beginner having troubles understanding word listsand character lists

2010-04-28 Thread Alan Gauld
ist of words any time you want to process multiple words. For example a spelling checker may break a document into a list of words and compare each word to a reference list of correctly spelled words. A list of characters is rarely used in Python since you can use a string in almost every c

Re: [Tutor] Any

2010-04-29 Thread Alan Gauld
her level like Wize(?) or Installshield (or the free InstallMaker for Windows that I used to use... I don't know if its still extant however!) HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tuto

Re: [Tutor] Any

2010-04-29 Thread Alan Gauld
in the normal sense - although they are applications for developers of course! But they are much closer to Visual Studio than to MS Word... HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist -

Re: [Tutor] blackjack game

2010-04-29 Thread Alan Gauld
't expect us to do something you are not willing to at least make a start on... -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ # Blackjack # From 1 to 7 players compete against a dealer import cards, games class BJ_Card(cards.Card): """ A B

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread Alan Gauld
er speed or storage efficiency but the basic linked list in either language is about as simple as dynamic data gets. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsu

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread Alan Gauld
"spir ☣" wrote ...When writing "size = size + new_allocated" instead of "size = new_allocated", It get a growth pattern of: 0 3 6 9 16 24 33 43 54 66 80 96 114 Which is not exactly what is stated in code, but rather similar... You mean like this line in the source?: new_allocated += news

Re: [Tutor] Pattern for using multiple windows in Tkinter

2010-05-03 Thread Alan Gauld
A subclass of toplevel should do that but I confess I haven't actually done it. I might have a go later just for fun! -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org T

Re: [Tutor] List comprehension + lambdas - strange behaviour

2010-05-06 Thread Alan Gauld
nge(5)] Now you can do for f in funs: print f() and get the answer you expect. 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 subscr

Re: [Tutor] Is the difference in outputs with different size input lists due to limits on memory with PYTHON?

2010-05-06 Thread Alan Gauld
as it does with the original BASIC. 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] Programming microsoft excel

2010-05-07 Thread Alan Gauld
mming on Win32", it's a bit dated now but most of it is still valid. 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 option

Re: [Tutor] An interesting situation befalls me

2010-05-09 Thread Alan Gauld
not a primary revenue source it takes more than a change in technology to motivate a rewrite! And a few more suggestions: http://inventwithpython.com Learn Python the Hard Way: http://learnpythonthehardway.com/index These were both new ones to me, thanks for sharing! -- Alan Gauld Aut

Re: [Tutor] An interesting situation befalls me

2010-05-09 Thread Alan Gauld
"David Abbott" wrote Learning to Program by none other than Alan Gauld http://www.freenetpages.co.uk/hp/alan.gauld/ Thanks for the plug but the freenetpages site has been frozen for over 2 years. The current site (including the Python v3 version) is as in my .sig... -- Alan Ga

Re: [Tutor] An interesting situation befalls me

2010-05-09 Thread Alan Gauld
"Alan Gauld" wrote Learn Python the Hard Way: http://learnpythonthehardway.com/index These were both new ones to me, thanks for sharing! I've just finished skimming this one and its pretty good IMHO! My only gripe is the final "chapter" - "Advice from an

Re: [Tutor] Help required to count no of lines that are until 1000characters

2010-05-11 Thread Alan Gauld
# pseudo code chars = 0 for count, line in enumerate(file) if chars + len(line) < 1000 chars += len(line) else: break print "1000 chars read in", count, "lines" HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _

Re: [Tutor] (no subject)

2010-05-11 Thread Alan Gauld
ou running the commands? In a DOS box? Which OS version is it? I get a different error message in XP: C:\Documents and Settings\Alan Gauld>ghfghfghfh 'ghfghfghfh' is not recognized as an internal or external command, operable program or batch file. If it is a DOS box then what you are doing

Re: [Tutor] Help required to count no of lines that are until 1000 characters

2010-05-11 Thread Alan Gauld
"spir ☣" wrote Either you read line per line, but then you cannot stop exactly at the 1000th character; or you traverse the text char per char, but this is a bit picky. Or you could just read 1000 chars from the file then pick out the lines from that. But that requires you to count newlin

Re: [Tutor] Unable to run Programs on WINXP using Python3

2010-05-12 Thread Alan Gauld
ll else is doomed to fail! So I'd uninstall Python 3.1 and reinstall it. Then try again just starting up python3. Only after you have a basic Python3 program running try to get the bigger examples working. -- Alan Gauld Author of the Learn to Program we

Re: [Tutor] Help required to count no of lines that are until 1000 characters

2010-05-12 Thread Alan Gauld
"Dave Angel" wrote But you have a serious bug in your code, that nobody in the first five responses has addressed. That while loop will loop over the first line repeatedly, till it reaches or exceeds 1000, regardless of the length of subsequent lines. Oooh, good catch, I completely miss

Re: [Tutor] (no subject)

2010-05-12 Thread Alan Gauld
"Sivapathasuntha Aruliah" wrote Siva is it possible that you accidentally installed the 64-bit version of python 3.1? Luke I am not sure how to install 32 bit or 64 bit I cannot remember how I installed it. However I just checked and there are two downloads which are isted here. Is it the

Re: [Tutor] First steps for C++/Qt developers

2010-05-12 Thread Alan Gauld
ecoming an expert, now that's a different thing altogether - it took me about 4 years to reach that in C++ and about 1 year to lose it again! I'm still learning in Python after 10+ years! (Mainly because I don't use it for industrial stength projects) -- Alan Gauld A

Re: [Tutor] Character creator program

2010-05-12 Thread Alan Gauld
k at how I handled the invalid input situation in the "putting it all together" section for some ideas. -- 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] First steps for C++/Qt developers

2010-05-12 Thread ALAN GAULD
Forwarded to the list. Please use Reply All when posting. From: Walter Prins To: Alan Gauld Sent: Wednesday, 12 May, 2010 18:36:31 Subject: Re: [Tutor] First steps for C++/Qt developers Regarding IDE's: I find Eclipse with PyDev pretty good, and it recently gained support for D

Re: [Tutor] creating distribution lists in outlook

2010-05-12 Thread Alan Gauld
to Outlook was fairly obscure as I recall so it will likely take a fair bit of experimenting - the interactive prompt may be your friend here! -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tuto

Re: [Tutor] raw_input a directory path

2010-05-12 Thread Alan Gauld
which would be true if the directory was empty - or did not exist? Again use the print to check the directory is valid. Try using listdir() on it to see if it can read it. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] creating distribution lists in outlook

2010-05-13 Thread Alan Gauld
"Luke Paireepinart" 1000+ contacts in one contacts folder. When you create the distribution lists a number get cut off if you try to put too many into the list. But there is no indication of how many went into the list. I think Luke made a good point. This is usually done by businesses at

Re: [Tutor] creating distribution lists in outlook

2010-05-14 Thread Alan Gauld
"Pirritano, Matthew" wrote It does seem like the python solution is going to be too labor intensive. As with many such issues I thought it would be a fun challenge to see if I could get it to work. : ) You probably could, but there is another way. Python does not have Outlook's limitations

Re: [Tutor] application with tabs

2010-05-14 Thread Alan Gauld
en't tried this yet... http://puretkgui.sourceforge.net/ I'm hoping to add a page to my tutorial on the use of both Tix and ttk in the new Python v3 version, if I ever get time to finish it! -- Alan Gauld Author of the Learn to Program web sit

Re: [Tutor] First steps for C++/Qt developers

2010-05-14 Thread Alan Gauld
"M. Bashir Al-Noimi" wrote > Although, I personally am a bit biased towards: > http://www.cherrypy.org/ In simple words could you give me what's distinguished differences between cherrypy and django (I didn't stat with django cuz I'm still python principles)? They work a little differently

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