to call the file .py or
.pyw; the difference between console and graphical programs and so on.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
Alf P. Steinbach al...@start.no wrote in message
news:hcdlsp$9a...@news.eternal-september.org...
* bartc:
Alf P. Steinbach al...@start.no wrote in message
news:hc8pn3$dd...@news.eternal-september.org...
[Cross-posted comp.programming and comp.lang.python]
You use the highly commercial
{..}, and
doesn't have endif.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
simon pianomaes...@gmail.com wrote in message
news:a50b1c21-287b-498d-a8c3-51a3a2f94...@k9g2000vbl.googlegroups.com...
#!/usr/bin/env python
from math import *
from random import *
import cairo
from cairo import Context
What's cairo?
--
languages, then you're probably
doing some programming.
And with programs where the runtime is not significant, it could be
either...
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
are over, and neither Notepad nor your printer attempts to
maintain compatibility with a Teletype model 37.
Odd that TXT files under Windows still use the same 13 (carriage return), 10
(linefeed) and 9 (tab) codes that used to work on my ASR 33. So why not code
12 (formfeed)?
--
Bartc
Steve Holden st...@holdenweb.com wrote in message
news:mailman.1007.1263682208.28905.python-l...@python.org...
bartc wrote:
Nobody nob...@nowhere.com wrote in message
news:pan.2010.01.16.04.24.18.437...@nowhere.com...
On Fri, 15 Jan 2010 10:42:43 -0800, W. eWatson wrote:
I thought I'd put
Dennis Lee Bieber wlfr...@ix.netcom.com wrote in message
news:mailman.1021.1263702437.28905.python-l...@python.org...
On Sat, 16 Jan 2010 23:59:52 GMT, bartc ba...@freeuk.com declaimed
the following in gmane.comp.python.general:
My point was these other control codes from over 30 years ago
left and right
Any particular reason why two, and not one (or three)? In some fonts it's
difficult to tell how many as they run together.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
, and use the appropriate syntax. Sometimes this is helpful,
sometimes not.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
Jonathan Gardner wrote:
On Feb 2, 7:23 am, bartc ba...@freeuk.com wrote:
Jonathan Gardner wrote:
One of the bad things with languages like perl and Ruby that call
without parentheses is that getting a function ref is not obvious.
You need even more syntax to do so. In perl:
foo(); # Call
it.
That might be true when used to code actual algorithms using basic features.
But a lot of Pythonisms would appear mysterious to someone who doesn't know
the language (for example, what does :: mean in an array index).
Or perhaps pseudo-code is much more advanced these days...
--
bartc
to say:
if b==0 and i==0 and u==0:
drawtext(s)
elif b==1 and i==0 and u==0:
drawtextb(s)
and so on. With half-a-dozen or more booleans, this becomes completely
impractical.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
Arnaud Delobelle arno...@googlemail.com wrote in message
news:m28wb6ypfs@googlemail.com...
Gabriel Genellina gagsl-...@yahoo.com.ar writes:
En Fri, 05 Feb 2010 19:22:39 -0300, bartc ba...@freeuk.com escribió:
Steve Holden st...@holdenweb.com wrote in message
news:mailman
doesn't work because if you assign a
That shows a different outlook. I would have said your first example works
as expected and it was the second example that was strange, possibly due to
shallow instead of deep copies by Python.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
infrequently
in final code. But they are handy when developing code too: you don't want
to waste time refactoring, and generally turning code upside-down, when the
code has to be rewritten a dozen times anyway.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
finding volunteers.
And even when we've had volunteers, hardly anyone shows up!
Any suggestions would be appreciated.
Try and get a girl or two interested in coming to the meetings...
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
garabik-news-2005...@kassiopeia.juls.savba.sk wrote in message
news:h6r4fb$18...@aioe.org...
In comp.lang.python James Harris james.harri...@googlemail.com wrote:
On 22 Aug, 10:27, David 71da...@libero.it wrote:
...
What about 2_1011, 8_7621, 16_c26h or 2;1011, 8;7621, 16;c26h ?
They
confusing,
No issue of what base the base indicator is expressed in.
It can be assumed however that .9. isn't in binary?
That's a neat idea. But an even simpler scheme might be:
.octal.100
.decimal.100
.hex.100
.binary.100
.trinary.100
until it gets to this anyway:
.thiryseximal.100
--
Bartc
, then I won't bother.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
])
Should it print 3 (the elements in [10,20,30]), or 1 (treating [10,20,30] as
a potential list containing the single element [10,20,30])?
--
bartc
--
http://mail.python.org/mailman/listinfo/python-list
, but this wouldn't
have helped the speed any. Nor the memory consumption.
A for-loop, for iterating over a simple sequence, should be one of the
fastest things in the language.
[Presumably the internal code that created those consecutive integers used a
more conventional looping method...]
--
Bartc
):
L = math.sqrt((v[0]*v[0]+v[1]*v[1]+v[2]*v[2]))
return (v[0]/L,v[1]/L,v[2]/L)
(Strangely, changing those divides to multiplies made it slower.)
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote in message
news:87fwyxgvuv@dpt-info.u-strasbg.fr...
Bartc ba...@freeuk.com writes:
def norm3d(v):
L = math.sqrt((v[0]*v[0]+v[1]*v[1]+v[2]*v[2]))
return (v[0]/L,v[1]/L,v[2]/L)
(Strangely, changing those divides to multiplies made
it be more natural to call them a one year old? Zero
based counting is perfectly natural.
Depends whether you are counting (discrete) things, or measuring them (over
a continuous range).
You would start counting at 1, but start measuring from 0.
--
Bartc
--
http://mail.python.org/mailman/listinfo
-based so it's (L-1)/P+1 (integer divide), or 5 pages.
If we switch to 0-based counting, it's just L/P ('266' lines require '4'
pages), but who's going to explain that to the user?
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
useful for being able to write same-line
comments with meaningful content...
(I've used 80-column hardware (teletypes and such) years ago, I thought such
restrictions had vanished long ago)
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
listings.
Those of you who think old hardcopy terminals did 132 wide obviously
don't remember the ASR-33 :-)
ASR33s I think might have been 72 columns wide (and punched cards had a
similar restriction).
However, lineprinter output was more likely to be 132 columns.
--
bartc
--
http
Roy Smith r...@panix.com wrote in message
news:roy-181632.07571818082...@news.panix.com...
In article qkoao.53872$gq5.12...@hurricane,
BartC ba...@freeuk.com wrote:
Remember, the old hardcopy terminals used to produce
132-character-wide
listings.
Those of you who think old hardcopy
.
So some sorts will make sense, and others (such as or ) won't.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
the other. That's an appreciable difference,
which you can't really just dismiss.
And you can't tell what the overall effect on a program will be: perhaps the
loop will be in a library function , which might be called billions of
times.
--
Bartc
--
http://mail.python.org/mailman/listinfo
Steve Holden st...@holdenweb.com wrote in message
news:mailman.54.1292502247.6505.python-l...@python.org...
On 12/16/2010 5:44 AM, BartC wrote:
One these is 30% faster than the other. That's an appreciable
difference, which you can't really just dismiss.
shol...@lifeboy ~
$ python -m
it into the phone socket!).
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
this)?
And why not use 1 and 0 for TRUE and FALSE? Even the consumer appliances in
my house have 1 and 0 on their power switches! With the advantage that they
are internationally recognised.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
with a broader instruction set.
One with zero instructions might be even simpler than that:
http://en.wikipedia.org/wiki/Zero_instruction_set_computer
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
that syllable was stressed anyway.)
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
the resulting bugs. I
agree.
Out of curiosity, what resulting bugs?
Probably things like i=(++i)+(--i), although more of being indeterminate
than a bug.
That assumes that ++i was intended for use in an expression, rather than
just be a statement.
--
Bartc
--
http://mail.python.org
is not considered 'pythonic'; certainly it's a crude, if effective,
way of getting extra performance).
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
is another.
But then, the dividing line between constants and 'variables' can get
confused when the values involved are complex (strings and such), so might
be understandable up to a point.
--
bartc
--
http://mail.python.org/mailman/listinfo/python-list
to avoid. Switch is
attractive for an interpreted language because - provided all cases are
constants, a bit of a problem in Python, because as soon as you give a name
to something, it's no longer constant - it can be implemented very
efficiently.)
--
Bartc
--
https://mail.python.org/mailman
GöktuğKayaalp s...@gkayaalp.com wrote in message
news:mailman.6377.1391490975.18130.python-l...@python.org...
BartC b...@freeuk.com writes:
Göktuğ Kayaalp s...@gkayaalp.com wrote in message
news:mailman.4966.1388953508.18130.python-l...@python.org...
AFAIK, we do not have postfix
strings have simplified all kids of text manipulation,
lexical
scanning, and data storage/communication code resulting in immeasurable
savings over the years.
They both have their uses.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
. And depending on the memory management
arrangements, such a length need not be stored at all.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
(vertinchlines):
newtext.append()
for s in newtext:
print (s)
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
:
print (lines)
The text handling is clunky (I had to learn the Python as I went along), but
with these things you just want to get something working first, then you can
tweak.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
the output you're getting that has too many asterisks.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
someone wesbr...@gmail.com wrote in message
news:9533449.630.1335042672358.JavaMail.geo-discussion-forums@ynmf4...
On Saturday, April 21, 2012 3:44:49 PM UTC-5, BartC wrote:
Hi, Bart: Thank you, your post is working now, maybe, I did something
wrong, unfortunately, you are right, my setup
they're
being paid for? There's also the risk of mixing up software created at home,
with that done at work, with all the intellectual property issues that might
arise.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
variables.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
multiple systems of exponents.
(A few years ago the biggest number I'd heard of was Skewes' Number
(something like 10^10^10^34), but even that is trivial to write using
conventional exponents as I've just shown. Graham's Number is in a different
class altogether.)
--
Bartc
--
http
' too.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
be interesting to see how well it works.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
in practice.
Yes, it generates lots of calls.
About 22000 for fib(20), and 330 million for fib(40).
That's why it's popular for benchmarks that measure performance of function
calls. Using an iterative algorithm wouldn't work quite so well...
--
Bartc
--
http://mail.python.org/mailman/listinfo
, another source of errors. Having an
undifferentiated } to close all kinds of blocks doesn't help either.
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
will be different!
For a static language such as this, type-discipline is important. And even
if the compiler gets it right, a human reading the code would have trouble
determining the return type, except in trivial examples like this.
Putting in an explicit return type is the simplest way to go.
--
Bartc
for records then, because
it would be impossible to change a field of a record.)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote in message
news:5315eec0$0$29985$c3e8da3$54964...@news.astraweb.com...
On Tue, 04 Mar 2014 13:30:04 +, BartC wrote:
Isn't creating classes in Python similar to creating types elsewhere?
Depends on the type: I suppose you can
at random until the code compiled? *wink*
You underestimate how much programming (of applications) can be done without
needing any of this stuff.
Needless to say, I didn't last long !-)
And rightly so :)
I guess they wanted code that could be maintained by anybody.
--
Bartc
--- news
), then iterated between the values of the list!
So Python had the distinction of being one of the slowest languages in which
to do nothing (ie. running an empty loop).
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
in it without relying
on accelerators, and not have to wait two and a half minutes (or whatever)
for a simple test to complete.
--
bartc
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano st...@remove-this-cybersource.com.au wrote in message
news:4c83b425$0$28657$c3e8...@news.astraweb.com...
On Sun, 05 Sep 2010 12:28:47 +0100, BartC wrote:
It would
be nice if you could directly code low-level algorithms in it without
relying on accelerators, and not have
Stefan Behnel stefan...@behnel.de wrote in message
news:mailman.470.1283712666.29448.python-l...@python.org...
BartC, 05.09.2010 19:09:
All those compilers that offer loop unrolling are therefore wasting
their time...
Sometimes they do, yes.
Modifying the OP's code a little:
a = 0
for i
Stefan Behnel stefan...@behnel.de wrote in message
news:mailman.485.1283772019.29448.python-l...@python.org...
BartC, 06.09.2010 12:38:
(2) Integer arithmetic seems to go straight from 32-bits to long
integers; why not use 64-bits before needing long integers?
You are making assumptions
Steven D'Aprano steve-remove-t...@cybersource.com.au wrote in message
news:4c85adfe$0$5$c3e8...@news.astraweb.com...
On Mon, 06 Sep 2010 11:38:22 +0100, BartC wrote:
Manually unrolling such a loop four times (ie. 4 copies of the body, and
counting only to 25 million) increased the speed
David Cournapeau courn...@gmail.com wrote in message
news:mailman.546.1283897932.29448.python-l...@python.org...
On Sun, Sep 5, 2010 at 8:28 PM, BartC ba...@freeuk.com wrote:
One order of magnitude (say 10-20x slower) wouldn't be so bad. That's
what
you might expect for a dynamically typed
Steven D'Aprano st...@remove-this-cybersource.com.au wrote in message
news:4c878be5$0$3$c3e8...@news.astraweb.com...
On Tue, 07 Sep 2010 11:00:03 +0100, BartC wrote:
for i in xrange(1):
a = a + f(i)
With Python 3 and def f(x): return x+1, unrolling this loop 4x improved
speed
Stefan Behnel stefan...@behnel.de wrote in message
news:mailman.563.1283921317.29448.python-l...@python.org...
BartC, 08.09.2010 03:45:
Getting back to the OP's code again (trivial and pointless as it might
seem), I got these results:
C (gcc 3.4.5 -O3) 0.8 secs
C (DMC-o) 2.3 secs
C (lccwin32
that there is a more meaningful symantics.
Simply put, a sequence multiplied by -1 can give a reversed sequence.
Then for any sequence seq, and integer n0, we can have
seq * -n producing (seq * -1) * n.
Any thoughts?
Gimmicky.
Best to define multiplication only by unsigned or positive values.
--
Bartc
the standard units are radians, and mm. Every other calculation uses
implied units.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
hard to find a language that has no compiler generating
faster code than C...
But those implementers have to try very hard to beat C. Meanwhile C can be
plenty fast without doing anything special.
When Intel will realize that 99% of its users are running VM
Which one?
--
Bartc
--
http
firstdigit=n//(10**(digits-1))
if firstdigit!=lastdigit: return False
if digits==2: return True
middledigits=n//10-firstdigit*(10**(digits-2))
return fpalindrome(middledigits)
print fpalindrome(12345678987654321)
--
Bartc
--
http://mail.python.org/mailman/listinfo/python
Pascal J. Bourguignon p...@informatimago.com wrote in message
news:87zkuyjawh@kuiper.lan.informatimago.com...
BartC b...@freeuk.com writes:
Pascal J. Bourguignon p...@informatimago.com wrote in message
When Intel will realize that 99% of its users are running VM
Which one?
Any
seconds, for my own
interpreted, dynamic language, and 0.6 seconds for C.)
--
bartc
--
http://mail.python.org/mailman/listinfo/python-list
Pascal J. Bourguignon p...@informatimago.com wrote in message
news:877hi1iq2o@kuiper.lan.informatimago.com...
BartC b...@freeuk.com writes:
(defun fib (n)
(if ( n 2)
n
(+ n (fib (- n 1)) (fib (- n 2)) )
))
But it gave the wrong results and it took ages to figure out why
using if-else chains, so
this is no longer a compact construction useful in an expression.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote in message
news:i8j0dg$lh...@lust.ihug.co.nz...
In message i8i1h8$dc...@news.eternal-september.org, BartC wrote:
x = (One,Two,Three) [i-1]
While this works for i = 1,2,3, it goes funny for i=0,-1,-2, and
generates
an error
On Thu, 07 Oct 2010 01:36:33 +0100, BartC wrote:
However, as I mentioned, one problem here is having to evaluate all the
items in the list before selecting one:
...
x = {1 : fna(), 2 : fnb(), 3 : fnc()}.get(i, None Of The Above)
Mel mwil...@the-wire.com wrote in message
news:i8j56e$ub
.
2 - If I declare a class with some member variables, is is strictly
necessary
This is where I bail out...
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
:
x = (One,Two,Three)[i-1] if 1=i=3 else Other
NevilleDNZ neville...@gmail.com wrote:
BartC b...@freeuk.com wrote:
Probably there are workarounds here too, but I suspect the syntax won't
be
quite as pert as the Algol68-style example:
x = (i | Zero, One, Two | None of the above) # 0-based
that if angles are just numbers.
The definition of a radian is length/length (or m/m) which simplifies to
dimensionless.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
RG rnospa...@flownet.com wrote in message
news:rnospamon-20651e.17410012102...@news.albasani.net...
In article i92dvd$ad...@news.eternal-september.org,
BartC b...@freeuk.com wrote:
Thomas A. Russ t...@sevak.isi.edu wrote in message
But radians are dimensionless.
But they are still units
RG rnospa...@flownet.com wrote in message
news:rnospamon-ee76e8.18291912102...@news.albasani.net...
In article i930ek$uv...@news.eternal-september.org,
BartC b...@freeuk.com wrote:
RG rnospa...@flownet.com wrote in message
Likewise, all of the following are the same number written
the largest c you will
need by computing the square root of a*a+b*b.
If square roots have to be used, you might as well use the two-loop
algorithm, as you're nearly there.
A simpler estimate for the largest c is just a+b, although it might involve
a few extra iterations.
--
Bartc
--
http
was so low
that cluttering up CPython with a JIT system and LLVM probably is
a lose.
LLVM. Ok, that explains a lot. (LLVM is a huge, complex system).
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
oscilloscope wasn't directly useful for the
complex non-repeating signals you get with computer boards.
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
have unintended side-effects.
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wlfr...@ix.netcom.com wrote in message
news:mailman.15097.1414022143.18130.python-l...@python.org...
On Wed, 22 Oct 2014 19:08:40 +0100, BartC b...@freeuk.com declaimed the
following:
Comparing:
x = cond ? f() : g(); # C version
with
x = [f(), g()] [cond]
(Should
available, and they re-invent C!
https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/client/samples/spirodraw/Spirodraw.dart
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list
[4]
list: [a,1,2]
When I do it like this: list=array[0]+ array[3]+ array[4] I get an error:
TypeError: unsupported operand type(s) for +: 'numpy.ndarray' and
'numpy.ndarray'
You're calculating a+1+2. Probably a isn't something that can be added to
1+2.
--
Bartc
--
http://mail.python.org
complex calculation performed in floating point, which then has to be
converted to ... BTW how *do* you represent a raise of 10% exactly if
not with binary floating point?
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
algorithm is not great, as it
makes an interesting new benchmark.)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 29/03/2015 13:01, BartC wrote:
On 29/03/2015 11:35, Steven D'Aprano wrote:
Anyway, we don't really know where the confusion lies. Perhaps the
description is misleading, or I'm just confused, or Bart's idea of brute
force is not the same as my idea of brute force, or perhaps he really
uses a byte-code dispatch loop, and it is still dynamically typed.
So what extra stuff is going on in CPython?)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
and post it. (Most of it seems to be preoccupied with multiple ways of
indexing the board or grid.)
(If it's of any interest, this non-Python code is here:
http://pastebin.com/5cXd2Pef )
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 29/03/2015 04:06, Steven D'Aprano wrote:
On Sun, 29 Mar 2015 10:50 am, BartC wrote:
But using X *and* my own brute-force algorithm, the same puzzle took 2
seconds to solve - faster than C!
But, when you tell me that your very own personal interpreted language,
which I assume nobody else
On 29/03/2015 00:12, Chris Angelico wrote:
On Sun, Mar 29, 2015 at 10:50 AM, BartC b...@freeuk.com wrote:
Using the OP's algorithm, and testing with the 'hard' puzzle posted by Ian
Kelly, I got these approximate results:
Python 3.1: 1700 seconds (normal Python interpreter)
PyPy
On 28/03/2015 09:53, Steven D'Aprano wrote:
On Sat, 28 Mar 2015 10:08 am, BartC wrote:
An alternate syntax might be:
hello = .string()
That should have been .strip()
loop_node =. next
Why propose that?
Every other augmented assignment has the operator on the left hand side
On 29/03/2015 19:03, Marko Rauhamaa wrote:
BartC b...@freeuk.com:
As Chris mentioned, when I say 'faster than C', I mean X running my
algorithm was faster then C running Marko's algoritim (on Ian's data).
This was just an illustration of algorithm being more important than
language
On 29/03/2015 22:19, Mark Lawrence wrote:
On 29/03/2015 21:59, BartC wrote:
On 29/03/2015 00:12, Chris Angelico wrote:
On Sun, Mar 29, 2015 at 10:50 AM, BartC b...@freeuk.com wrote:
Using the OP's algorithm, and testing with the 'hard' puzzle posted
by Ian
Kelly, I got these approximate
On 29/03/2015 22:21, Mark Lawrence wrote:
On 28/03/2015 23:50, BartC wrote:
On 28/03/2015 03:39, Sayth wrote:
Good test for pypy to see where it's speed sits between C and Python.
Python 3.1: 1700 seconds (normal Python interpreter)
PyPy: 93 seconds
C unoptimised: 17
1 - 100 of 1111 matches
Mail list logo