Nathan Harmston wrote:
> Unfortunately this doesnt work since a,a1,b,b1 arent declared in the
> function. Is there a way to make these variables accessible to the
> euclid function. Or is there a better way to design this function?
The canonical recommendations are: use attributes of the inner
fun
Steven D'Aprano wrote:
x, y, z = 1, 2, 3
x = y = z
x, y, z
>
> (3, 3, 3)
>
> I certainly wouldn't expect to get (2, 3, 3).
Neither would I. I must have expressed myself not clearly enough.
Currently
x = y = z
is roughly equivalent to
x = z
y = z
I propose to change it to
y = z
x = z
Given
class Node(object):
pass
node = Node()
nextnode = Node()
I tried to refactor the following piece of code
node.next = nextnode
node = nextnode
as
node = node.next = nextnode
only to discover that Python performs chained assignments
backwards compared to other langu
Arnaud Delobelle wrote:
> I'm not doing 'real world' calcultations, I'm making an app to help
> teach children maths. I need numerical values that behave well as
> decimals. I also need them to have an arbitrary number of significant
> figures. Floats are great but they won't help me with either.
Hello,
I hacked together a module implementing exact real
arithmetic via lazily evaluated continued fractions.
You can download it from
http://www-zo.iinf.polsl.gliwice.pl/~mciura/software/cf.py
an use as an almost drop-in replacement for the math module
if you don't care too much about performanc
Duncan Booth wrote:
> Marcin Ciura wrote:
>>See Figure 8 in
>>http://sun.iinf.polsl.gliwice.pl/~mciura/shellsort.pdf
> That isn't what the reference says. It only covers N up to a few thousand.
> Practical values of N need to at least go up into the millions.
Please loo
Tim Peters wrote:
> shellsort is much more a refinement of insertion-sort than of
> bubblesort, but is not an O(N log N) algorithm regardlesss.
With a judiciously chosen increment sequence,
the number of comparisons made by shellsort
*is* of the order N log N for practical values of N.
See Figure
Georg Brandl wrote:
> Steven D'Aprano wrote:
>>all(flying elephants which are pink) => true
>>all(flying elephants which are not pink) => true
>>
>>So, these flying elephants -- are they pink or not?
>
> No, you ask two different sets whether they are true.
No, there is only one empty set.
Releva
Bengt Richter wrote:
BTW, what makes you think any self-respecting "scientist" wouldn't be insulted
by the idea of your spoon-feeding them a dumbed-down programming equivalent of
"See Spot run"?
Am I right thinking that your dream 3 R's curriculum starts with
"Stately, plump Buck Mulligan" and Póly
Steve Holden wrote:
You could think about teaching them the linelist.append(fn(x)) way,
which then gives you the choice of
"".join(linelist) - no gaps
"\n".join(lienlist) - one item per line
" ".join(linelist) - spaces between items.
Sure I will. Next week, when we come to list operations.
.
In view of Duncan's response, which invalidates the premises
of my proposal, I announce the end of its short life. I will
add Duncan's solution to my bag of tricks - thank you!
Marcin
--
http://mail.python.org/mailman/listinfo/python-list
Larry Bates wrote:
I fail to see why
your proposed solution of:
for x in seq:
print fn(x),,
print
is clearer than:
print ''.join([fn(x) for x in seq])
Thank you for your input. The latter form is fine with me personally,
but you just can't explain it to complete novices. My prop
Duncan Booth wrote:
import sys
def nospace(value, stream=None):
'''Suppress output of space before printing value'''
stream = stream or sys.stdout
stream.softspace = 0
return str(value)
I'm teaching Python as the first programming language to non-computer
scientists. Many of the toy
Here is a pre-PEP about print that I wrote recently.
Please let me know what is the community's opinion on it.
Cheers,
Marcin
PEP: XXX
Title: Print Without Intervening Space
Version: $Revision: 0.0 $
Author: Marcin Ciura
Status: Draft
Type: Standards Track
Created: 11-Mar-2005
Post-Histor
14 matches
Mail list logo