decorator with keyword749 (8/12/2004 9:17:15 AM) comp.lang.python I'm sure they have been mentioned somewhere but here are some more advantages of a decorator keyword (I use "transform"): - The docstring can be moved to the top of the decorator suite. - Simple attributes tha... Peter
decorators, function signature, and help()140 (8/10/2004 12:15:18 PM) comp.lang.python After a week or so I'm finally getting accustomed to the pie-pre-def syntax. Consider a simple-minded decorator that doesn't care about the signature of the function it wraps: >>> def noisy(f): .... def g... Peter
Tkinter: Clipping a canvas text item461 (2/21/2004 1:19:00 PM) comp.lang.python Is there a way to limit both width and height of a canvas text item? My current workaround seems clumsy: import Tkinter as tk root = tk.Tk() canvas = tk.Canvas(root, width=400, height=200, bg="white") canvas.p... Peter
Hiding/showing Tkinter.Canvas items282 (2/17/2004 8:20:30 AM) comp.lang.python Before I start moving them into dark corners of the canvas - is there a way to hide/show Tkinter canvas items without having to maintain their original position externally? All I've found so far is sortvisu.py ... Peter
Turning f(callback) into a generator654 (12/3/2003 5:48:41 PM) comp.lang.python It's easy to write a function that wraps a generator and provides a callback. E. g.: import os, sys def walk(path, visit): """ Emulate os.path.walk() (simplified) using os.walk()""" for dir, folders, ... Peter
Fast attribute/list item extraction062 (11/30/2003 10:45:14 AM) comp.lang.python There is currently a discussion on python-dev about an extract() function which offers fast access to list items and object attributes. It could serve, e. g., as the key argument of the future list.sort() metho... Peter
Method chaining162 (11/22/2013 11:26:07 AM) comp.lang.python A frequently missed feature is the ability to chain method calls:
x = 
=> x now equals [3, 2, 1, 4]
This doesn't work with lists, as the methods r... comp.lang.python(3358)
Creating a function for a directory165 (11/11/2013 10:26:46 PM) comp.lang.python So I want to take the file, "desktop/test.txt" and write it to "desktop/newfolder/test.txt". I tried the below script, and it gave me: "IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'". Any sugge... mattgraves7(10)
zip list, variables510 (11/20/2013 10:06:29 AM) comp.lang.python If
c = map(sum, zip([1, 2, 3], [4, 5, 6]))
Out: [5, 7, 9]
why then can't I do this?
a = ([1, 2], [3, 4])
b = ([5, 6], [7, 8])
c = map(sum, zip(a, b))
Please help with this93 (11/13/2013 4:18:58 AM) comp.lang.python Could you point out any errors in my code:
#This is a game where you have to escape a dragon.
# By Saad Imran
# Define questions and answers.
que1 = "4481 *2"
ans1 ... saad.imran98(1)