Re: [Tutor] looking for tutor

2010-01-14 Thread Wayne Werner
On Wed, Jan 13, 2010 at 11:58 PM, maxwell hansen wrote: > I have a decent amount of knowledge with QBASIC and am looking for a tutor > who can help me learn the pythonic equivalent of QBASIC features and > commands such as COLOR, LOCATE, IF...THEN, GOTO, loops, etc. as well as > visual things and

Re: [Tutor] Future of Python Programmers

2010-01-30 Thread Wayne Werner
On Sat, Jan 30, 2010 at 1:15 PM, nikunj badjatya wrote: > > Dear all PyPers, > . > I have one important question to ask to all of you, > I am a fresher, recently completed my graduation, had started working on > python 2 months back..!! and I just fell in love with the language. I want > to learn

Re: [Tutor] Complied Python program...

2010-01-31 Thread Wayne Werner
On Sun, Jan 31, 2010 at 9:46 AM, Ken G. wrote: > In using Geany, I have the ability to complied a Python program. For > example, I can complied "program.py" to program.pyc." > > What is the purpose of a complied Python program? Can it be transported to > another computer without Python installe

Re: [Tutor] tracking program

2010-02-01 Thread Wayne Werner
On Mon, Feb 1, 2010 at 1:45 PM, Luis Ortega wrote: > Hello > > I am fairly new to programming (which means I have never, ever, ever > written a program). I have a book or two in Python, and so far I like it. > I have a stupid question to ask; Is it possible to write an employee's > internet trac

Re: [Tutor] help with random.randint (cont. -- now: pseudo code)

2010-02-03 Thread Wayne Werner
On Wed, Feb 3, 2010 at 12:12 AM, David wrote: > def createQuestions: >generate all multiplication combinations possible >append as tuple to pool >eliminate 'mirrored doubles' (i.e. 7x12 and 12x7) >randomize pool > > I haven't really looked through most of this stuff - but your mir

Re: [Tutor] help with random.randint

2010-02-03 Thread Wayne Werner
On Wed, Feb 3, 2010 at 5:26 AM, David wrote: > Hello Eike, > > thanks for the explanation, all this is really helpful -- I certainly have > learned sth. today! > I wonder, though, how I would get my number pairs, which I need later on, > if I were to follow your solution. I am asking because as I

Re: [Tutor] correcting an Active State Recipe for conversion to ordinal

2010-02-04 Thread Wayne Werner
On Thu, Feb 4, 2010 at 11:11 AM, Serdar Tumgoren wrote: > Hi folks, > > I just noticed, however, that in the comments section of the > ActiveState recipe that someone is getting incorrect results for > certain numbers (11 and 12, specifically). > > But when I use the code on my own machine it sti

Re: [Tutor] correcting an Active State Recipe for conversion to ordinal

2010-02-04 Thread Wayne Werner
On Thu, Feb 4, 2010 at 12:30 PM, Serdar Tumgoren wrote: > > Geez -- I think I found the (now-obvious) mistake. If you compare the > above to the ActiveState recipe, it's obvious that I forgot to copy > over the final, outer "else:" clause. > > Could you all indulge me one last time and tell me if

Re: [Tutor] Variable: From input and output

2010-02-04 Thread Wayne Werner
On Thu, Feb 4, 2010 at 12:19 PM, ssiverling wrote: > > Greetings, > > So I want to learn assembly. However, it can take a experienced C > programmer a year to learn assembly. With me it might take longer. One > thing I was reading is that alot of the tutorials assume prior programming > experi

Re: [Tutor] Variable declaration

2010-02-05 Thread Wayne Werner
On Fri, Feb 5, 2010 at 10:40 AM, Hansen, Mike wrote: > Perl has "use strict;" to force variable declaration. > > My insane Perl loving co-workers think it's evil that Python doesn't have > variable declaration. =) > > What are some of the reasons/arguments on why Python doesn't need variable > de

Re: [Tutor] Simple variable type question

2010-02-05 Thread Wayne Werner
On Fri, Feb 5, 2010 at 10:54 AM, Antonio de la Fuente wrote: > Hi all, > > I'm trying to do exercises from: > > http://openbookproject.net/thinkcs/python/english2e/ch05.html > > exercise number 3 (slope function) and when I run it: > > python ch05.py -v > > the doctest for the slope function faile

Re: [Tutor] if item.find(extension)!= -1: -- what's the -1?

2010-02-06 Thread Wayne Werner
On Sat, Feb 6, 2010 at 10:35 AM, David wrote: > Hello again, > > in Knowlton's 2008 book "Python: Create, Modify, Reuse" the author makes > frequent use of the term -1 in his code, but doesn't tell to what aim. For > want of search terms Google is not helpful. Could someone please enlighten > me

Re: [Tutor] Compile py to exe in ubuntu

2010-02-10 Thread Wayne Werner
On Wed, Feb 10, 2010 at 1:40 PM, Harya Dananjaya wrote: > Can I compile my python source to exe in ubuntu? > if I can do it, which compiler can do it? > > Thanks you, > > Harya Dananjaya > Do you mean a windows executable? Not really. Why do you want an .exe anyway? Python code is (usually) cross

Re: [Tutor] Needleman-Wunsch algorithm

2010-02-10 Thread Wayne Werner
On Wed, Feb 10, 2010 at 3:29 PM, invincible patriot < invincible_patr...@hotmail.com> wrote: > hi > i hope every one knows about the needleman wunsch algo > Never heard of it > i am trying to do the same task, > can some one give me an outline as to how should i start after taking 2 > input st

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

2010-02-12 Thread Wayne Werner
I've discovered that same thing. Usually I end out not sending my message because in the process of composing my email I end out I, too, find the errors. -Wayne ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http:/

Re: [Tutor] Just a Note

2010-02-13 Thread Wayne Werner
On Sat, Feb 13, 2010 at 3:18 AM, Alan Gauld wrote: > > "Randy Raymond" wrote > > By the way, Alan Gauld's emails generate an error in my system. His is >> the only emails I have a problem with so far. At first it tried to open a >> News service. >> > > Interesting. I am using the gmane news se

tutor@python.org

2010-02-13 Thread Wayne Werner
On Sat, Feb 13, 2010 at 12:58 PM, David Abbott wrote: > > I don't understand the l>>24 & 255. > > from the docs; > Right Shift a >> b rshift(a, b) > Bitwise And a & b and_(a, b) > They're binary operations... If you're not familiar, wikipedia or google can find you many sources. In a nutshell

Re: [Tutor] Problem with "input" in Python 3

2010-02-15 Thread Wayne Werner
On Mon, Feb 15, 2010 at 6:09 AM, Peter Anderson < peter.ander...@internode.on.net> wrote: > Hi! > > I am trying to teach myself how to program in Python using Zelle's "Python > Programming: An Introduction to Computer Science" (a very good text). At the > same time I have decided to start with Pyt

Re: [Tutor] Input() is not working as expected in Python 3.1

2010-02-15 Thread Wayne Werner
On Mon, Feb 15, 2010 at 8:23 AM, Yaraslau Shanhin < yaraslau.shan...@gmail.com> wrote: > Hello All, > > I am working with Python tutorial in wiki and one of the exercises is as > follows: > > Ask the user for a string, and then for a number. Print out that string, > that many times. (For example,

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

2010-02-16 Thread Wayne Werner
http://www.python.org/dev/peps/pep-0008/ This make me wonder. Is there a document or web site that has Python Best > Practices? Something along the lines of the Perl Best Practices book, but > probably shorter. =) HTH, Wayne -- To be considered stupid and to be told so is more painful than bei

Re: [Tutor] Using and

2010-02-21 Thread Wayne Werner
On Sun, Feb 21, 2010 at 7:44 AM, jim serson wrote: > Can anyone tell me if I can have my program check to see if something is > true the add to count > > For example something like > > if c_1 and c_2 and c_3 true: > count + 1 > > or if I can use it after splitting an input the proble

Re: [Tutor] Python file escaping issue?

2010-02-21 Thread Wayne Werner
On Sun, Feb 21, 2010 at 12:22 PM, Sithembewena Lloyd Dube wrote: > Hi all, > > I'm trying to read a file (Python 2.5.2, Windows XP) as follows: > > assignment_file = open('C:\Documents and Settings\coderoid\My > Documents\Downloads\code_sample.txt', 'r+').readlines() > new_file = open(new_file.tx

Re: [Tutor] Encryption

2010-02-22 Thread Wayne Werner
On Mon, Feb 22, 2010 at 2:50 PM, Antonio Buzzelli wrote: > Hi everyone! > I need a simple way to encrypt and decrypt some strings with a key > > someone can help me?? I'm sure someone can. -Wayne ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] Strange list behaviour in classes

2010-02-22 Thread Wayne Werner
On Mon, Feb 22, 2010 at 4:10 PM, C M Caine wrote: > Or possibly strange list of object behaviour > > IDLE 2.6.2 > >>> class Player(): >hand = [] > > > >>> Colin = Player() > >>> Alex = Player() > >>> > >>> Players = [Colin, Alex] > >>> > >>> def hands(): >for player in Players: >

Re: [Tutor] What Editori?

2010-02-23 Thread Wayne Werner
On Tue, Feb 23, 2010 at 10:24 AM, Giorgio wrote: > Hi All, > > what text-editor do you use for python? > I use vim - for me it's the hands-down best editor. I usually have two terminals (I run linux) open - one for ipython, and one for vim. I usually have vim split into several buffers for each o

Re: [Tutor] raising number to a power

2010-02-25 Thread Wayne Werner
2010/2/25 Ricardo Aráoz > Stefan Behnel wrote: > So why would the coders of the math module go to the trouble of creating > the pow function? Did they create a sum function and a subtract function? > It seems to me the question has not been properly answered. When to use > one, when to use the o

Re: [Tutor] Bowing out

2010-03-03 Thread Wayne Werner
I can only add my personal thanks, and echo the sentiments of others. I'm certainly glad the archives exist, and that those inheriting responsibility are certainly well qualified. So long and thanks for all the fish! -Wayne 2010/3/3 Emad Nawfal (عمـ نوفل ـاد) > > > On Wed, Mar 3, 2010 at 9:17

Re: [Tutor] Process list elements as consecutive pairs

2010-03-05 Thread Wayne Werner
On Fri, Mar 5, 2010 at 11:56 AM, Rüdiger Wolf < rudiger.w...@throughputfocus.com> wrote: > Hi > > I am trying to Process list elements as consecutive pairs into > consecutive pairs. > Any pythonic suggestions? > > listin = [1,2,3,4,5,6,7,8,9,10] > I want to process as consecutive pairs > 1,2 > 3,

[Tutor] Really learn programming

2010-03-08 Thread Wayne Werner
As I was reading my favorite webcomics, Abstruse Goose had a link to this interesting site about programming in 21 days (or not). http://norvig.com/21-days.html I thought it was rather interesting (and it also recommends Python ;) enjoy, -Wayne -- To be considered

Re: [Tutor] Running a dos program with python

2010-03-10 Thread Wayne Werner
On Wed, Mar 10, 2010 at 3:20 PM, Armstrong, Richard J. < rarms...@water.ca.gov> wrote: > Hello all, > > > > This is my first post to the Tutor@python.org mailing list. I am in the > process of switching from Matlab to Python and there is one task that I am > having a hard time doing and cannot fi

Re: [Tutor] Running a dos program with python

2010-03-10 Thread Wayne Werner
On Wed, Mar 10, 2010 at 4:51 PM, Armstrong, Richard J. < rarms...@water.ca.gov> wrote: > > > The dos program pops up and if I hit the enter key three times then it > runs. How can I add these three “enters” into the script? > I'm not at all sure if this way would work, but you could send the \r\n

Re: [Tutor] Hi there :.)

2010-03-15 Thread Wayne Werner
On Mon, Mar 15, 2010 at 10:23 AM, wrote: > Hey, > Just introducing myself to say hiHi! > > I'm very new to programming, I got interested in it when I decided to have > a go at html. When looking around for a place to start I found out that > python and C++ are the usual starting place bu

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

2010-03-18 Thread Wayne Werner
On Thu, Mar 18, 2010 at 6:42 AM, Kevin Kirton wrote: > Hi all, > > I've committed myself to learning Python and have started reading > "Learning Python" (Mark Lutz) and looking through various online > resources. > My career so far has involved a little high school teaching and about > 10 years o

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

2010-03-19 Thread Wayne Werner
On Fri, Mar 19, 2010 at 7:33 AM, richard west wrote: > Hi, > > Im trying to use python to open up a password protected website(e.g. > facebook / gmail) in Firefox. supplying the login and password automatically > at runtime - so that I can interface my code with fingerprint recognition > code. So

Re: [Tutor] bind line-oriented device output?

2010-03-29 Thread Wayne Werner
On Sun, Mar 28, 2010 at 6:51 PM, Tom Roche wrote: > > I'd like to learn to pythonically redirect the output from a > line-oriented character device to a particular file or process, > regardless of focus, on a generic graphical OS. But I don't want to > redirect stdin entirely. Here's the usecase:

Re: [Tutor] bind line-oriented device output?

2010-03-29 Thread Wayne Werner
On Mon, Mar 29, 2010 at 10:56 AM, Tom Roche wrote: > I'll read the Product Reference Guide and hope it tells me that the > Wasp WLS9500 "reports a control character." Unfortunately when I > search the PDF > > http://tinyurl.com/waspWLS9500manual > > for "control character" I get no hits. Are ther

Re: [Tutor] USB Access

2010-03-30 Thread Wayne Werner
On Tue, Mar 30, 2010 at 9:01 AM, Marc wrote: > Hi, > I was wondering if anyone could point me to Python modules or example code > for accessing USB connected devices. I would like to get as close to the > hardware as possible with Python. I would like to be able to monitor as > well as control

Re: [Tutor] Decoding MIME Attachments

2010-04-01 Thread Wayne Werner
On Thu, Apr 1, 2010 at 5:47 PM, wrote: > Hi, all; > > I am a longtime linux sysadmin that is fairly new to Python. I've got a > project for which Python seems to be perfect (or, at least, I've found a > way to integrate my learning :-) Welcome to Python! I highly recommend this book by Noah G

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

2010-04-05 Thread Wayne Werner
On Mon, Apr 5, 2010 at 12:08 PM, Vincent Davis wrote: > I am working an a open source project and would like to add feature to a > class. > Current action: > in:>>>b = BString.new('I am a BString object') > out: >>>b > in:>>> > in:>>>print(b) > out: >>> 21-letter "BString" instance >

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

2010-04-12 Thread Wayne Werner
On Mon, Apr 12, 2010 at 1:21 PM, Dotan Cohen wrote: > All right, I have gotten quite a bit closer, but Python is now > complaining about the directory not being empty: > > ✈dcl:test$ cat moveUp.py > #!/usr/bin/python > # -*- coding: utf-8 -*- > import os > currentDir = os.getcwd() > > filesList =

Re: [Tutor] Python root.

2010-04-18 Thread Wayne Werner
On Sun, Apr 18, 2010 at 10:21 AM, Aidas wrote: > Hello. > In here http://mail.python.org/pipermail/tutor/2001-February/003385.htmlYou > had written how to ger root in python. The way is: "from math import > sqrtprint sqrt( 49 )". > > I noticed that if I write just "print sqrt(49)" I get nothing.

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

2010-04-19 Thread Wayne Werner
On Mon, Apr 19, 2010 at 9:23 AM, Alan Gauld wrote: > > "C M Caine" wrote > >> That's the first I've read of iterating through dictionaries, I'd >> >> assumed it was impossible because they're unordered. >> > > Iteration doesn't require order, only to get each item once. > Even in very old Python

Re: [Tutor] the binary math "wall"

2010-04-20 Thread Wayne Werner
On Tue, Apr 20, 2010 at 11:58 AM, Lowell Tackett wrote: > I'm running headlong into the dilemma of binary math representation, with > game-ending consequences, e.g.: > > >>> 0.15 > 0.14999 > > Obviously, any attempts to manipulate this value, under the misguided > assumption that it is

Re: [Tutor] Need some info

2010-04-20 Thread Wayne Werner
On Tue, Apr 20, 2010 at 9:37 PM, Marco Rompré wrote: > Hi! in my programming course at university, I need to create a python model > with 2 concepts in a one towards many relation each of them having 2-3 > properties. > > Also, I need to create an application with screens to add, modify, and > d

Re: [Tutor] An interesting situation befalls me

2010-05-10 Thread Wayne Werner
On Mon, May 10, 2010 at 5:16 PM, Kelly Netterville wrote: > > > On Sat, May 8, 2010 at 5:31 PM, Kirk Z Bailey wrote: > >> An instructor of mine is about to teach the FIRST EVER class in Python at >> Saint Petersburg College; knowing I am a snakecharmer, he asked me for >> referrals to online resou

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-22 Thread Wayne Werner
On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano wrote: > Why do people keep recommending Decimal? Decimals suffer from the exact > same issues as floats, > This is exactly incorrect! The Decimal operator offers /exact/ decimal point operations. They implement non-hardware operations to preserve

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-23 Thread Wayne Werner
On Sat, May 22, 2010 at 9:58 AM, Steven D'Aprano wrote: > On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote: > > On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano > wrote: > > > Why do people keep recommending Decimal? Decimals suffer from the > > > exac

[Tutor] Linux webcam libraries?

2010-06-12 Thread Wayne Werner
Hi, I want to do something like this: http://www.kulturblog.com/2007/11/marshie-attacks-halloween-interactive-driveway-activity/ I want to be able to grab a webcam image via python. So I'm curious if anyone has had any experience/luck in this particular area and/or knows of any libraries I should

Re: [Tutor] need computer advice from wise Tutors

2010-06-26 Thread Wayne Werner
On Sat, Jun 26, 2010 at 3:30 AM, Alan Gauld wrote: > "Richard D. Moores" wrote > > However, to quote the old adage - "If it ain't broke, don't fix it". > So what is the problem that you think the upgrade will fix? > The problem? He has Vista installed... (rimshot) ;) -Wayne, Also on XP (and Ubu

Re: [Tutor] Creating A Simple Blog System Using Python Programming

2010-06-26 Thread Wayne Werner
On Fri, Jun 25, 2010 at 11:41 PM, F C wrote: > Hi there, > > - I have recently decided to learn Python. > - It is my first programming language. > - I am new to programming. > - I know XHTML and CSS, and a few lines of PHP. > - I only started learning a couple of days ago. > Well congratulation

Re: [Tutor] GUI Creation Aide

2010-07-14 Thread Wayne Werner
On Wed, Jul 14, 2010 at 7:18 AM, Corey Richardson wrote: > Hey tutors! I'm creating a GUI for a program. Really simple. I don't mind > coding it out, but I was looking into things like Glade and the like. Do you > recommend those over just coding it out by hand, or should I try Glade (or > simili

Re: [Tutor] Contents of Tutor digest, Help with hangman

2010-07-19 Thread Wayne Werner
On Mon, Jul 19, 2010 at 11:20 AM, John Palmer wrote: > Thanks a lot for the help guys, but when I use the getpass.getpass(Enter > your word here, I get a different response to what you get. This is what > happen with mine: > > >>> import getpass > >>> s = getpass.getpass("Enter your word here: ")

Re: [Tutor] Distributing Python Code for Commercial Porpoises?

2010-08-07 Thread Wayne Werner
I just noticed this thread - if you want a great version of python that has numpy/scipy so you can be sure to have the same version, use Python XY: http://www.pythonxy.com/ It's got a host of scientific packages such as matplotlib, numpy, and scipy. Then it has all sorts of other bells and whistl

Re: [Tutor] word_probles.py

2010-08-07 Thread Wayne Werner
On Sat, Aug 7, 2010 at 2:17 PM, Shurui Liu wrote: > > Here is a code named "word_problems.py". I can run it on putty.exe, but I > don't understand why I cannot run it on IDLE or pyscripter.exe. Both of > these two platform show that there are syntax errors in the code, errors > are on those red

Re: [Tutor] Module for browsing Windows?

2010-08-11 Thread Wayne Werner
On Tue, Aug 10, 2010 at 7:17 PM, Chorn, Guillaume wrote: > Hello, > > I'm pretty new to Python programming and it is my first programming > language. I made a script that uses data from two different .csv files to > make calculations and then spit the results out in a third .csv file. > However

Re: [Tutor] Learning Python ...Books

2010-08-13 Thread Wayne Werner
On Fri, Aug 13, 2010 at 5:22 AM, Stephen Farthing wrote: > Hi everyone, > > I am going to learn both Python and Ruby so I can see what suits me best. > My ultimate aim is to do some open source cross platform development for my > ham radio and robotics hobbies. One of the key requirements is to be

Re: [Tutor] Getting confusing NameError

2010-08-18 Thread Wayne Werner
On Wed, Aug 18, 2010 at 3:48 AM, shane brennan wrote: > > > again thanks for everything, and hopefully ill be around here for a long > time and once i get a more experienced i can contribute back > You don't need to be /too/ experienced. Contributing here is actually how I learned Python as much

Re: [Tutor] List comprehension for dicts?

2010-08-19 Thread Wayne Werner
On Thu, Aug 19, 2010 at 10:02 AM, Vince Spicer wrote: > Hey you can use list comprehension here > > > age_dict = { 'pete': 42, 'ann': 25, 'carl': 30, 'amanda': 64 } > > you can create a dict from a list of tuples and you can access the dict as > a > list of tuples by accessing its items > > Examp

Re: [Tutor] flow problem with a exercise

2010-08-19 Thread Wayne Werner
On Thu, Aug 19, 2010 at 2:01 PM, Roelof Wobben wrote: > > def is_odd(argument): > uitkomst=is_even(argument) > return uitkomst > > even=is_odd(1) ; > if even==True : > print "Even getal" > if even==False: > print "Oneven getal" > > > But now I get this error message : > > return uitkomst

Re: [Tutor] design of Point class

2010-08-20 Thread Wayne Werner
On Fri, Aug 20, 2010 at 10:45 AM, Gregory, Matthew < matt.greg...@oregonstate.edu> wrote: > Hi all, > > I often struggle with object design and inheritance. I'd like opinions on > how best to design a Point class to be used in multiple circumstances. > > I typically deal with geographic (either 2

Re: [Tutor] flow problem with a exercise

2010-08-20 Thread Wayne Werner
On Fri, Aug 20, 2010 at 2:48 PM, Roelof Wobben wrote: > Oke, > > I don''t understand it complety. > > return not arg%2 > > Why use not here ? > > I think that arg%2 is True not makes it false. > What happens when you replace arg with a value? % is modulo division, so it just returns the remaind

Re: [Tutor] Memory error for list creation

2010-08-24 Thread Wayne Werner
On Tue, Aug 24, 2010 at 9:54 AM, Triantafyllos Gkikopoulos < t.gkikopou...@dundee.ac.uk> wrote: > Hi, > > I am looking for an alternative to: > > > > Please consider the environment. Do you really need to print this email? > > > > >>>

Re: [Tutor] args to functions in a dictionary?

2010-08-25 Thread Wayne Werner
On Wed, Aug 25, 2010 at 4:58 PM, Alex Hall wrote: > Hi all, > If I wanted to have a dictionary containing functions, could I pass > args to those functions? For example: > menu={ > "option 1":f1, > "option 2":f2 > } > How would I pass args to f1 or f2 in this case? TIA. You sure could, becaus

Re: [Tutor] more on wx and tiff

2010-08-27 Thread Wayne Werner
On Fri, Aug 27, 2010 at 11:25 AM, Albert-Jan Roskam wrote: > Hi again, > > Some more questions about tiff conversion. > > First, thanks for your previous replies. I cannot use IrfanView any time > soon, nor will my boss switch to Linux. > Have you tried using the PIL? http://www.pythonware.com/p

Re: [Tutor] Code review, plase

2010-09-07 Thread Wayne Werner
On Tue, Sep 7, 2010 at 3:39 PM, Alex wrote: > Hi all. > > Could someone review my code? It's the first time I develop a reusable > module and I would like to have some feedback. > If you think it's good enough I will package it for pypi. > > I put the code on pastebin: http://pastebin.com/Tz367gA

Re: [Tutor] Help-Embedding Python in C#

2010-09-22 Thread Wayne Werner
On Wed, Sep 22, 2010 at 7:55 AM, ranjan das wrote: > > Please Advise: > > I need to run/execute python module in C#. I am using python 2.6 and > visual studio 10 > You should check out IronPython http://www.ironpython.com/ HTH, Wayne

Re: [Tutor] functions: use return or exceptions?

2010-09-23 Thread Wayne Werner
On Thu, Sep 23, 2010 at 2:32 PM, Alex Hall wrote: > Hi all, > A general coding question: is it better to use return(False) (or 0, or > -1, or whatever) or to raise whateverError("oops")? Are there cases > for each? It depends on your prevailing philosophy - if you like the EAFP that prevails in

Re: [Tutor] super.__init__() arguments

2010-09-27 Thread Wayne Werner
In addition it only works for new style classes. -wayne On 9/27/10, Lie Ryan wrote: > On 09/27/10 09:45, Jojo Mwebaze wrote: >> Hey Tutor, >> >> Seems a small issue but this has been playing for a while now, what am i >> doing wrong here? >> > > super() without argument only works for Python 3.

Re: [Tutor] I am looking for a book on Beginners who never programmed before or have no experience in programming

2010-09-28 Thread Wayne Werner
On Tue, Sep 28, 2010 at 6:39 AM, Alif Shirali wrote: > You might also consider the following free resources that are meant for > new programmers. They can easily be found on the internet: > I'll toss another recommendation into the ring: Snake Wrangling for Kids. It may be geared towards young

Re: [Tutor] Issues In Terminal

2010-09-28 Thread Wayne Werner
On Tue, Sep 28, 2010 at 5:02 AM, Alan Gauld wrote: > > "Marc Tompkins" wrote > > > > The parentheses are optional in 2.6, mandatory in 3. In 2.6, print and >> print() are alternate ways to invoke the print statement >> > > Not strictly true. They often give the same results but not always, > se

Re: [Tutor] Operating in Place

2010-09-28 Thread Wayne Werner
On Tue, Sep 28, 2010 at 3:03 PM, Corey Richardson wrote: > Hello tutors. > > I hate doing this: >string = string.lower() > > Is there a way to do it without the "string =" part? Thanks. > Not with a string. I suppose if you had your own class you could create something, but you'd be

Re: [Tutor] using "in" with a dictionary

2010-09-28 Thread Wayne Werner
On Tue, Sep 28, 2010 at 4:58 PM, Alex Hall wrote: > Hi all, yet again: > I have a dictionary that will look something like: > d={ > (1,2):"a", > (3,4):"b" > } > > How can I say: > if (1,2) in d: print d[(1,2)] > This is false, so I expect to have to use d.keys, but I am not quite sure > how. >

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Wayne Werner
On Fri, Oct 8, 2010 at 7:51 AM, Sithembewena Lloyd Dube wrote: > Hi folks, > > Supposing I had the float 4.4348 and I wished to round it off to the > nearest half-integer upwards or downwards, how would I go about it? > You can use round: round(4.4348) -> 4.0 But if you want to specify the beha

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Wayne Werner
On Fri, Oct 8, 2010 at 7:58 AM, Sithembewena Lloyd Dube wrote: > I realise that one cannot have a half integer :) I meant how would one > round off to the first decimal nearest to either 0.5, or a whole number. > > Ugh...does anyone get what I'm trying to articulate? :) sample input/output cases

Re: [Tutor] Help installing HLS Player

2010-10-11 Thread Wayne Werner
On Mon, Oct 11, 2010 at 6:56 AM, p4ddy wrote: > > Hi, > > I have a HLS Player written in python but whenever I try to install it, I > get this error > > "ImportError: No module named setuptools" > > So I downloaded setuptools-0.6c11.zip and tried to install it, again i got > this error > > "Impor

Re: [Tutor] If/else in Python 2.6.5 vs. Python 2.4.3

2010-10-11 Thread Wayne Werner
On Mon, Oct 11, 2010 at 12:10 PM, wrote: > > > rgenre = re.split(r';', rf.info["genre"] if "genre" in rf.info else [] > > I get a syntax error at "if" in 2.4.3. > That's because you're using the ternary operator that was not available in 2.4: http://www.python.org/dev/peps/pep-0308/ > > I tr

Re: [Tutor] Problem with python

2010-10-19 Thread Wayne Werner
On Tue, Oct 19, 2010 at 4:02 PM, Matthew Nunes wrote: > To whom it may concern, > >Hi, I've just started learning how to > program in python using Allan B. Downy's book "How to think like a computer > scientist" and it explained something in the recursion chapt

Re: [Tutor] module for clustering

2010-10-29 Thread Wayne Werner
On Fri, Oct 29, 2010 at 4:45 AM, Bala subramanian wrote: > Friends, > I have X and Y points and i want to cluster these points in 2D space, > Kindly suggest if there is any module that is loaded with python to do that > or any other package for the same. > matplotlib is pretty much amazing in th

[Tutor] unittest + tkinter

2010-11-01 Thread Wayne Werner
I'm sure there's an incredibly simple way to do this, but at the moment it eludes me. I'm trying my hand at test driven development via the unittest module. Since my program is using Tkinter, my thought is that I need to create the main window. The only problem is that when I launch the main loop,

Re: [Tutor] Displaying picture and Text

2010-11-04 Thread Wayne Werner
On Thu, Nov 4, 2010 at 3:58 AM, Alan Gauld wrote: > > wrote > > > of my python program where a picture is supposed to display with a few >> lines of text below it. >> > > To do this you will need to use some kind of GUI. > The simplest option is probably to use the Text widget in Tkinter > whic

Re: [Tutor] Displaying Pictures & Text

2010-11-06 Thread Wayne Werner
On Fri, Nov 5, 2010 at 11:53 PM, Patty wrote: > Hi Alan - > > I tried using ImageTk from the PIL library to display jpegs (and hopefully > any picture type) instead of just gif as you suggested below. I read > online that these these types of programs should > be run from executables not in th

Re: [Tutor] Programs for Newbies?

2010-11-06 Thread Wayne Werner
On Sat, Nov 6, 2010 at 11:54 AM, Patty wrote: > For my first program, I liked creating a number game, simple and where the > user made a choice. That was good for learning how to interact with the > user. The raw_input() function. > > Patty > My favorite one is a simple guessing game, where th

Re: [Tutor] Interactive visualization in python

2010-11-07 Thread Wayne Werner
On Sun, Nov 7, 2010 at 2:50 AM, Alan Gauld wrote: > > "Aravind Venkatesan" wrote > > > This is Aravind. I am a university graduate student. I am looking for a >> software module or package to visualize a hierarchial tree data structure >> in >> python. >> > > Most GUI toolkits have a tree widget

Re: [Tutor] List comprehension question

2010-11-07 Thread Wayne Werner
On Sun, Nov 7, 2010 at 6:31 PM, Hugo Arts wrote: > > here's a list comprehension > >>> a = [x*2 for x in range(10)] > >>> a > [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] > > here's the equivalent generator expression: > >>> a = (x*2 for x in range(10)) Since you're talking about generators and effi

Re: [Tutor] List comprehension question

2010-11-07 Thread Wayne Werner
On Sun, Nov 7, 2010 at 7:15 PM, Richard D. Moores wrote: > On Sun, Nov 7, 2010 at 16:41, Wayne Werner wrote: > > On Sun, Nov 7, 2010 at 6:31 PM, Hugo Arts wrote: > > I should have mentioned that I'm using 3.1 . > > So this version of my function uses a generator, ra

Re: [Tutor] Columnar Transposition Cipher question

2010-11-08 Thread Wayne Werner
On Mon, Nov 8, 2010 at 5:28 PM, Natalie Kristine T. Castillo < ncasti...@umail.ucsb.edu> wrote: > Hi, I need help on how exactly to solve this: > > To send secret messages you and your partner have decided to use the > columnar function you have written to perform columnar transposition cipher > f

Re: [Tutor] Stupid bug

2010-11-10 Thread Wayne Werner
On Wed, Nov 10, 2010 at 5:16 PM, Terry Carroll wrote: > This isn't a question, I'm just offering it as a cautionary tale and an > opportunity to laugh at my own stupidity. > > Turns out my function was working correctly all along; but with my typo, I > was printing out the value from the first c

[Tutor] Threading and Sockets

2010-11-15 Thread Wayne Werner
Hi, I'm working on creating a server/client bit of software using threading and sockets (it's a project so I can't use something like twisted), and I've run into a slight issue with my server. My server currently looks like this: class ClientThread(threading.Thread): def __init__(self, socket

Re: [Tutor] Threading and Sockets

2010-11-15 Thread Wayne Werner
Well, I solved the issue myself I changed the server class to the following: class Server(threading.Thread): def __init__(self, port=1500, max_connections=5): ''' Setup the server elements. ''' threading.Thread.__init__(self) self.server = socket.socket(socket.AF_INET

Re: [Tutor] "if n % 2 == 0" vs. "if not n % 2" compared for speed: aesthetics lose

2010-11-23 Thread Wayne Werner
On Tue, Nov 23, 2010 at 1:56 PM, Richard D. Moores wrote: > On Tue, Nov 23, 2010 at 10:29, R. Alan Monroe > wrote: > >> I've always disliked using "if not n % 2" to test for even/odd ints > >> because of its convoluted logic. But I ran some speed tests and found > >> it was the way to go over "i

[Tutor] Tkinter cursor size?

2009-03-31 Thread Wayne Werner
Hi, Is there a way to resize a tkinter cursor? And if so, how? I'm trying to create a fairly simple drawing program, but I want my cursor to resize with my brush size. TIA, Wayne -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lasc

[Tutor] Most pythonic input validation

2009-10-15 Thread Wayne Werner
Hi, I'm writing a text based menu and want to validate the user input. I'm giving the options as integers, and I want to make sure the user enters a proper value. Here's what I've got so far: http://pastebin.com/m1fdd5863 I'm most interested in this segment: while True: choice = raw_

Re: [Tutor] Most pythonic input validation

2009-10-15 Thread Wayne Werner
On Thu, Oct 15, 2009 at 10:50 AM, Rich Lovely wrote: > 2009/10/15 Wayne Werner : > > Hi, > > I'm writing a text based menu and want to validate the user input. I'm > > giving the options as integers, and I want to make sure the user enters a > > proper value.

Re: [Tutor] Being beaten up by a tuple that's an integer thats a tuple that may be an unknown 'thing'.

2009-11-03 Thread Wayne Werner
On Tue, Nov 3, 2009 at 9:20 AM, Robert Berman wrote: > > In [69]: l1=[(0,0)] * 4 > > In [70]: l1 > Out[70]: [(0, 0), (0, 0), (0, 0), (0, 0)] > > In [71]: l1[2][0] > Out[71]: 0 > This calls the element at index 2 which is: (0,0) - a tuple, then calls element [0] from that tuple, which is 0 whe

Re: [Tutor] why is os.path.walk so slow?

2009-11-04 Thread Wayne Werner
On Wed, Nov 4, 2009 at 6:16 AM, Garry Willgoose < garry.willgo...@newcastle.edu.au> wrote: > > > This is very fast for a directory on my local machine but significantly > slower on the remote machine. Not surprising but I would have expected that > the run time for the remote directory would be l

Re: [Tutor] Change a text string from a list and change it into an integer number.(WinXP/py2.6.2/Beginner)

2009-11-05 Thread Wayne Werner
On Thu, Nov 5, 2009 at 8:44 PM, Katt wrote: > > Currently the above code does not work unless I change the "if" statement > to say: > "if check_year == "c". > > Did I do the slice incorrectly? I thought that when you take the first > location (0) of a list then it would take the "cyear" in stea

[Tutor] class Knights vs class Knights(object)

2009-11-07 Thread Wayne Werner
Hi, For class definitions I've always used class Knights: but I've just seen an example using: class Knights(object): So I did a quick little test and see this: >>> a = Knights() >>> b = Knights2() >>> a <__main__.Knights instance at 0xb7e12bec> >>> b <__main__.Knights2 object at 0xb7e12b2c>

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Wayne Werner
On Sun, Nov 8, 2009 at 11:41 PM, Stephen Nelson-Smith wrote: > I've got a large amount of data in the form of 3 apache and 3 varnish > logfiles from 3 different machines. They are rotated at 0400. The > logfiles are pretty big - maybe 6G per server, uncompressed. > > I've got to produce a combin

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Wayne Werner
On Mon, Nov 9, 2009 at 7:46 AM, Stephen Nelson-Smith wrote: > And the problem I have with the below is that I've discovered that the > input logfiles aren't strictly ordered - ie there is variance by a > second or so in some of the entries. > Within a given set of 10 lines, is the first line and

Re: [Tutor] django python Version 1.1.1 - Internacionalization

2009-11-11 Thread Wayne Werner
On Wed, Nov 11, 2009 at 10:10 PM, andré palma wrote: > Hi all! > I'm developing a django web application but i'm having a trouble with > the internationalization. I don't know much about Django, and I suspect that's more the norm here - you may have better luck on the Django users list: http:/

  1   2   3   4   >