On 6/2/2011 6:07 PM, Keir Rice wrote:
Hi All,
The following function was showing up in my profiles as a large bottle neck:
# Slow version
def RMSBand(self, histogram):
"""Calculates the root-mean-squared value for the given colour stream
histogram."""
intermediateResult = map(l
On 6/5/2011 5:31 AM, Alain Ketterlin wrote:
writes:
f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc
f=lambda ... statements are inferior for practical purposes to the
equivalent def f statements because the resulting object is missing a
useful name attribute and a docstr
On 6/6/2011 9:42 AM, jyoun...@kc.rr.com wrote:
f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc
Packing tail recursion into one line is bad for both understanding and
refactoring. Use better names and a docstring gives
def group(seq, n):
'Yield from seq successive disjoin
On 6/6/2011 1:29 PM, rusi wrote:
On Jun 5, 11:33 pm, Terry Reedy wrote:
Let me add something not said much here about designing functions: start
with both a clear and succinct definition *and* test cases. (I only
started writing tests first a year ago or so.)
I am still one year in the
On 6/6/2011 12:52 PM, Terry Reedy wrote:
def group(seq, n):
'Yield from seq successive disjoint slices of length n & the remainder'
if n<=0: raise ValueError('group size must be positive')
for i in range(0,len(seq), n):
yield seq[i:i+n]
for inn,out in (
(('
On 6/7/2011 7:35 AM, Robin Becker wrote:
I guess what I'm asking is whether any sequence that's using random to
generate random numbers is predictable if enough samples are drawn.
Apparently so. random.random is *not* 'cryptographically secure'.
https://secure.wikimedia.org/wikipedia/en/wiki/C
On 6/7/2011 8:46 AM, Chris Gonnerman wrote:
On the 30th of May, I received an email from a man (I'll leave out his
name, but it was properly male) offering to translate the docs for the
gdmodule (which I maintain) into Belorussian. He wanted my approval, and
a link from my page to his. This seeme
On 6/7/2011 7:05 PM, John Posner wrote:
You might want to try "new style" string formatting [1], which I think
is better than the "old style" in this particular case:
>>> "Testing {0:0{1}d}".format(42, 4)
'Testing 0042'
>>> "Testing {0:0{1}d}".format(42, 9)
'Testing 00042'
On 6/9/2011 5:46 PM, Nobody wrote:
On Thu, 09 Jun 2011 22:14:17 +0100, Sérgio Monteiro Basto wrote:
Exactly the opposite , if python don't know the encoding should not try
decode to ASCII.
What should it decode to, then?
You can't write characters to a stream, only bytes.
I want python don
On 6/9/2011 11:41 PM, Kyle T. Jones wrote:
Library support.
I urge people who use 2.x only for library support to let library
authors that they would have preferred a 3.x compatible library. I have
library authors say "Why port when none of my users have asked for a port?"
A couple of year
On 6/9/2011 9:12 PM, Carl Banks wrote:
Presumably, the reason you are overriding a method in a subclass is to change
its behavior; I'd expect an inherited docstring to be inaccurate more often
than not. So I'd be -1 on automatically inheriting them.
However, I'd be +1 easily on a little help
On 6/10/2011 3:31 AM, Gregory Ewing wrote:
Eric Snow wrote:
But for "method" objects (really a wrapper for
bound functions) would it change the __doc__ of the wrapper or of the
bound function?
You probably wouldn't want to change the __doc__ of a method
wrapper; instead you'd make sure you got
On 6/10/2011 3:15 PM, KK wrote:
Thanks for the reply!!
i ve installed the binary
but when i import anything of PyQt in my prog it says error??
i think there is some problem with folders
If you install in python32/Lib/site-packages, it should work.
But see Andrew's message. Show both
On 6/10/2011 6:30 AM, Francesc Segura wrote:
Hello all, I'm new to this and I'm having problems on summing two
values at python.
I get the following error:
Traceback (most recent call last):
File "C:\edge-bc (2).py", line 168, in
if (costGG<= cost + T0):
TypeError: unsupported operand t
On 6/10/2011 11:34 PM, Steven D'Aprano wrote:
I have a metaclass in Python 3.1:
class MC1(type):
@staticmethod
def get_mro(bases):
print('get_mro called')
return type('K', bases, {}).__mro__[1:]
The call to type figures out the proper metaclass from bases and
forwa
On 6/11/2011 7:38 AM, Steven D'Aprano wrote:
On Sat, 11 Jun 2011 01:33:25 -0400, Terry Reedy wrote:
On 6/10/2011 11:34 PM, Steven D'Aprano wrote:
I have a metaclass in Python 3.1:
class MC1(type):
@staticmethod
def get_mro(bases):
print('
On 6/11/2011 10:40 AM, Asen Bozhilov wrote:
It is exactly what I wanted to know. Thank you. I have not examined
classes in Python yet, but when I do it I will understand some new
things. One of the most interesting is, can an object inherit items
trough the parent class? By items I mean items wh
On 6/11/2011 3:27 PM, Giampaolo Rodolà wrote:
I've written this decorator to deprecate a function and (optionally)
provide a callable as replacement
def deprecated(repfun=None):
"""A decorator which can be used to mark functions as deprecated.
Optional repfun is a callabl
On 6/11/2011 9:32 PM, Andrew Berg wrote:
I'm pretty happy that I can copy variables and their value from one
You are copying names and their associations, but not the objects or
thier values.
object's namespace to another object's namespace with the same variable
names automatically:
class
On 6/13/2011 12:53 AM, Kumar Mainali wrote:
I have a huge dataset containing millions of rows and several dozen
columns in a tab delimited text file. I need to extract a small subset
of rows and only three columns. One of the three columns has two word
string with header “Scientific Name”. The o
On 6/13/2011 2:18 PM, kafooster wrote:
I am working on some medical image data, and I try to look into
specific slice of 3d *.raw image. I know voxels are 16 bit int, and
dimensions are 352*470*96. I checked it in some pro medical image
viewer, it is alright. However, with the code I use, I di
On 6/13/2011 5:51 PM, darnold wrote:
print "this" \
" is" \
" a" \
" test" \
this is a test
>>> print('this'
' is'
' a'
' test')
this is a test
Python ignores \n within parentheses, brackets, and braces, so no
fragile trailing backslash needed. ('Fragile', bec
On 6/14/2011 11:29 AM, Zachary Dziura wrote:
I have a dict that I would like to print out in a series of columns,
rather than as a bunch of lines. Normally when you do print(dict), the
output will look something like this:
{'Header2': ['2', '5', '8'], 'Header3': ['3', '6', '9'], 'Header1':
['1',
On 6/14/2011 3:49 AM, Martin De Kauwe wrote:
what is a .raw file, do you mean a flat binary?
Perhaps tiff-like.
https://secure.wikimedia.org/wikipedia/en/wiki/Raw_image_format
"Providing a detailed and concise description of the content of raw
files is highly problematic. There is no single ra
On 6/14/2011 2:37 PM, MRAB wrote:
On 14/06/2011 18:48, Zach Dziura wrote:
[snip]
I just have one quick question. On the line where you have zip(*arr),
what is the * for? Is it like the pointer operator, such as with C? Or
is it exactly the pointer operator?
[snip]
The * in the argument list of
On 6/15/2011 10:42 AM, Satyajit Sarangi wrote:
data = "GEOMETRYCOLLECTION (POINT (-8.96484375
-4.130859375000), POINT (2.021484375000 -2.63671875),
POINT (-1.40625000 -11.162109375000), POINT
(-11.95312500,-10.89843750), POLYGON
((-21.62109375
On 6/16/2011 4:37 AM, simona bellavista wrote:
Hi, I am quite new to python and I am trying to do some simple plots.
I am using python Python 2.6.4 and numpy/1.5.1
I have an ASCII data file that I am reading with the following lines
of code:
import pylab
import numpy as np
filename='something.
On 6/16/2011 3:09 AM, KK wrote:
How can the execution time of python program be increased in
decreased
programming contest so that we dont get TLE for gud algos..
TLE = time limit expired?
Sites or 'contests' that have the same time limit for Python as for C,
especially when the limit
On 6/16/2011 12:44 PM, Dennis Lee Bieber wrote:
On Thu, 16 Jun 2011 16:26:31 +0100, David Aldrich
declaimed the following in
gmane.comp.python.general:
... python27.dll is missing from your computer ...
and, indeed, it is in neither C:\Windows\System32 nor C:\Windows\SysWOW64.
Did
On 6/16/2011 11:55 AM, Tim Johnson wrote:
* Tim Johnson [110615 18:53]:
* geremy condra [110615 18:03]:
On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson wrote:
Using Python 2.6.5 on linux.
When using MySQLdb I am getting warnings printed to stdout, but I would
like to trap, display and log tho
On 6/16/2011 3:01 PM, Tim Johnson wrote:
* Terry Reedy [110616 10:50]:
The machinery in the warnings module is only for instances of
subsclasses of Warning. Are the warnings from MySQLdb properly such
objects? If so, what class are they?
The warnings are sent directly to stdout. No way
On 6/17/2011 3:03 PM, Ethan Furman wrote:
Windows platform (XP Pro, SP2).
This works fine on local drives, but on network (both 2003 Server, and
Samba running on FreeBSD) the following produces an error:
--> data = '?' * 119757831 # use b'?' if on 3.x
--> test = open(r's:\junk.tst', 'wb')
--> t
On 6/16/2011 11:18 PM, Greg Ewing wrote:
PyGUI 2.5 is available:
http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/
Lots of new stuff in this version. Highlights include:
Greg left out the most important to me:
"Now works with Python 3 on MacOSX and Windows!"
--
Terry Jan Reedy
--
http
On 6/17/2011 12:17 PM, John Salerno wrote:
On Jun 17, 2:25 am, Gregory Ewing wrote:
It sounds like shutil.copy() is what you want, or one of the
other related functions in the shutil module.
This looks promising! But can src be a directory, or does it have to
be a file? For my purposes (co
On 6/18/2011 1:13 PM, Michael Hrivnak wrote:
Python is great for automating sysadmin tasks, but perhaps you should
just use rsync for this. It comes with the benefit of only copying
the changes instead of every file every time.
"rsync -a C:\source E:\destination" and you're done.
Perhaps 'syn
On 6/18/2011 7:34 AM, mzagu...@gmail.com wrote:
Hello Folks,
I am wondering what your strategies are for ensuring that data
transmitted to a website via a python program is indeed from that
program, and not from someone submitting POST data using some other
means. I find it likely that there is
On 6/19/2011 9:24 AM, Steven D'Aprano wrote:
No. Each cell in a Lisp-style linked list has exactly two elements, and
in Python are usually implemented as nested tuples:
(head, tail) # Annoyingly, this is also known as (car, cdr).
where head is the data value and tail is either another Lisp-st
On 6/19/2011 11:39 AM, Laurent Claessens wrote:
In the same time I've a thread that read the list and perform the
operations:
def run():
while task_list :
task = task_list[0]
task_list.remove(task)
task.start()
Popping task off the end of the list is more efficient:
while task_list:
task_l
On 6/19/2011 11:53 AM, Roy Smith wrote:
Yet another variation which makes sense if you want to delete most of
the keys would be to copy them to a new dictionary. I'm not sure how
Python handles memory management on dictionaries which shrink.
'Python' does not handle memory management; each im
On 6/19/2011 11:13 AM, Chris Angelico wrote:
On Mon, Jun 20, 2011 at 12:32 AM, TheSaint wrote:
Hello
Trying to pop some key from a dict while is iterating over it will cause an
exception.
How I can remove items when the search result is true.
Example:
while len(dict):
for key in dict.keys
On 6/19/2011 12:03 PM, Chris Angelico wrote:
On Mon, Jun 20, 2011 at 1:39 AM, Laurent Claessens wrote:
My problem is that when FileToCopyTask raises an error, the program does not
stop.
In fact when the error is Disk Full, I want to stop the whole program
because I know that the next task will
On 6/20/2011 10:30 AM, Florencio Cano wrote:
To make an example: imaging Bingo.Shuffle the numbers, each number sorted
should be removed from the container, how would it implemented?
The structure seems a set -> unordered collection of unique elements.
You can select a random element from the
On 6/20/2011 2:51 AM, Stephen Bunn wrote:
Thanks for the replies. I would like to use the second method because I
plan to implement everything in python.
The main problem of your second method is that you repeat the check
function in each script. That will be a problem if you ever want to
mo
On 6/20/2011 3:12 AM, Benjamin Kaplan wrote:
On Sun, Jun 19, 2011 at 9:04 PM, John Salerno wrote:
On Jun 19, 8:52 pm, Chris Kaynor wrote:
Having a character class (along with possibly player character, non-player
character, etc), make sense; however you probably want to make stuff like
hea
On 6/20/2011 8:28 PM, Gnarlodious wrote:
What is the easiest way to get the first number as boolean?
divmod(99.6, 30.1)
Or do I have to say:
flote, rem=divmod(99.6, 30.1)
bool(flote)
divmod(x,y) == x//y, x%y
so bool(x//y)
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/pytho
On 6/20/2011 6:04 PM, Joel wrote:
On Jun 4, 2:27 pm, "TommyVee" wrote:
I'm using the SimPy package to run simulations. Anyone who's used this
package knows that the way it simulates process concurrency is through the
clever use of yield statements. Some of the code in my programs is very
comple
On 6/20/2011 8:46 PM, Tim Chase wrote:
On 06/20/2011 05:19 PM, Ben Finney wrote:
“This method of string formatting is the new standard in
Python 3.0, and should be preferred to the % formatting
described in String Formatting Operations in new code.”
http://docs.python.org/library/stdtypes.html#
On 6/20/2011 9:26 PM, John Salerno wrote:
I can't quite seem to find the answer to this anywhere. The book I'm
reading right now was written for Python 3.1 and doesn't use (object),
so I'm thinking that was just a way to force new-style classes in 2.x
and is no longer necessary in 3.x. Is that ri
On 6/21/2011 9:43 AM, Antoon Pardon wrote:
matcher = SequenceMatcher(ls1, ls2)
...
What am I doing wrong?
Read the doc, in particular, the really stupid signature of the class:
"class difflib.SequenceMatcher(isjunk=None, a='', b='', autojunk=True)"
You are passing isjunk = ls1, a = ls2,
On 6/21/2011 7:33 AM, Tim Chase wrote:
On 06/20/2011 09:17 PM, Terry Reedy wrote:
On 6/20/2011 8:46 PM, Tim Chase wrote:
On 06/20/2011 05:19 PM, Ben Finney wrote:
“This method of string formatting is the new standard in
Python 3.0, and should be preferred to the % formatting
described in
On 6/20/2011 10:59 PM, king6c...@gmail.com wrote:
> Hi,
> I have two large files,each has more than 2 lines,and each line
> consists of two fields,one is the id and the other a value,
> the ids are sorted.
>
> for example:
>
> file1
> (uin_a y)
> 1 1245
> 2 12333
> 3 324543
> 5 34645
On 6/21/2011 3:48 PM, John Salerno wrote:
Absolutely not! Each problem has been designed according to a "one-
minute rule", which means that although it may take several hours to
design a successful algorithm with more difficult problems, an
efficient implementation will allow a solution to be o
On 6/21/2011 8:00 PM, Paul Rubin wrote:
Terry Reedy writes:
efficient implementation will allow a solution to be obtained on a
modestly powered computer in less than one minute."
If something really takes a minute in C,
allow yourself at least 10 minutes or even more with plain CPython.
On 6/22/2011 1:32 AM, Paul Rubin wrote:
Terry Reedy writes:
If the best C program for a problem takes 10 seconds or more, then
applying the same 1 minute limit to Python is insane, and contrary to
the promotion of good algorithm thinking.
The Euler problems
are not the only algorithm
On 6/22/2011 11:45 AM, Chetan Harjani wrote:
why tuples are immutable whereas list are mutable?
Because tuples do not have mutation methods, which lists do.
Tuple and lists both have .__getitem__ but tuples do not have
.__setitem__ or .__delitem__ (or .append, .extend, .sort, or .reverse).
On 6/23/2011 10:09 AM, Gnarlodious wrote:
On Jun 23, 7:59 am, Noah Hall wrote:
>from a import x
I'm doing that:
import Module.Data as Data
However I end up doing it in every submodule, so it seems a little
redundant. I wish I could load the variable in the parent program and
have it be availa
On 6/24/2011 12:32 AM, Chetan Harjani wrote:
x=y="some string"
And we know that python interprets from left to right.
Read the doc. "5.14. Evaluation order
Python evaluates expressions from left to right. Notice that while
evaluating an assignment, the right-hand side is evaluated before the
On 6/23/2011 11:49 PM, Gnarlodious wrote:
Let me restate my question.
Say I have a script Executable.py that calls all other scripts and
controls them:
#!/usr/local/bin/python
from Module import Data
import ModuleTest
ModuleTest.py has this:
print(Data.Plist.Structure)
Running Executable.py g
On 6/24/2011 4:06 PM, Tycho Andersen wrote:
tmp = {}
x['huh'] = tmp # NameEror!
That is, the right hand sides of assignments are evaluated before the
left hand sides. That is (somehow?) not the case here.
You are parsing "a = b = c" as "a = (b = c)" which works in a language
in which assignm
On 6/24/2011 7:30 AM, Gnarlodious wrote:
On Jun 24, 12:27 am, Terry Reedy wrote:
1) Can I tell Executable.py to share Data with ModuleTest.py?
After the import is complete, yes.
import ModuleTest
ModuleTest.Data = Data
This works if the use of Data is inside a function that is not called
On 6/24/2011 2:01 PM, anand jeyahar wrote:
Not sure, this is the right place, redirect me if it's not.
I was curious about the
functionoverloading(http://svn.python.org/view/sandbox/trunk/overload/)
and was trying to do a svn checkout of the branch and failed. Is it
restricted access for even ch
On 6/24/2011 5:08 PM, Tycho Andersen wrote:
"An assignment statement evaluates the expression list (remember that
this can be a single expression or a comma-separated list, the latter
yielding a tuple) and assigns the single resulting object to each of
the target lists, from left to right."
Th
On 6/24/2011 10:39 PM, pipehappy wrote:
Hi,
Why people want print() instead of print str? That's not a big deal
and the old choice is more natural. Anyone has some clue?
print as a function instead of a statement is consistent with input as a
function, can be overridden with custom versions,
On 6/26/2011 11:28 AM, rzed wrote:
steve+comp.lang.pyt...@pearwood.info wrote in
Are you aware that you're trying to install a Python2 library
under Python3?
Thank you all for your responses. Yes, I am aware of the version
difference, but not of all the implications of that. I will run this
On 6/26/2011 1:07 PM, Bastian Ballmann wrote:
you can have a look at http://lightblue.sourceforge.net/ but it also
seems to be unactive since end of 2009.
schrieb Valentin de Pablo Fouce:
I'm looking for developing a bluetooth application in python, and I'm
looking for the most suitable py
On 6/26/2011 2:28 PM, Marc Aymerich wrote:
Hi,
I'm trying to define a function that has an optional parameter which
should be an empty list whenever it isn't given. However, it takes as
value the same value as the last time the function was executed. What
is the reason of this behaviour? How does
On 7/2/2011 12:52 PM, Dan Stromberg wrote:
Is there a decent way of running "from import *"? Perhaps
using __import__?
Does it mean using the copy module or adding an element to globals()
somehow?
Yes, I think I do have a good use for this: importing either pure python
or cython versions of
No other objects have code objects. No other objects in
Python have this special optimization.
A .pyc file is a serialized code object for a module.
As for the rest, I am not sure what you are asking.
Terry Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 7/9/2011 6:34 PM, Steven D'Aprano wrote:
Suppose instead an implementation of Python did not pre-compile the
function. Each time you called spam(n), the implementatio n would have to
locate the source code and interpret it on the spot. Would that be
allowed?"
If that's your question, then I
On 7/10/2011 7:21 AM, Yingjie Lan wrote:
I wonder if Python provides a way to define anonymous functions containing
multiple statements?
No, intentionally not. Forget this idea. Multiple functions named
'' are inferior for representation purposes, like in error
tracebacks, to those with indi
On 7/11/2011 11:37 PM, Xah Lee wrote:
it's funny, in all these supposedly modern high-level langs, they
don't provide even simple list manipulation functions such as union,
intersection, and the like. Not in perl, not in python,
Union and intersection are set operations, not list operations. Py
On 7/11/2011 11:37 PM, Xah Lee wrote:
watch the first episode of Douglas Crockford's talk here:
http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-1
The link includes a transcript of the talk, which I read
I suspect Lee likes Crockford because they both think they are smarter
than
On 7/12/2011 10:46 AM, Billy Mays wrote:
I want to make a generator that will return lines from the tail of
/var/log/syslog if there are any, but my function is reopening the file
each call:
def getLines():
with open('/var/log/syslog', 'rb') as f:
while True:
line = f.readline()
if line:
yield l
On 7/12/2011 2:23 PM, gene heskett wrote:
Now, I hate to mention it Terry, but your clock seems to be about 126
months behind the rest of the world.
Please do not hate to be helpful. It was a bad malfunction perhaps due
to a run-down battery on a machine turned off for two weeks. I will keep
On 7/13/2011 4:29 AM, Teemu Likonen wrote:
* 2001-01-01T14:11:11-05:00 * Terry Reedy wrote:
As a side note, the same principle of expressions matching operations
in symmetry suggest that majority of up are quite sensible and not
dumb idiots for preferring 'f(x)' to the '(f x)
On 7/13/2011 2:26 AM, alex23 wrote:
Thomas Jollans wrote:
Coincidentally, Guido wrote this blog post just last week, without which
I'd be just as much at a loss as you:
http://python-history.blogspot.com/2011/07/karin-dewar-indentation-an...
It's also part of the Python FAQ:
http://docs.pyt
On 7/13/2011 8:39 AM, Anthony Kong wrote:
I am giving a few presentations on python to my colleagues who are mainly java
developers and starting to pick up python at work.
So I have picked this topic for one of my presentation. It is because
functional programming technique is one of my favo
On 7/13/2011 10:19 AM, Anthony Kong wrote:
One of the main difference is that pypy supports only R-Python, which
stands for 'Restricted Python".
Not true. PyPy is *written* in rpython. It runs standard Python.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 7/13/2011 4:33 PM, Adeoluwa Odein wrote:
The same error. The sample were found on the following site --I copied
exactly what is written there:
1. http://www.jython.org/archive/21/docs/zxjdbc.html
The jython-users mailing list might be a better place to ask your
question. Most people here a
On 7/14/2011 3:20 PM, MRAB wrote:
On 14/07/2011 18:22, Miki Tebeka wrote:
Greetings,
I'm trying to decode JSON output of a Java program (jackson) and
having some issues.
The cause of the problem is the following snippet:
{
"description": "... lives\uMOVE™ OFFERS ",
}
Which causes ValueError: In
On 7/14/2011 3:46 PM, Billy Mays wrote:
I noticed that if a file is being continuously written to, the file
generator does not notice it:
Because it does not look, as Ian explained.
def getLines(f):
lines = []
for line in f:
lines.append(line)
return lines
This nearly duplicates .readlines,
On 7/14/2011 9:51 PM, Ben Finney wrote:
Steven D'Aprano writes:
Inside wrote:
As telling in the subject,because "list" and "tuple" aren't functions,they
are types.Is that right?
At one time (before 2.2), they were functions and not classes.
Yes they are types. But they can still be used
On 7/15/2011 6:19 AM, Steven D'Aprano wrote:
Use None as default. Requiring users to use your special value would be
a nuisance. They may have data prepared separately from your module.
Rob Williscroft wrote:
MISSING = MissingObject()
def mean( sequence, missing = MISSING ):
This is also
On 7/15/2011 8:26 AM, Billy Mays wrote:
On 07/15/2011 04:01 AM, bruno.desthuilli...@gmail.com wrote:
On Jul 14, 9:46 pm, Billy Mays wrote:
I noticed that if a file is being continuously written to, the file
generator does not notice it:
def getLines(f):
lines = []
for line in f:
lines.append(l
On 7/15/2011 10:42 AM, Billy Mays wrote:
On 07/15/2011 10:28 AM, Thomas Rachel wrote:
Am 15.07.2011 14:52 schrieb Billy Mays:
Really what would be useful is some sort of PauseIteration Exception
which doesn't close the generator when raised, but indicates to the
looping header that there is n
On 7/18/2011 8:24 AM, Paul Woolcock wrote:
Partial function application (or "currying") is the act of taking a
function with two or more parameters, and applying some of the arguments
in order to make a new function. The "hello world" example for this
seems to be this:
Let's say you have a func
On 7/18/2011 8:20 AM, Anthony Kong wrote:
Thanks for all the great suggestion.
First of all, Carl is right that it does not take much to impress a
java programmer about the expressiveness of functional programming.
Covered map, reduce and filter as Rainer suggested.
Emphasized the advantages
On 7/18/2011 3:23 PM, woooee wrote:
Partial can be used in a GUI program, like Tkinter, to send arguments
to functions. There are other ways to do that as well as using
partial. The following program uses partial to send the color to the
change_buttons function.
from Tkinter import *
from funct
On 7/19/2011 2:52 AM, Raymond Hettinger wrote:
On Jul 14, 6:21 pm, Inside wrote:
As telling in the subject,because "list" and "tuple" aren't
functions,they are types.Is that right?
They are not instances of a class whose definition name includes the
word 'Function'. They *are* things that ca
On 7/19/2011 5:47 AM, Peter Irbizon wrote:
Hello, please I have problem with "The following modules appear to be
missing" message during compiling my app exe file with py2exe. What
should I do with this? Many thanks in advance.
From the stuff below, you appear to be compiling for Windows.
The
On 7/19/2011 6:07 AM, Dave Angel wrote:
On 01/-10/-28163 02:59 PM, Thomas 'PointedEars' Lahn wrote:
Dave Angel wrote:
On 01/-10/-28163 02:59 PM, Terry Reedy wrote:
def makeadder(y)
def _add(x): return x+y
add2 = makeadder(2)
A couple of typos in that code:
def makeaddr(y):
On 7/19/2011 9:52 AM, Billy Mays wrote:
On 07/19/2011 09:43 AM, Ben Finney wrote:
Billy Mays
<81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> writes:
I have a method getToken() which checks to see if a value is set, and
if so, return it. However, it doesn't feel pythonic to me:
On 7/19/2011 9:32 AM, Matty Sarro wrote:
Hey everyone. I am currently reading through an RFC, and it mentions
that a client and server half of a transaction are embodied by finite
state machines. I am reading through the wikipedia article for finite
That was going to be my first suggestion, but
On 7/19/2011 2:15 AM, Thomas 'PointedEars' Lahn wrote:
Steven D'Aprano wrote:
Nulpum wrote:
I want to make sure that folder exists.
'2011-07-03' is really exists. but 'os.path.isdir' say false
Does anyone know why?
Yes.
print "logs/2011-07-03"
logs/2011-07-03
print "logs\2011-07-03"
l
On 7/19/2011 6:41 AM, Morten Klim wrote:
Hello everyone!
I've started developing a little application for one of my friends,
which he will use at work to measure his hours working + the time he
has breaks. I wanna do this in python cause, I just started with this
language and wanna get more fimil
On 7/19/2011 2:12 PM, Xah Lee wrote:
Also, you may have answered this earlier but I'll ask again anyways: You
ask for the first mismatched pair, Are you referring to the inner most
mismatched, or the outermost? For example, suppose you have this file:
foo[(])bar
Would the "(" be the first mis
On 7/19/2011 1:00 PM, Micah wrote:
That sounds artificially backwards; why not let getToken() reuse peekToken()?
def peek(self):
if self.tok is None:
try:
self.tok = self.gen.next()
If this is changed (as intended for the iteration protocol) to
self.tok
On 7/19/2011 6:02 PM, EricC wrote:
Hi,
I am a newbie - I have been teaching myself Python 3 since a few
months ago. My “self assignments” include some purely for fun. Among
them was using the turtle module to have multiple turtles running
around on the screen.
Recently one such fun turtle “proj
On 7/19/2011 10:12 PM, sturlamolden wrote:
What is wrong with them:
1. Designed for other languages, particularly C++, tcl and Java.
2. Bloatware. Qt and wxWidgets are C++ application frameworks. (Python
has a standard library!)
3. Unpythonic memory management: Python references to deleted C++
On 7/20/2011 2:21 AM, Stefan Behnel wrote:
Terry Reedy, 19.07.2011 18:31:
Chapter 5 is mostly about the behavior of built-in class instances. For
some classes, like range, instances only come from class calls and the
behavior of instances is intimately tied to the constructor arguments.
Having
701 - 800 of 7511 matches
Mail list logo