Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
On 09/06/2012 05:34 PM, Steven D'Aprano wrote: > On 07/09/12 01:33, Ray Jones wrote: > >> Our homework "monitor" complains if we use code that hasn't been >> discussed in session yet. > > The good old "teaching by enforced ignorance" method. > Actually I like what they're doing. First of all, this

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
On 09/06/2012 05:31 PM, Steven D'Aprano wrote: > On 06/09/12 23:56, Ray Jones wrote: >> I have a multiple 'if' expression that I need to drastically reduce in >> size, both for readability and to keep errors from creeping in. >> >> For example, I would like to have the variable 'test' point to the

Re: [Tutor] How to get MAC address using Python at windows 7

2012-09-06 Thread Steven D'Aprano
On 06/09/12 23:44, bob gailer wrote: On 8/18/2012 10:12 AM, šãñ wrote: I need to find some way how i can get mac address of windows 7 in python. Windows 7 does not have a MAC address. It is an operating system. Ethernet adapters have MAC addresses. Your computer will have one or more Ethernet

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Steven D'Aprano
On 07/09/12 01:33, Ray Jones wrote: Our homework "monitor" complains if we use code that hasn't been discussed in session yet. The good old "teaching by enforced ignorance" method. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe o

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Steven D'Aprano
On 06/09/12 23:56, Ray Jones wrote: I have a multiple 'if' expression that I need to drastically reduce in size, both for readability and to keep errors from creeping in. For example, I would like to have the variable 'test' point to the a location 'grid[rcount-1][ccount-1]' so that everywhere I

Re: [Tutor] Help

2012-09-06 Thread Mark Lawrence
On 03/09/2012 15:39, Jack Little wrote: Ok, I am somewhat new to python, and I am making a text-based RPG. I get a weird error with this code: [snip] Thanks, Jack Little Further to the sound advice you've already been given a rather more informative subject line would have been helpfu

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
On 09/06/2012 10:05 AM, Alan Gauld wrote: > On 06/09/12 14:56, Ray Jones wrote: >> I have a multiple 'if' expression that I need to drastically reduce in >> size, both for readability and to keep errors from creeping in. >> >> For example, I would like to have the variable 'test' point to the a >>

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Alan Gauld
On 06/09/12 14:56, Ray Jones wrote: I have a multiple 'if' expression that I need to drastically reduce in size, both for readability and to keep errors from creeping in. For example, I would like to have the variable 'test' point to the a location 'grid[rcount-1][ccount-1]' so that everywhere I

Re: [Tutor] python wifi

2012-09-06 Thread Jerry Hill
On Thu, Sep 6, 2012 at 12:43 AM, Sales wrote: > Hello, > I'm trying to install python wifi using easy install. I have python27 and > working on mac os. from a shell I'm running: > > easy_install python_wifi-0.5.0-py2.5.egg The "py2.5" in the file name suggests that you're trying to install a ver

Re: [Tutor] how to print array without adding newline

2012-09-06 Thread Alan Gauld
On 06/09/12 15:10, Dave Angel wrote: except Exception, err: print 'Caught an exception' You should probably send this and any other error messages to stderr, as stdout is presumably being consumed by the robot. And you probably shouldn't use such a bland error message for every possibl

Re: [Tutor] python wifi

2012-09-06 Thread Emile van Sebille
On 9/5/2012 9:43 PM Sales said... Hello, I'm trying to install python wifi using easy install. I have python27 and working on mac os. from a shell I'm running: easy_install python_wifi-0.5.0-py2.5.egg I also tried: sudo easy_install python_wifi-0.5.0-py2.5.egg Now try the "[sudo ]easy_inst

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
On 09/06/2012 08:29 AM, Walter Prins wrote: > Hi Ray, > > On 6 September 2012 15:59, Ray Jones wrote: >> Basically it's as simple as ensuring that an array consists of integers, >> and that those integers fall within a certain range. Rather than using >> multiple 'if' statements, I was (am, at thi

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Oscar Benjamin
On 2012-09-06, Ray Jones wrote: > > Basically it's as simple as ensuring that an array consists of integers, > and that those integers fall within a certain range. Rather than using > multiple 'if' statements, I was (am, at this point) using multiple tests > within a single 'if' statement. Nothing

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Walter Prins
Hi Ray, On 6 September 2012 15:59, Ray Jones wrote: > Basically it's as simple as ensuring that an array consists of integers, > and that those integers fall within a certain range. Rather than using > multiple 'if' statements, I was (am, at this point) using multiple tests > within a single 'if'

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
On 09/06/2012 07:48 AM, Dave Angel wrote: >>> On 09/06/2012 09:56 AM, Ray Jones wrote: I have a multiple 'if' expression that I need to drastically reduce in size, both for readability and to keep errors from creeping in. For example, I would like to have the variable 'test' poi

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
On 09/06/2012 07:35 AM, Jerry Hill wrote: > On Thu, Sep 6, 2012 at 10:15 AM, Ray Jones wrote: >> Well, of all the. a REAL programming language. I mean, even >> Bash ;;)) >> >> Anyway, it was a shot. Thanks. > There's almost certainly a way to accomplish your goal of simplifying > you

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Dave Angel
On 09/06/2012 10:15 AM, Ray Jones wrote: > On 09/06/2012 07:15 AM, Dave Angel wrote: >> On 09/06/2012 09:56 AM, Ray Jones wrote: >>> I have a multiple 'if' expression that I need to drastically reduce in >>> size, both for readability and to keep errors from creeping in. >>> >>> For example, I woul

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
On 09/06/2012 07:33 AM, Peter Otten wrote: > Ray Jones wrote: > >> I have a multiple 'if' expression that I need to drastically reduce in >> size, both for readability and to keep errors from creeping in. >> >> For example, I would like to have the variable 'test' point to the a >> location 'grid[r

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Jerry Hill
On Thu, Sep 6, 2012 at 10:15 AM, Ray Jones wrote: > Well, of all the. a REAL programming language. I mean, even > Bash ;;)) > > Anyway, it was a shot. Thanks. There's almost certainly a way to accomplish your goal of simplifying your giant nested if statements. It just doesn't invo

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Peter Otten
Ray Jones wrote: > I have a multiple 'if' expression that I need to drastically reduce in > size, both for readability and to keep errors from creeping in. > > For example, I would like to have the variable 'test' point to the a > location 'grid[rcount-1][ccount-1]' so that everywhere I would use

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
On 09/06/2012 07:15 AM, Dave Angel wrote: > On 09/06/2012 09:56 AM, Ray Jones wrote: >> I have a multiple 'if' expression that I need to drastically reduce in >> size, both for readability and to keep errors from creeping in. >> >> For example, I would like to have the variable 'test' point to the

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Dave Angel
On 09/06/2012 09:56 AM, Ray Jones wrote: > I have a multiple 'if' expression that I need to drastically reduce in > size, both for readability and to keep errors from creeping in. > > For example, I would like to have the variable 'test' point to the a > location 'grid[rcount-1][ccount-1]' so that

Re: [Tutor] how to print array without adding newline

2012-09-06 Thread Dave Angel
On 09/06/2012 09:49 AM, vi...@thepenguin.org wrote: > Thank you for your reply. I understand that it is odd, but my program is > being called from a hubot and returning data to it as well. I have figured > out how to make the changes to get it to output the correct data in the > correct format,

[Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Ray Jones
I have a multiple 'if' expression that I need to drastically reduce in size, both for readability and to keep errors from creeping in. For example, I would like to have the variable 'test' point to the a location 'grid[rcount-1][ccount-1]' so that everywhere I would use 'grid.', I could replac

Re: [Tutor] How to get MAC address using Python at windows 7

2012-09-06 Thread bob gailer
On 8/18/2012 10:12 AM, šãñ wrote: I need to find some way how i can get mac address of windows 7 in python. Windows 7 does not have a MAC address. It is an operating system. Ethernet adapters have MAC addresses. Your computer will have one or more Ethernet adapter. From a command prompt ente

Re: [Tutor] how to print array without adding newline

2012-09-06 Thread Oscar Benjamin
On Sat, 18 Aug 2012 18:17:16 -0700 (PDT), vickistan wrote: Hello: I am trying to output an array to another program that takes an array as input, but the print statement adds a newline. If it were adding to each individual element, I could solve it easily, but it is adding one at the end of

Re: [Tutor] Help

2012-09-06 Thread Walter Prins
Hi Ian, On 4 September 2012 20:36, Ian o donovan wrote: > Hey, I am writing this to you because I want to know could you help. > My school is doing enterprise and I want to enter. What do you mean your school is "doing enterprise"? Is it some competition or something? > I really want to > make

Re: [Tutor] python 2.7.1

2012-09-06 Thread Alan Gauld
On 20/08/12 05:47, john wrote: print"hello world"#this is just something to say >>> /Users/jonathan/Documents/hello.py You don;t run Python scripts from the python prompt. You only type Python co0mmands there. You could import your file which wiull run it but the effect is slightly diff

Re: [Tutor] how to print array without adding newline

2012-09-06 Thread Alan Gauld
On 19/08/12 02:17, vickistan wrote: Hello: I am trying to output an array to another program that takes an array as input You are printing a list. You are not passing an 'array' to anything. What exavctly does the other program expect to see. An array object - as defined in what language? or a

Re: [Tutor] Doing the same thing twice. Works first time but not the second.

2012-09-06 Thread Omar Abou Mrad
On Fri, Aug 17, 2012 at 11:11 PM, Matthew Love wrote: > > This is the error: > > Traceback (most recent call last): > File "C:\Users\Matthew\Desktop\test.py", line 16, in > print(player.inventory()) > TypeError: 'list' object is not callable > > The python debugger can also give you a hint

Re: [Tutor] Hey.need help on time

2012-09-06 Thread Ray Jones
On 09/06/2012 02:08 AM, eryksun wrote: > On Thu, Sep 6, 2012 at 4:25 AM, Ray Jones wrote: >> Why the additional step of calling time.tzset()? Once os.environ['TZ'] >> is set, I've found that time.localtime() responds to the new TZ without >> anything extra. Is that a difference in versions (2.7.3

Re: [Tutor] Python 2.7.3, Pygame, and LiveWires

2012-09-06 Thread Alan Gauld
On 04/09/12 19:52, Jason Fremouw wrote: packages listed above come as add-ons in my text book but are not compatible with 2.7. Are these now built into the latest build of Python or are they listed as different downloads on Python.org? No, the livewires and pygame packages are not part of core

Re: [Tutor] Python

2012-09-06 Thread Alan Gauld
On 19/08/12 21:42, Andrew Rosen wrote: I have a Windows Computer and I'm trying to make a shortcut on my desktop that will run a program, so I don't have to open up a New Window form Python Shell and use that to run the program. I can't figure out how to do it, can you help me? Create a shortcu

Re: [Tutor] Help

2012-09-06 Thread Alan Gauld
On 06/09/12 09:35, Ray Jones wrote: #A Python text-RPG #A Jak Production #APOC global ammo You use global inside a function not outside. All variables declared at the module level are global by definition. ammo=55 This sets the global ammo value def part1(): if answer == "SHOW" or

Re: [Tutor] how to print array without adding newline

2012-09-06 Thread Dave Angel
On 08/18/2012 09:17 PM, vickistan wrote: > Hello: I am trying to output an array to another program that takes an array > as input, but the print statement adds a newline. If it were adding to each > individual element, I could solve it easily, but it is adding one at the end > of the array. Is the

Re: [Tutor] python 2.7.1

2012-09-06 Thread Peter Otten
john wrote: > print "hello world" #this is just something to say /Users/jonathan/Documents/hello.py > File "", line 1 > /Users/jonathan/Documents/hello.py > ^ > SyntaxError: invalid syntax > > what am i doing wrong? The >>> prompt indicates that you have already started the inter

Re: [Tutor] Hey.need help on time

2012-09-06 Thread eryksun
On Thu, Sep 6, 2012 at 4:25 AM, Ray Jones wrote: > > Why the additional step of calling time.tzset()? Once os.environ['TZ'] > is set, I've found that time.localtime() responds to the new TZ without > anything extra. Is that a difference in versions (2.7.3 here)? It shouldn't strictly be necessary

Re: [Tutor] Python

2012-09-06 Thread Dave Angel
On 08/19/2012 04:42 PM, Andrew Rosen wrote: > I have a Windows Computer and I'm trying to make a shortcut on my desktop > that will run a program, so I don't have to open up a New Window form Python > Shell and use that to run the program. I can't figure out how to do it, can > you help me? > T

Re: [Tutor] math description

2012-09-06 Thread Peter Otten
damjan kuzmic wrote: > i would like to know how to write a formula that in excell looks like > this: > > A / EXP(-LN(2) * t) >>> import math >>> A = 1.23 >>> t = 4.56 Literally (math.log is the natural logarithm): >>> A / math.exp(-math.log(2) * t) 29.013618196288864 However, exp(-x) == 1

Re: [Tutor] Doing the same thing twice. Works first time but not the second.

2012-09-06 Thread Alan Gauld
On 17/08/12 21:11, Matthew Love wrote: class Player(object): def inventory(self): self.inventory = ["torch"] return self.inventory Notice that you override the name inventory. Initially self.inventory is the inventory() method. But then you change self.inventory to be a

Re: [Tutor] help me decide

2012-09-06 Thread Matthew Ngaha
hey guys i just like to thank everyone for their input. Its really helped me in deciding a lot of things. also @ Alan i think? as ive started writing this mail it won;t let me look up previous senders but thanks for your input. Also your field of work sounds very interesting indeed. I can't dare to

Re: [Tutor] python 2.7.1

2012-09-06 Thread Dave Angel
On 08/20/2012 12:47 AM, john wrote: > print "hello world" #this is just something to say > > > > > /Users/jonathan/Documents/hello.py > File "", line 1 > /Users/jonathan/Documents/hello.py > ^ > SyntaxError: invalid syntax > > what am i doing wrong? > > > it would help if you showe

Re: [Tutor] Doing the same thing twice. Works first time but not the second.

2012-09-06 Thread eryksun
On Fri, Aug 17, 2012 at 4:11 PM, Matthew Love wrote: > def inventory(self): > self.inventory = ["torch"] > return self.inventory What is 'self.inventory' before you call inventory(), and what is it afterwards? A quick fix would be to name the list "_inventory" and return self.

Re: [Tutor] math description

2012-09-06 Thread Alan Gauld
On 29/08/12 21:20, damjan kuzmic wrote: Hello, i would like to know how to write a formula that in excell looks like this: A / EXP(-LN(2) * t) Start by breaking it down from the inside out. LN(2) is log(2) in Python, which is found in the math module so you need import math too. negation (

Re: [Tutor] Help

2012-09-06 Thread Dave Angel
On 09/03/2012 10:39 AM, Jack Little wrote: >> Ok, I am somewhat new to python, and I am making a text-based RPG. I get a >> weird error with this code: >> >> >> #A Python text-RPG >> #A Jak Production >> #APOC >> global ammo >> global health >> global lives >> global exp >> global food >> ammo=55 >

Re: [Tutor] Help

2012-09-06 Thread Ray Jones
On 09/03/2012 07:39 AM, Jack Little wrote: > > Ok, I am somewhat new to python, and I am making a text-based RPG. I get a > > weird error with this code: > > > > > > #A Python text-RPG > > #A Jak Production > > #APOC > > global ammo > > global health > > global lives > > global exp > > global food

[Tutor] apologies for any duplicate mails coming through

2012-09-06 Thread Alan Gauld
I've just been into the admin interface and flushed a heap of messages in the moderators queue. I hadn't logged in for a while and quite a stack had built up - mostly spam... :-( Some were a few weeks old so apologies if some of them have already been seen and dealt with. -- Alan G Author of

Re: [Tutor] math description

2012-09-06 Thread Mark Lawrence
On 29/08/2012 21:20, damjan kuzmic wrote: Hello, i would like to know how to write a formula that in excell looks like this: A / EXP(-LN(2) * t) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.pytho

[Tutor] python wifi

2012-09-06 Thread Sales
Hello, I'm trying to install python wifi using easy install. I have python27 and working on mac os. from a shell I'm running: easy_install python_wifi-0.5.0-py2.5.egg I also tried: sudo easy_install python_wifi-0.5.0-py2.5.egg I pasted the output error below. I'm not familiar with easy_install

Re: [Tutor] Hey.need help on time

2012-09-06 Thread Ray Jones
On 09/06/2012 12:51 AM, eryksun wrote: > On Thu, Sep 6, 2012 at 3:21 AM, Keitaro Kaoru wrote: >> been trying to change this so it wont use my server time. but my >> actual time here in the us.EST. havent been able to figure it out >> >> def sstime(user, body, m): >> os.environ['TZ'] = 'US/

[Tutor] how to print array without adding newline

2012-09-06 Thread vickistan
Hello: I am trying to output an array to another program that takes an array as input, but the print statement adds a newline. If it were adding to each individual element, I could solve it easily, but it is adding one at the end of the array. Is there another way to print an array besides print

[Tutor] python 2.7.1

2012-09-06 Thread john
print "hello world" #this is just something to say >>> /Users/jonathan/Documents/hello.py File "", line 1 /Users/jonathan/Documents/hello.py ^ SyntaxError: invalid syntax what am i doing wrong? ___ Tutor maillist - Tutor@python.org To

[Tutor] Python

2012-09-06 Thread Andrew Rosen
I have a Windows Computer and I'm trying to make a shortcut on my desktop that will run a program, so I don't have to open up a New Window form Python Shell and use that to run the program. I can't figure out how to do it, can you help me?___ Tutor mai

[Tutor] Python 2.7.3, Pygame, and LiveWires

2012-09-06 Thread Jason Fremouw
Hello, My name is Jason Fremouw. I recently began a Structured Programming course using Python as the tool with which we'll learn. The media packages listed above come as add-ons in my text book but are not compatible with 2.7. Are these now built into the latest build of Python or are they listed

Re: [Tutor] Formatting questions regarding datetime.isoformat()

2012-09-06 Thread eryksun
On Thu, Sep 6, 2012 at 3:50 AM, Dave Angel wrote: > On 09/06/2012 03:35 AM, eryksun wrote: >> >> Or you could use datetime.now(dateutil.tz.tzutc()) for a UTC tzinfo. >> It doesn't matter if you're only interested in the timedelta. > > Actually, it can matter. Whenever possible, produce all times

[Tutor] How to get MAC address using Python at windows 7

2012-09-06 Thread šãñ
I need to find some way how i can get mac address of windows 7 in python.. -- ** [image: San's personal blog] * * ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://

[Tutor] Help

2012-09-06 Thread Jack Little
> Ok, I am somewhat new to python, and I am making a text-based RPG. I get a > weird error with this code: > > > #A Python text-RPG > #A Jak Production > #APOC > global ammo > global health > global lives > global exp > global food > ammo=55 > health = 100 > lives=10 > exp = 0 > food = 30 > > def p

[Tutor] Doing the same thing twice. Works first time but not the second.

2012-09-06 Thread Matthew Love
This error is confusing me. I am wondering if anyone can help me out. Using W7 64 Ultimate Using Python 3.1.1 This is the relevant part of the program. class Player(object): def __init__(self): print("Player created.") def inventory(self): self.inventory = ["torch"]

[Tutor] Help

2012-09-06 Thread Ian o donovan
Hey, I am writing this to you because I want to know could you help. My school is doing enterprise and I want to enter. I really want to make a program that will clean up your desktop E.G put files you haven't used for a while into a folder and delete your trash they are just a few ideas. I am tryi

[Tutor] math description

2012-09-06 Thread damjan kuzmic
Hello, i would like to know how to write a formula that in excell looks like this: A / EXP(-LN(2) * t) -- greetings car kuzma ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo

Re: [Tutor] Python Xmpp Received Message

2012-09-06 Thread Alan Gauld
On 06/09/12 08:59, Ahmet Can KEPENEK wrote: I wrote application with xmpp. It sending message from gtalk. I want to print received message. How can i do? This mailing list is really for people learning Python and its standard library. Your question is mainly about xmpp which I assume is some

[Tutor] Python Xmpp Received Message

2012-09-06 Thread Ahmet Can KEPENEK
I wrote application with xmpp. It sending message from gtalk. I want to print received message. How can i do? My application short code as follows. def process_message(): client = xmpp.Client('gmail.com') client.connect( server=('talk.google.com',5223) ) client.auth(user,passwd, 'bot

Re: [Tutor] Hey.need help on time

2012-09-06 Thread eryksun
On Thu, Sep 6, 2012 at 3:21 AM, Keitaro Kaoru wrote: > been trying to change this so it wont use my server time. but my > actual time here in the us.EST. havent been able to figure it out > > def sstime(user, body, m): > os.environ['TZ'] = 'US/Eastern' Now just call time.tzset(), and it s

Re: [Tutor] Formatting questions regarding datetime.isoformat()

2012-09-06 Thread Peter Otten
staticsafe wrote: > Hello, > > I am running Python 2.6.6 on a Debian Squeeze system. I am using two > modules in this bit of code - datetime and python-tvrage (available on > pypy here: http://pypi.python.org/pypi/python-tvrage/). > > My goal is to find the time remaining until a certain show ai

Re: [Tutor] Formatting questions regarding datetime.isoformat()

2012-09-06 Thread eryksun
On Wed, Sep 5, 2012 at 11:00 PM, staticsafe wrote: > > In [68]: showinfo['RFC3339'] > Out[68]: '2012-09-10T21:00:00-4:00' You can parse the ISO format using the dateutil module: http://labix.org/python-dateutil >>> from dateutil.parser import parse >>> show_time = parse('2012-09-10T21:0

[Tutor] Hey.need help on time

2012-09-06 Thread Keitaro Kaoru
been trying to change this so it wont use my server time. but my actual time here in the us.EST. havent been able to figure it out def sstime(user, body, m): os.environ['TZ'] = 'US/Eastern' tstr1 = time.strftime("%a, %b-%d-%Y", time.tzset()) tstr2 = time.strftime("%I:%M:%S