Re: [Tutor] Accessing variables in main from functions in a module

2009-10-30 Thread spir
Le Fri, 30 Oct 2009 18:39:42 -0400, Robert Lummis s'exprima ainsi: > I want to move some functions from my "main" program file to a module > file because the main file is getting too big for convenience. The > functions access arrays (lists of lists) that are defined and > initialised in the main

Re: [Tutor] class attribute to initiate more classes

2009-10-30 Thread Michiel Overtoom
On 31 Oct 2009, at 06:01 , Vincent Davis wrote: I hope this makes sense, I am sure there is a term for what I am trying to do but I don't know it. What a strange program. But at least it compiles: import random class people: def __init__(self, size): self.size = size class mak

[Tutor] class attribute to initiate more classes

2009-10-30 Thread Vincent Davis
I have a program that generates many instances of a class with an attribute self.x = random.gauss(10, 2). So each instance has a different value for self.x. This is what I want. Now I want to make a class that starts my program and sets the attributes. class people: def __init__(self, size)

[Tutor] python zlib problem

2009-10-30 Thread Amit Sethi
Hi , For some weird reason or a huge screw up I did my python zlib library has been removed . This is part of standard lib(i think!!!) and it is used by setuptools and many other libraries .What is the safe way in which I can recover this library on ubuntu. My previous try somehow lead to removal o

Re: [Tutor] Accessing variables in main from functions in a module

2009-10-30 Thread Dave Angel
Kent Johnson wrote: On Fri, Oct 30, 2009 at 6:39 PM, Robert Lummis wrote: I want to move some functions from my "main" program file to a module file because the main file is getting too big for convenience. The functions access arrays (lists of lists) that are defined and initialised in the

Re: [Tutor] problem adding Tkinter

2009-10-30 Thread Dave Angel
Kristin Wilcox wrote: I apologize in advance for asking such a simple question! I first tried looking through Google, and through the last couple months of this list's archives, and I found some talk about my issue out there but not a detailed enough answer to help someone as new as me. This is

Re: [Tutor] unicode: % & __str__ & str()

2009-10-30 Thread Dave Angel
spir wrote: [back to the list after a rather long break] Hello, I stepped on a unicode issue ;-) (one more) Below an illustration: class U(unicode): def __str__(self): return self # if you can't properly see the string below, # 128 ===

Re: [Tutor] problem adding Tkinter

2009-10-30 Thread Kristin Wilcox
SORRY TO ALL: PLEASE DISREGARD MY LAST EMAIL. I kept searching through the Tutor archives and found an answer in the Feb archives. (In Python 3 you have to type tkinter in all lower case.) Thanks all, Kristin On Fri, Oct 30, 2009 at 5:21 PM, Kristin Wilcox wrote: > I apologize in advance for as

[Tutor] problem adding Tkinter

2009-10-30 Thread Kristin Wilcox
I apologize in advance for asking such a simple question! I first tried looking through Google, and through the last couple months of this list's archives, and I found some talk about my issue out there but not a detailed enough answer to help someone as new as me. This is my first programming lan

Re: [Tutor] Accessing variables in main from functions in a module

2009-10-30 Thread Kent Johnson
On Fri, Oct 30, 2009 at 6:39 PM, Robert Lummis wrote: > I want to move some functions from my "main" program file to a module > file because the main file is getting too big for convenience. The > functions access arrays (lists of lists) that are defined and > initialised in the main file. How do

Re: [Tutor] Accessing variables in main from functions in a module

2009-10-30 Thread Alan Gauld
"Robert Lummis" wrote I want to move some functions from my "main" program file to a module file because the main file is getting too big for convenience. Good idea! functions access arrays (lists of lists) that are defined and initialised in the main file. How do I reference the main file

[Tutor] Accessing variables in main from functions in a module

2009-10-30 Thread Robert Lummis
I want to move some functions from my "main" program file to a module file because the main file is getting too big for convenience. The functions access arrays (lists of lists) that are defined and initialised in the main file. How do I reference the main file arrays from statements within the mod

Re: [Tutor] Sorting points on a 2D plane

2009-10-30 Thread Shashwat Anand
@Robert: You can look for a similar problem here : https://www.spoj.pl/problems/BSHEEP/ For algorithm I suggest you to go for Graham's scan or Quick hull. On Sat, Oct 31, 2009 at 1:39 AM, Robert Berman wrote: > Hello Shashwat, > > I have saved the web page for a much more detailed review aft

Re: [Tutor] Sorting points on a 2D plane

2009-10-30 Thread Robert Berman
Hello Shashwat, I have saved the web page for a much more detailed review after I work through the suggestions given by Alan et all. It is obvious that a casual read is not going to be enough. Thank you for the information. Robert On Fri, 2009-10-30 at 23:49 +0530, Shashwat Anand wrote: > The

Re: [Tutor] Sorting points on a 2D plane

2009-10-30 Thread Shashwat Anand
The problem belongs to 'Convex Hull' superset. look into : http://en.wikipedia.org/wiki/Convex_hull_algorithms On Thu, Oct 29, 2009 at 6:05 PM, Robert Berman wrote: > > Kent and Alan, > > Thank you both for providing me with tools I can use to develop the sort > portion of my algorithm. They ar

Re: [Tutor] How to manipulate a variable whose value depends on next values of list using LC or reduce()

2009-10-30 Thread Shashwat Anand
Got it !! @Alan, @DaveA: Hontoni Arigato :) On Fri, Oct 30, 2009 at 9:55 PM, Dave Angel wrote: > Shashwat Anand wrote: > >> Shashwat Anand to Bangalore >> show details 5:31 AM (2 minutes ago) >> >> >> >> I wrote an LCM function of mine as follows: >> >> import fractions >> def lcm(mylist): >>

Re: [Tutor] How to manipulate a variable whose value depends on next values of list using LC or reduce()

2009-10-30 Thread Dave Angel
Shashwat Anand wrote: Shashwat Anand to Bangalore show details 5:31 AM (2 minutes ago) I wrote an LCM function of mine as follows: import fractions def lcm(mylist): # lcm by defination is Lowest Common Multiple # lcm (a*b) = a*b / gcd(a*b) # lcm (a, b, c) = lcm(lcm(a, b), c) #

[Tutor] unicode: % & __str__ & str()

2009-10-30 Thread spir
[back to the list after a rather long break] Hello, I stepped on a unicode issue ;-) (one more) Below an illustration: === class U(unicode): def __str__(self): return self # if you can't properly see the string below, # 128 ¶ÿµ ¶ÿµ ¶ÿµ ¶ÿµ ¶ÿ