Re: [Tutor] Why won't it enter the quiz?

2005-09-19 Thread Adam
You're not returning the values of answer and guess so it jumps out of the while loop and does the else. Try this: def add(a,b):     answer = a+b     guess = float(raw_input(a," + ",b," = "))     return answer, guess answer, guess = add(num1,num2) if guess != answer:On 17/09/05, Nathan Pinno <[

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-26 Thread Adam
Can I have a look at the password program by any chance? Tutor maillist  -   Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-27 Thread Adam
ord in the source code.On 27/09/05, Nathan Pinno <[EMAIL PROTECTED]> wrote: No problem Adam. Glad you decided to take a look and see. Tell the group what your honest opinion is after looking at the file. - Original Message ----- From: Adam To: Nathan Pinno

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-27 Thread Adam
money you'll need something more original or just a lot better than the competition. On 27/09/05, Nathan Pinno <[EMAIL PROTECTED]> wrote: No problem Adam. Glad you decided to take a look and see. Tell the group what your honest opinion is after looking at the file. -

Re: [Tutor] Reformatting a one (long) line xml file

2005-09-28 Thread Adam
BeautifulSoup is a brilliant module for this kind of thing. Just make an instance of a parser feed() in the file with file.read() then .prettify()On 28/09/05, Negroup - <[EMAIL PROTECTED]> wrote: Hi all, I have an xml file where the tags are all on the same line,without any newline. This file is qu

Re: [Tutor] call a def/class by reference

2005-09-28 Thread Adam
How about something like this def foo(bar):     print bar d = {"foo":foo} s = "foo" params = "bar" try: d[s](params) except: KeyError Then you can just put the allowed functions into the dictionary.On 29/09/05, DS <[EMAIL PROTECTED] > wrote:Is it possible to call a function or class by reference

Re: [Tutor] Accessing Variables

2005-10-05 Thread Adam
What you can do is if ONE.py has a class with the variable a, in it, you can pass the class instance (ie. self) and then you can call any function or get any global class variable. eg def foo(parent):     print parent.aOn 05/10/05, Matt Williams <[EMAIL PROTECTED]> wrote: Dear List,I'm trying to cl

Re: [Tutor] comiling python to microchip?

2005-10-12 Thread Adam
On 12/10/05, Jeff Peery <[EMAIL PROTECTED]> wrote: is it possible to take python code and compile it for use in a microprocessor? ___Tutor maillist  -  Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Building on what Alan said this may be

[Tutor] Any good Glade and python tutorials?

2005-10-15 Thread Adam
I'm making a Twisted app that needs a client side GUI and GTK seems like the best way to go about this. Can anybody point me in the direction of any decent tutorials on how to use Glade with python and pyGTK. Thanks. Adam. ___ Tutor maillist -

Re: [Tutor] IDLE will not appear under Win95 (Python 2.4.2)

2005-10-16 Thread Adam
On 16/10/05, Dave Shea <[EMAIL PROTECTED]> wrote: Hi Adam,Thanks for your reponse. I tried your suggestion of starting IDLE via thecommand line.Using the command and parameter line that install created behind the Python(IDLE) icon on my Start menu: C:\WINDOWS\DESKTOP>"C:\Program

Re: [Tutor] removal

2005-10-22 Thread Adam
Do it yourselfOn 23/10/05, Patrick Nagle <[EMAIL PROTECTED]> wrote: please remove me from your tutor mailing list.Cheers--Patrick J. Nagle_Pocket Rocket FX___Tutor maillist  -   Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor __

Re: [Tutor] File IO Help again

2005-10-27 Thread Adam
>if line[:1] == "1": This line won't work because you're getting the first 2 characters from the line and seeing if it's equal to a string of length one. For example in your test file if you put this line, 1      12.4    12.0    *   10 , through that bit of code it would see if "1 " == "1", which

Re: [Tutor] nokia 60 series

2005-10-28 Thread Adam
On 28/10/05, Mohammad Moghimi <[EMAIL PROTECTED]> wrote: Hi As you know nokia company lauched python for its cell phones. Do you know a good tutorial to write python programs for cellphones?-- -- Mohammaddo you Python?!! ___Tutor maillist  -  Tutor@pytho

Re: [Tutor] help with prime number program

2005-10-30 Thread Adam
    > 1.  What is 'exit'? instead of exit I can use break so that the loop will stop executing> 2.  What is 'number - math.sqrt'?for math.sqrt I could use math.sqrt(n) so that it would take the sqrt of nwhich is entered in by the userHowever for the output I am still receivingenter a numbe

[Tutor] Comments, bug report and/or feature requests for my program please.

2005-11-09 Thread Adam
ACS is a program to verify checksums of files (sha1 and md5) from the command line. It allows you to check for the sum in local and remote files via ftp or http. Any comments on the code would be good along with anything in the subject. Cheers. Adam

[Tutor] Fwd: Comments, bug report and/or feature requests for my program please.

2005-11-09 Thread Adam
ACS is a program to verify checksums of files (sha1 and md5) from the command line. It allows you to check for the sum in local and remote files via ftp or http. Any comments on the code would be good along with anything in the subject. Cheers. Adam err woops this might be useful link

Re: [Tutor] Help me

2005-11-15 Thread Adam
On 15/11/05, sivapriya pasupathi <[EMAIL PROTECTED]> wrote: Hi There, I am planning to start my career in computer programming.But i don't have specific resource(websire/book) to improve my basic computer programming skills.If you know any helpful resources,please let me know.   Thanks in advanc

Re: [Tutor] Is it a good idea to use TKInter to change my password program into a GUI?

2005-11-28 Thread Adam
Hello Nathan, glad to see you're still working on this. I don't think I can improve on Danny's info on the GUI but I'll add this. You might want to try the Python Cryptography Toolkit to encrypt the password files and maybe encrypting the file as a binary pickle will add a little bit more security

[Tutor] How to make to exit the loop, while typing Enter

2006-01-03 Thread Adam
Woops, forgot to reply-all.-- Forwarded message --From: Adam <[EMAIL PROTECTED]>Date: 03-Jan-2006 15:48 Subject: Re: [Tutor] How to make to exit the loop, while typing EnterTo: John Joseph <[EMAIL PROTECTED]> array = []m = 0print "Enter  to exit"m = int(raw_in

Re: [Tutor] Avoiding repetetive pattern match in re module (fwd)

2006-01-05 Thread Adam
On 05/01/06, Danny Yoo <[EMAIL PROTECTED]> wrote: -- Forwarded message --Date: Fri, 6 Jan 2006 01:53:41 +0530From: Intercodes <[EMAIL PROTECTED]>To: Danny Yoo < [EMAIL PROTECTED]>Subject: Re: [Tutor] Avoiding repetetive pattern match in re moduleHello Danny,Thanks for the response.

Re: [Tutor] Learning to use pygame but running into errors when using examples from websites

2006-01-14 Thread Adam
On 14/01/06, Rinzwind <[EMAIL PROTECTED]> wrote: Hello,I've been trying to get myself to learn using pygame. I have created some things but I still need help of examples before I can do it myself but I always run  into trouble.On this website I saw a lot of great info regarding pygame: http://www.i

[Tutor] Fwd: Strings backwards

2006-01-18 Thread Adam
On 18/01/06, ryan luna <[EMAIL PROTECTED] > wrote: Hello, what i need to do is get user input and thenprint the string backwards ^^ i have no idea how to dothat,print "Enter a word and i well tell you how to say itbackwards"word = raw_input("Your word: ") print wordall that is simple enough im sure

Re: [Tutor] Strings backwards

2006-01-18 Thread Adam
On 18/01/06, ryan luna <[EMAIL PROTECTED]> wrote: --- Adam <[EMAIL PROTECTED]> wrote:> On 18/01/06, ryan luna <[EMAIL PROTECTED]>> wrote: > >> > Hello, what i need to do is get user input and> then> > print the string backwards ^^ i have no idea how>

Re: [Tutor] Jumble

2006-01-18 Thread Adam
On 19/01/06, ryan luna <[EMAIL PROTECTED]> wrote: Ok so what i have to do is make it so when a playerask for a hint the program display a hint, heres myloop, not whole script.guess = raw_input("\nYour guess: ")guess = guess.lower()while (guess != correct) and (guess != ""): print "Sorry, that's

Re: [Tutor] Iterating over a string: index and value

2006-02-10 Thread Adam
Here's a list comprehension which does it:>>> print [(i, ord(v)) for i, v in enumerate("abcdefg")][(0, 97), (1, 98), (2, 99), (3, 100), (4, 101), (5, 102), (6, 103)]and a for loop: >>> for i, v in enumerate("abcdefg"):... tuplseq.append((i, ord(v)))...>>> tuplseq[(0, 97), (1, 98), (2, 99), (3,

Re: [Tutor] problems with the shebang line and linux

2006-02-16 Thread Adam
On 16/02/06, Brian van den Broek <[EMAIL PROTECTED]> wrote: Hi all,I've switched to Linux fairly recently and am still at the fumblingabout stage :-)  I'm having a devil of a time with the shebang lineand running a py file from a command line.I wrote the following little test script with IDLE 1.1.

Re: [Tutor] problems with the shebang line and linux

2006-02-17 Thread Adam
On 16/02/06, David Rock <[EMAIL PROTECTED]> wrote: * Adam <[EMAIL PROTECTED]> [2006-02-16 14:23]:> On 16/02/06, Brian van den Broek <[EMAIL PROTECTED]> wrote: >> It seems to me that that ^M is your problem although I'm not quite sure> where it came from there se

Re: [Tutor] Generating small random integer

2006-02-19 Thread Adam
On 19/02/06, Kermit Rose <[EMAIL PROTECTED]> wrote: Hello.How can I find documentation on the random number generator function.It's not listed in the math module.You might want to try the random module.In general,  how can I find documentation on any particular function if I don't know what module

Re: [Tutor] import of source code still not working

2006-02-20 Thread Adam
On 20/02/06, Kermit Rose <[EMAIL PROTECTED]> wrote:     From: Jason Massey Date: 02/20/06 12:20:03 To: Kermit Rose Cc: tutor@python.org Subject: Re: [Tutor] import of source code still not working   If you don't want to have to put the factor30 in front of all your function names you can d

Re: [Tutor] Locking a file in linux with Python

2006-02-22 Thread Adam
You could try setting up a seperate user and then changing permissions on the file so that only that user can access it then change it back when you've finished. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Translator

2006-02-22 Thread Adam
If you want to do genuine translation, like English to French or something, then, well, ask someone who works at Google :-)Guido? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] One shared object. class attribute or global variable?

2006-03-03 Thread Adam
I've got a module that needs to share a pack of cards pack = ["14s", "2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", "10s", "11s", "12s", "13s", "14d", "2d", "3d", "4d", "5d", "6d", "7d", "8d", "9d", "10d", "11d", "12d", "13d", "14c", "2c", "3c", "4c", "5c", "6c", "7c", "8c", "9c", "10

Re: [Tutor] One shared object. class attribute or global variable?

2006-03-03 Thread Adam
On 04/03/06, Adam <[EMAIL PROTECTED]> wrote: > I've got a module that needs to share a pack of cards > > pack = ["14s", "2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", "10s", &qu

[Tutor] how to read a text file, and find items in it

2006-03-08 Thread adam
on Thanks! Adam My script so far is this: - import fileinput print print "Welcome to LIST YOUR FILEINS script" print print "STEP 01" print "drag'n'drop your script from the Finder here" script = raw_input(">

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Adam
Here's something you might find useful they've just started a series on cryptography on this site, you can read them or listen to a podcast. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Adam
On 14/03/06, Adam <[EMAIL PROTECTED]> wrote: > Here's something you might find useful they've just started a series > on cryptography on this site, you can read them or listen to a > podcast. > D'oh! Would help if I actually stuck the link in http

Re: [Tutor] Splitting a string into n-sized bytes

2006-03-14 Thread Adam
On 14/03/06, Steve Nelson <[EMAIL PROTECTED]> wrote: > Hello all, > > Further to my previous puzzling, I've been working out the best way to > chop a string up into n-sized words: > > I'm aware that I can use a slice of the string, with, eg, myWord[0:4]. > > I am also aware that I can do blob = myW

Re: [Tutor] Tix: binding

2006-03-15 Thread Adam
On 15/03/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am looking at Tix and I am stuck with what seems to be a simple problem: > > I want to bind the cancel buttom of a ExFileSelectBox to a routine in my > class, but can not make it work. > I guess the problem is the same for any binding o

Re: [Tutor] Test If File System is mounted in Linux

2006-03-17 Thread Adam
On 17/03/06, Bill Campbell <[EMAIL PROTECTED]> wrote: > On Fri, Mar 17, 2006, Michael Lange wrote: > >On Fri, 17 Mar 2006 00:36:35 -0700 > >fortezza-pyt <[EMAIL PROTECTED]> wrote: > > > >> If there a semi-standard way to test if a file system has been mounted > >> or not using Python? In the Linux

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Adam
I just wanted to throw in a couple of ideas for you on this subject. These are the ways I would personally think of going about this problem: >>> ''.join([s[n] for n in range(len(s)-1, -1, -1)]) 'rac' Which looks a bit fugly but is nice and short if you can manage list comps. and now my favourite

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Adam
> Hi John, > > We are almost there. I changed the code and, at least, > I got the correct output. However, I also got a > traceback. I didn't understand the traceback. Could > you clarify that? > Thanks, > Hoffmann > ps: The new code: > > >>> vehicle='car' > >>> index = -1 #index of the last lette

Re: [Tutor] Question about list

2006-04-10 Thread Adam
On 10/04/06, Hoffmann <[EMAIL PROTECTED]> wrote: > Hello, > > I have a list: list1 = [ 'spam!', 2, ['Ted', 'Rock'] > ] > and I wrote the script below: > > i = 0 > while i < len(list1): > print list1[i] > i += 1 > > Ok. This script will generate as the output each > element of the original

Re: [Tutor] String question.

2006-04-13 Thread Adam
How's this?: >>> s = """All, ... ... I have a problem/question I'd like to pose to you guys on how best to ... accomplish the following. I have a string that will vary in size, what ... I would like to do is split into n size chunks. I am also not sure how ... best to represent the chunks. For e

Re: [Tutor] plz help

2006-04-14 Thread Adam
> John Brokaw <[EMAIL PROTECTED]> wrote: > Date: Thu, 13 Apr 2006 13:07:23 -0400 > From: "John Brokaw" <[EMAIL PROTECTED]> > To: "David Holland" <[EMAIL PROTECTED]> > Subject: Re: Show us some code > > > Sure... > >>> import pygame, sys,os > >>> from pygame.locals import * > >>> pygame.init() > (6

Re: [Tutor] plz help

2006-04-14 Thread Adam
On 14/04/06, John Brokaw <[EMAIL PROTECTED]> wrote: > Adam, Yes i have and thanks for trying to help. I guess I need to be more > specific with my question. I need to know why this is happening and will it > happend if a put together a complete game. I can close the window with the

Re: [Tutor] functions in Python

2006-04-17 Thread Adam
On 17/04/06, Payal Rathod <[EMAIL PROTECTED]> wrote: > Hi, > I am now reading Alan's tut on Python, before that I have read a few other > tuts too. > But I am not getting functions exactly. I mean what is the difference between, > > def func(): > > > and > > def func(x): > ...

Re: [Tutor] Python Challange - ord chr incrementing alphabet

2006-06-20 Thread Adam
On 20/06/06, Paul D. Kraus <[EMAIL PROTECTED]> wrote: I just started doing the python challenges and was doing the one where the hint is 3 letters each shifted two places to the right.No big deal just ord / chr and some tests to handle looping past z.I got my answer. Then reading the solutions i se

[Tutor] Here's some interesting float oddness.

2006-06-26 Thread Adam
I tried this expecting an exceptionIn [2]: math.tan(math.pi/2)Out[2]: 16331778728383844.0so I thought maybe that was a float limit which it probably is as you get weird results from higher values but it seems strange that it tries to run with it. In [5]: 16331778728383844.0Out[5]: 16331778728383844

Re: [Tutor] Moved Python installation. Need advice rebuilding all *.pyc

2006-07-03 Thread Adam
On 03/07/06, Andreas <[EMAIL PROTECTED]> wrote: Hi,I thought, this would be more easy. I wonder why the PYTHONPATH is notbeing considered here, but instead I find the path to modules beinghardcoded  in the *.pyc file.I have about 50 3rd party modules installed and I moved my Python installation fro

Re: [Tutor] Moved Python installation. Need advice rebuilding all *.pyc

2006-07-04 Thread Adam
On 03/07/06, Andreas <[EMAIL PROTECTED]> wrote: On 03.07.2006 20:45 Adam wrote> Erm trying to remember exactly how to do this in windows but if you do the> equivalent of an rm -r E:\Python24\site-packages\*.pyc ie remove all the> *.pyc files they will be rebuilt as and when you ne

Re: [Tutor] How do you implement a config file?

2006-07-16 Thread Adam
s. Thispost might give you some clues: http://groups.google.com/group/comp.lang.python/browse_frm/thread/775dabe0a5e63f4f/f3bb17d8c7377aad?q=import+imp&rnum=3#f3bb17d8c7377aadKentI tried this out and the simplest way seems to be something like this: import impconfig = imp.load_source('conf

[Tutor] Benefit/Disadvantage to storing data as dictionary vs. in a class

2012-06-01 Thread Adam
85][AVG]; however is this better/worse or the same as creating a 'Room' class to store the data? Since a 'Room' only contains a large amount of data, but doesn't contain any functions, which form of storing the data is considered 'better'? Thank you, Ada

Re: [Tutor] Benefit/Disadvantage to storing data as dictionary vs. in a class

2012-06-01 Thread Adam
7;readings':[]} and having the Room class hold the update function; not so much from good programming practices, but more attempting to number of resources the class will be using. Thank you, Adam On 6/1/2012 10:24 AM, James Reynolds wrote: If you have functions (or in this case methods) w

Re: [Tutor] Address book sort of (fwd)

2004-12-05 Thread Adam Cripps
tor > This sounds slightly similar to one of my first applications in Python using object orientated design: https://savannah.nongnu.org/projects/newmag - which is a magazine catalogue. Feel free to browse the code, and reuse if you wish (under conditions of the license). It creates objects, and

Re: [Tutor] smtp project

2010-01-18 Thread Adam Bark
hen send an email with these changes to a mailing list via a googlemail account. Anyway there should be some useul code in it http://cubesat.wikidot.com/wiki-change-emailer HTH Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscrip

Re: [Tutor] Is wxPython (development) dead?

2010-01-28 Thread Adam Bark
On 27 January 2010 13:57, Neven Goršić wrote: > Since May of 2009 there has not been any update and now web page is not > available any more ... > The website is back up now. I guess there was a server issue of some sort. ___ Tutor maillist - Tutor@py

Re: [Tutor] reading binary file on windows and linux

2010-05-09 Thread Adam Bark
i, data, chr(data) > source.seek(0, 2) > print source.tell() > > > Any suggestions are highly appreciated. > > Cheers, > > Jan > I'd guess that it's because newline in windows is /r/n and in linux it's just /n. If you read the fi

Re: [Tutor] Unable to run a simple Hello.py in WinXP

2010-05-17 Thread Adam Bark
On 17 May 2010 09:05, Sivapathasuntha Aruliah < sivapathasuntha.arul...@amkor.com> wrote: > > Hi > If possible please run the following two lines after *saving it as a py > file on WINXP* and check whether it runs smooythly. *When I run I get > error. *I use Python 3.1.2 (r312:79149, Mar 21 2010,

Re: [Tutor] Unable to run a simple Hello.py in WinXP

2010-05-17 Thread Adam Bark
On 18 May 2010 01:30, Sivapathasuntha Aruliah < sivapathasuntha.arul...@amkor.com> wrote: > > > > > > *Adam Bark * > > > *05/18/2010 01:21 AM* > To > Sivapathasuntha Aruliah/S1/a...@amkor > cc > tutor@python.org > Subject > R

[Tutor] Strange range and round behaviour

2010-06-07 Thread Adam Bark
Just out of curiosity does anyone know why you get a deprecation warning if you pass a float to range but if you use round, which returns a float, there is no warning? Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "lice

Re: [Tutor] Converting audio samples from 16-bit signed int to float?

2010-06-20 Thread Adam Bark
On 20 June 2010 23:52, Joe Veldhuis wrote: > Hello all. I'm writing a program that needs to capture audio from a > soundcard and run FFTs to determine peak frequency for further processing. > The soundcard's native capture format is 16-bit little-endian signed integer > samples (values 0-65535),

Re: [Tutor] New to this

2010-06-20 Thread Adam Bark
On 20 June 2010 19:38, Neil Thorman wrote: > I'm picking this up as a hobby really, not having done any programming > since Acorn I'm pretty much starting form scratch (and even back in the > BASIC day I never really got to grips with files). > This is from Alan Gauld's Learning to Program: Handl

Re: [Tutor] Repeat function until...

2010-06-23 Thread Adam Bark
to leave the loop you will need to use "break", you will probably want an if statement and change the value of some variable when you want to stop calling the function and break out of the loop. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] capturing error msg in exception

2010-06-27 Thread Adam Bark
On 27 June 2010 17:47, Payal wrote: > Hi, > Again a few queries regarding exceptions, > > a. What is the difference between, > > except ZeroDivisionError as e: print 'Msg : ' , e > except ZeroDivisionError ,e: print 'Msg : ' , e > > Both show, > Msg : integer division or modulo by zero > > b. Wh

Re: [Tutor] capturing error msg in exception

2010-06-27 Thread Adam Bark
On 27 June 2010 18:22, Steve Willoughby wrote: > On 27-Jun-10 10:12, Adam Bark wrote: > >> On 27 June 2010 17:47, Payal > > > c. What is the correct Python of writing, >>except as e: print 'Msg : ' , e# Capturing all exceptions >> >

Re: [Tutor] capturing error msg in exception

2010-06-28 Thread Adam Bark
On 28 June 2010 00:27, Steven D'Aprano wrote: > On Mon, 28 Jun 2010 03:12:39 am Adam Bark wrote: > > > I think the 'as' syntax is only available in Python 3.x > > You think wrong. It is available from Python 2.6 onwards. > I know, I corrected myself a

[Tutor] What is super for?

2010-06-28 Thread Adam Bark
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? Thanks. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.pytho

Re: [Tutor] What is super for?

2010-06-28 Thread Adam Bark
On 28 June 2010 17:15, 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? > > Thanks. > Whoops I should really think about these things for a minute first, you do

Re: [Tutor] "x and y" means "if x is false, then x, else y"??

2010-07-05 Thread Adam Bark
> x is True > True > > So it can! That surprised me. I was expecting "x = (5 > 4)" to be > absurd -- raise an exception? Still seems pretty weird. > Greater than (>) works like the mathematical operators in returning a value, it just happens that for comparison operators (>, <, ==, !=) the values can only be True or False. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] "x and y" means "if x is false, then x, else y"??

2010-07-05 Thread Adam Bark
On 5 July 2010 13:21, Adam Bark wrote: > On 5 July 2010 12:53, Richard D. Moores wrote: > >> On Mon, Jul 5, 2010 at 04:09, Stefan Behnel wrote: >> > Richard D. Moores, 05.07.2010 11:37: >> >> >> >> I keep getting hung up over the meaning of "

Re: [Tutor] newbie to gui programming

2010-07-06 Thread Adam Bark
On 6 July 2010 18:09, Payal wrote: > Hi all, > Some background before the actual query. > A friend of mine, an electronics engineer has a > small co. He had a computer engg. with him who used to design GUI > front-ends > for his products in Visual Basic. These apps used to take data from > serial

Re: [Tutor] Function returns 'None'

2010-07-11 Thread Adam Bark
you can see recursfac(1,6) returns it's value (carryover) to recursfac(2, 3) which ignores it and completes it's execution ie returning None to your original call which then prints out that return value. I hope that's clear. Adam. _

Re: [Tutor] Path?

2010-07-11 Thread Adam Bark
or the filemanager and allow it to see files in the current directory? Thanks, Jim Maybe create a bash script to call the python code something like: #!/bin/bash cd /directory/the/scripts/are/in python script_name HTH, Adam. PS if you want to use the same script for any python script you

Re: [Tutor] Python Documentation Clarification

2010-07-12 Thread Adam Bark
gt; > Just not grokking it correctly and I can't seem to track down where the > documentation formatting is defined within the python.org documentation... > > You're about right really, it's a keyword argument which means it will have a default

Re: [Tutor] Path?

2010-07-13 Thread Adam Bark
On 13 July 2010 14:43, Jim Byrnes wrote: > Steven D'Aprano wrote: > > My apologizes to Steven and the list, when I replied originally I messed up > and sent it to him privately which was not my intention. > > > > > On Mon, 12 Jul 2010 03:42:28 am Jim Byrnes wrote: > >> I am running Ubuntu. I dow

Re: [Tutor] Path?

2010-07-13 Thread Adam Bark
On 13 July 2010 23:27, Jim Byrnes wrote: > Adam Bark wrote: > >> On 13 July 2010 14:43, Jim Byrnes wrote: >> >> Steven D'Aprano wrote: >>> >>> My apologizes to Steven and the list, when I replied originally I messed >>> up >

Re: [Tutor] Path?

2010-07-14 Thread Adam Bark
On 14 July 2010 02:53, Jim Byrnes wrote: > Adam Bark wrote: > > > > > If I use the terminal to start the program it has no problem using the >>>>> file. There are multiple files in multiple directories so I was >>>>> looking >>>>&

Re: [Tutor] Path?

2010-07-14 Thread Adam Bark
On 14 July 2010 17:41, Jim Byrnes wrote: > Adam Bark wrote: > >> On 14 July 2010 02:53, Jim Byrnes wrote: >> >> Adam Bark wrote: >>> >>> >>> >>> >>> If I use the terminal to start the program it has no problem using the &

Re: [Tutor] Path?

2010-07-15 Thread Adam Bark
On 15 July 2010 17:21, Jim Byrnes wrote: > Adam Bark wrote: > >> On 14 July 2010 17:41, Jim Byrnes wrote: >> >> Adam Bark wrote: >>> >>> On 14 July 2010 02:53, Jim Byrnes wrote: >>>> >>>> Adam Bark wrote: >>>>

Re: [Tutor] "x and y" means "if x is false, then x, else y"??

2010-07-22 Thread Adam Bark
On 6 July 2010 02:05, Lie Ryan wrote: > On 07/05/10 22:23, Adam Bark wrote: > > > > > I should add that this is how something like: > > > > if x != y: > > do_something() > > > > works, if expects a True or False (this isn't always true bu

Re: [Tutor] Lost in the control flow

2010-08-10 Thread Adam Bark
o unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor The problem is you don't call make_dict unless there's a "FUEL SURCHARGE" or multiple pins. Also you don't add the first pin to mydict["tracking"] unless there's a "FUEL SURCHARGE". HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] elif statement

2010-08-10 Thread Adam Bark
>> if x==2: print x ... elif x&1 == 1: print 'x is odd' ... elif x&1 ==0: print 'x is even' ... x is odd If I am pressing two Enters, the code executes; so I have a elif without a if, and again, a syntax error. What am I not doing right? Thank you. Sudarshana. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Lost in the control flow

2010-08-13 Thread Adam Bark
On 11/08/10 18:14, Eduardo Vieira wrote: On Tue, Aug 10, 2010 at 1:56 PM, Adam Bark wrote: The problem is you don't call make_dict unless there's a "FUEL SURCHARGE" or multiple pins. Also you don't add the first pin to mydict["tracking"] unless the

Re: [Tutor] Serial communication ...

2010-09-13 Thread Adam Bark
On 13/09/10 16:36, Markus Hubig wrote: Hi @all! I'm about to write a class for serial communication on Win32 and Linux which provides a method called "talk" to send something over the serial line, wait for the answer and returns it. My problem is, that I don't know how long the answer will b

Re: [Tutor] What's the best way to ask forgiveness here?

2010-09-13 Thread Adam Bark
On 13/09/10 19:31, Brian Jones wrote: I've been coding Python long enough that 'asking forgiveness instead of permission' is my first instinct, but the resulting code is sometimes clumsy, and I wonder if someone can suggest something I'm missing, or at least validate what's going on here in som

Re: [Tutor] What's the best way to ask forgiveness here?

2010-09-13 Thread Adam Bark
On 13/09/10 20:12, Brian Jones wrote: Thanks for the replies so far. One thing that's probably relevant: once a directory is created, I can expect to write a couple of hundred files to it, so doing a 'try os.makedirs' right off the bat strikes me as coding for the *least* common case instead of

Re: [Tutor] How to numerically sort strings that start with numbers?

2010-09-13 Thread Adam Bark
On 14/09/10 01:11, Pete O'Connell wrote: theList = ["21 trewuuioi","3zxc","134445"] print sorted(theList) Hi, the result of the sorted list above doesn't print in the order I want. Is there a straight forward way of getting python to print ['3zxc','21 trewuuioi','134445'] rather than ['134445',

Re: [Tutor] How to numerically sort strings that start with numbers?

2010-09-13 Thread Adam Bark
27;21 trewuuioi', '3zxc', '134445'] >>> theList = sorted(theList) >>> theList ['134445', '21 trewuuioi', '3zxc'] >>> theList[::-1] ['3zxc', '21 trewuuioi', '134445'] >>> theList.

Re: [Tutor] selecting elements from dictionary

2010-09-15 Thread Adam Bark
On 15/09/10 15:31, Hs Hs wrote: Dear Steven, Thanks for your help. however I have a question, using: for key, value in xdic.items(): if 1 in value and 2 in value or 3 in value: print key also print keys that have values such as [1,2,3]. In cases where there is [1,2,3] and [1,2]

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Adam Bark
__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert',

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Adam Bark
On 11/10/10 23:52, Steven D'Aprano wrote: On Tue, 12 Oct 2010 01:55:10 am Adam Bark wrote: On 11/10/10 15:29, Denis Gomes wrote: Thank you both for your responses. I do have one other question if I use the method both of you describe. How do I go about implementing slicin

Re: [Tutor] pickle problem

2010-10-12 Thread Adam Bark
oad() File "C:\Python27\lib\pickle.py", line 858, in load dispatch[key](self) KeyError: '<' What does this mean ? It means that it's trying to access a sequence with the key '<' but it's not working. It looks lik

Re: [Tutor] Merging Text Files

2010-10-14 Thread Adam Lucas
Either way; nest the for loops and index with protein IDs or dictionary one file and write the other with matches to the dictionary: non-python pseudocode: for every line in TWO: get the first protein ID for every line in ONE: if the second protein ID is the same as the first:

Re: [Tutor] Merging Text Files

2010-10-14 Thread Adam Lucas
Whoops: 1) dictionary.has_key() ??? 2) I don't know if it's a typo or oversight, but there's a comma in you dictionary key, line.split(',')[0]. 3) Forget the database if it's part of a larger workflow unless your job is to adapt a biological workflow database for your lab. On Thu, Oct 14, 2010

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 19:29, David Hutto wrote: On Thu, Oct 14, 2010 at 2:19 PM, Sander Sweers wrote: On 14 October 2010 16:14, David Hutto wrote: (u'graph1', u'Line', u'222', u'BLUE', u'1,2,3,4', u'True', u'0,5,0,10') Which is a tuple of unicode strings. From this I need to place portions o

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 20:21, David Hutto wrote: On Thu, Oct 14, 2010 at 2:58 PM, Adam Bark wrote: Actually, I needed it to be converted to something without a string attached to it. See a post above, and it was fixed by eval(), Thanks though. And I'm sure at some point this morning in a mome

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 20:33, David Hutto wrote: On Thu, Oct 14, 2010 at 3:31 PM, David Hutto wrote: On Thu, Oct 14, 2010 at 3:24 PM, Adam Bark wrote: On 14/10/10 20:21, David Hutto wrote: On Thu, Oct 14, 2010 at 2:58 PM, Adam Barkwrote: Actually, I needed

Re: [Tutor] Merging Text Files

2010-10-14 Thread Adam Lucas
nd removes commas. On Thu, Oct 14, 2010 at 13:43, Adam Lucas wrote: > Whoops: > > 1) dictionary.has_key() ??? > 2) I don't know if it's a typo or oversight, but there's a comma in you > dictionary key, line.split(',')[0]. > 3) Forget the database if it's

Re: [Tutor] What does "TypeError: 'int' object is not iterable"mean?

2010-10-23 Thread Adam Bark
On 23/10/10 13:38, Alan Gauld wrote: "Steven D'Aprano" wrote It would have to be a *very* old version. The use of * as the width parameter in format strings goes back to the Dark Ages of Python 1.5: ... I believe this is a virtual copy of string formatting from C, in which case it probably go

Re: [Tutor] searching for newlines does not work!

2010-10-23 Thread Adam Bark
character 'n'. In your first example you put the characters into the string test and replaced the characters. The second example you have actual newlines and are searching for the characters "/n" which don't exist in your string. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

  1   2   3   4   >