Nallo's Profile User Rating: -----

Reputation: 165 Stalwart
Active Posts:
261 (0.11 per day)
19-July 09
Profile Views:
Last Active:
User is offline Jul 03 2015 09:46 AM

Previous Fields

Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
Icon   Nallo has not set their status

Posts I've Made

  1. In Topic: User Input Test

    Posted 23 Jun 2015

    Your program reads from stdin. So what you need is another program that writes to stdout and connect stdout with stdin through a pipe.

    From the command line on a unix system (maybe python2 or python3 instead of python):
    cat input.txt | python

    Windows equivalent (if I remember correctly been years since I last used windows):
    type input.txt | python
  2. In Topic: remeber previous iteration!

    Posted 3 May 2015

    Your problem is that you used a mutable object as a default argument.

    Run this to see what happens:
    def foo(n, bar = []):
        return bar
    baz = foo(1)
    baz = foo(2)

    To avoid that:
    def foo(n, bar = None):
        if bar is None:
            bar = []
        return bar
    baz = foo(1)
    baz = foo(2)
  3. In Topic: tkinter drawing rectangles

    Posted 2 Feb 2015

    create_rectangle takes four arguments plus some optional arguments. Those four arguments denote the position of the upper left and lower right corner: create_rectangle(x1, y1, x2, y2).
    What you did with the comented out self.canvas.create_rectangle(self.lst[i], 10, self.lst[i], 10) is create a rectangle for which the upper left and lower right corner are the same (no wonder you see no rectangle).

    An example:
    from Tkinter import *
    master = Tk()
    w = Canvas(master, width=200, height=100)
    x, y = 10, 10
    width = 25
    width2 = 50
    height = 5
    dist = 10
    w.create_rectangle(x, y, x + width, y + height, outline='blue', fill="red")
    w.create_rectangle(x, y + height + dist, x + 50, y + height + dist + height) 
  4. In Topic: Learning Python

    Posted 4 Jun 2014

    when you are writing
    x = Set([1, 3, 5, 7])
    print(x.union(Set([1, 4, 7])))

    other is Set([1, 4, 7]), so in the union fuction call in line
    for x in other:

    python tries to get an iterator over other ...
    ...python: thinking
    ...python: no __iter__ method defined
    ...python: oops, use some fallback
    ...not sure here, but python "does something" with __getitem__

    in other words:
    python needs an iterator to execute
    for x in other:

    but has some fallback if __iter__ is not provided for the other instance (again I am not sure about that fallback)
  5. In Topic: Help keeping track of attendees

    Posted 28 May 2014

    Edit: removed as was wrong

My Information

Member Title:
D.I.C Regular
103 years old
January 1, 1913
Programming Languages:
who cares

Contact Information

Website URL:
Website URL  http://