))
print (len(x[0]))
print (len(x[0][0]))
Gives output of 4, 3, 2 rather than 2, 3, 4.
Which means that x[0][0][3] is a bounds error.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 25/05/2018 17:11, Alexandre Brault wrote:
On 2018-05-25 11:40 AM, bartc wrote:
On 25/05/2018 16:27, Chris Angelico wrote:
You're way WAY too late to debate the matrix multiplication operator.
/The/ matrix multiplication operator?
In which language? And what was wrong with &quo
On 25/05/2018 16:40, Steven D'Aprano wrote:
On Fri, 25 May 2018 22:46:37 +1000, Chris Angelico wrote:
We've already had a suggestion for [[]]@5 and that should deal with that
issue. Steven is proposing "multiply by copying" as an alternative to
"multiply by referencing", so an alternative multi
On 25/05/2018 16:27, Chris Angelico wrote:
On Fri, May 25, 2018 at 10:58 PM, bartc wrote:
I'm in general not in favour of piling in special symbols into a language
just to solve some obscure or rare problem.
As I went on to demonstrate, function-like syntax (or even actual functions)
cou
On 25/05/2018 13:46, Chris Angelico wrote:
On Fri, May 25, 2018 at 10:36 PM, bartc wrote:
On 24/05/2018 19:17, Steven D'Aprano wrote:
But what do people think about proposing a new list replication with copy
operator?
[[]]**5
would return a new list consisting of five shallow c
On 25/05/2018 13:36, bartc wrote:
Of course you have to implement dupllist(), but you'd have to implement
** too, and that is harder. For this specific example, it can just be:
def dupllist(x,n):
return [x[0].copy() for _ in range(n)]
On 25/05/2018 03:25, Steven D'Aprano wr
plement
** too, and that is harder. For this specific example, it can just be:
def dupllist(x,n):
return [x[0].copy() for _ in range(n)]
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 25/05/2018 11:08, asa32s...@gmail.com wrote:
On Thursday, May 24, 2018 at 10:12:46 PM UTC-4, asa3...@gmail.com wrote:
here is the code, i keep getting an error, "break outside loop". if it is false
just exit function
def d(idx):
if type(idx) != int:
break
d('k')
thanks...
).
As for a better proposal, I'm inclined not to make it part of the
language at all, but to make it an editor feature: insert a block of
arbitrary text, and give a command to turn it into a string literal.
With perhaps another command to take a string literal within a program
and view it
On 24/05/2018 03:37, Terry Reedy wrote:
On 5/23/2018 8:46 PM, bartc wrote:
On 24/05/2018 00:44, Terry Reedy wrote:
On 5/23/2018 5:56 PM, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know
On 24/05/2018 01:46, bartc wrote:
On 24/05/2018 00:44, Terry Reedy wrote:
On 5/23/2018 5:56 PM, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1,
Use -1, which is the
ot the last value itself which would be 'i'.
And actually, the subject line seems to confirm that.
In that case, using a '-1' index won't work.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 23/05/2018 22:51, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a
function that gives me last number of index
Not for that trivial task. But you can create your own:
def upb(x): return len(x)-1 # '
ssion comprises,
then you will run into problems. Try adding two tuples:
1, 2, 3 + 4, 5, 6
This in fact gives you 1,2,7,5,6 rather than 5,7,9. (I don't know if
tuples can actually be added like this, but the point is clear.)
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 23/05/2018 14:11, Steven D'Aprano wrote:
On Wed, 23 May 2018 11:10:33 +0100, bartc wrote:
(x,) Tuple of one item
Incorrect. Yet again, you have failed to do enough testing. No special
form is required. Only a comma:
py> x = 1,
py> type(x)
It isn't enough to test exampl
lenty), none of
them are tied to anything to do with tuples. Actually 'tuple' doesn't
appear at all.
'dict' does, presumably because a dict-constructor is different
syntactically in requiring key:value pairs.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 23/05/2018 07:47, Steven D'Aprano wrote:
On Tue, 22 May 2018 18:51:30 +0100, bartc wrote:
On 22/05/2018 15:25, Chris Angelico wrote:
[...]
The tuple has nothing to do with the parentheses, except for the
special case of the empty tuple. It's the comma.
No? Take these:
a =
ight either. Asterisk is just an overloaded
token but you will what it's for as soon as it's encountered.
Comma seems to be used only as a separator.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 22/05/2018 15:25, Chris Angelico wrote:
On Tue, May 22, 2018 at 8:25 PM, bartc wrote:
Note that Python tuples don't always need a start symbol:
a = 10,20,30
assigns a tuple to a.
The tuple has nothing to do with the parentheses, except for the
special case of the empty tuple.
On 22/05/2018 03:49, Mikhail V wrote:
On Mon, May 21, 2018 at 3:48 PM, bartc wrote:
But I have to say it looks pretty terrible, and I can't see that it buys
much over normal syntax.
# t
# t
11 22 33
Is this example complete? Presumably it means ((11,22,33),).
Yo
is:
data = {
but you need:
date = \
///
Or do you also allow: date = /// with data following on the next line?
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
to print boarding passes via PDF; I doubt airlines wanted to alienate
Linux users).
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 20/05/2018 16:37, Dennis Lee Bieber wrote:
On Sun, 20 May 2018 12:38:59 +0100, bartc declaimed the
Just for giggles, I decided to write the start of a PPM reader (it only
handles P6 binary, doesn't have the code for the other styles, and doesn't
incorporate PPM writer
On 20/05/2018 10:19, Peter J. Holzer wrote:
On 2018-05-19 13:43:14 +0100, bartc wrote:
Text files, yes. Not 'text mode' which is something inflicted on us by the C
library.
I very much enjoy the fact that the programming languages I've used to
process text files in the las
On 20/05/2018 02:58, Dennis Lee Bieber wrote:
On Sun, 20 May 2018 02:13:01 +0100, bartc declaimed the
following:
I think if you are going to be generating ppm, then the best choice of
format, for the widest acceptance, is to separate the header groups with
a newline. (As I mentioned my
On 20/05/2018 01:39, Dennis Lee Bieber wrote:
On Sat, 19 May 2018 23:14:08 +0100, bartc declaimed the
following:
The comments and examples here:
https://en.wikipedia.org/wiki/Netpbm_format, and all actual ppm files
I've come across, suggest the 3 parts of the header (2 parts for P1/P4
On 19/05/2018 20:47, Dennis Lee Bieber wrote:
On Sat, 19 May 2018 13:28:41 +0100, bartc declaimed the
following:
Out of interest, how would Python handle the headers for binary file
formats P4, P5, P6? I'd have a go but I don't want to waste half the day
trying to get past th
On 19/05/2018 12:33, Peter J. Holzer wrote:
On 2018-05-19 11:33:26 +0100, bartc wrote:
Not you understand why some of us don't bother with 'text mode' files.
"Not" or "Now"?
Now.
Yesterday you claimed that you worked with them for 40 years.
Text f
On 19/05/2018 12:38, Chris Angelico wrote:
On Sat, May 19, 2018 at 8:33 PM, bartc wrote:
But then you are acknowledging the file is, in fact, ASCII.
Cool! So what happens if you acknowledge that a file is ASCII, and
then it starts with a byte value of E3 ?
It depends.
If this is a .ppm
On 19/05/2018 02:26, Chris Angelico wrote:
On Sat, May 19, 2018 at 11:10 AM, bartc wrote:
The .ppm (really .pbm) file which was the subject of this sub-thread has its
header defined using ASCII. I don't think an EBCDIC 'P4' etc will work.
"Defined using ASCII" i
typo.)
The .ppm (really .pbm) file which was the subject of this sub-thread has
its header defined using ASCII. I don't think an EBCDIC 'P4' etc will work.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 19/05/2018 01:42, Dennis Lee Bieber wrote:
On Fri, 18 May 2018 22:53:06 +0100, bartc declaimed the
following:
I've worked with text files for 40 years. Now Python is telling me I've
been doing it wrong all that time!
Look at the original code I posted from which this Python
On 19/05/2018 01:00, Chris Angelico wrote:
On Sat, May 19, 2018 at 7:53 AM, bartc wrote:
I've worked with text files for 40 years. Now Python is telling me I've been
doing it wrong all that time!
Look at the original code I posted from which this Python was based. That
creates a fil
On 18/05/2018 19:57, Chris Angelico wrote:
On Sat, May 19, 2018 at 4:48 AM, bartc wrote:
The translation was straightforward, EXCEPT that I wasted an hour trying to
figure out to write /a single byte/ to a file. The following eventually
worked, using a binary file as a text one had Unicode
On 18/05/2018 20:15, Alexandre Brault wrote:
On 2018-05-18 02:48 PM, bartc wrote:
Note this version doesn't use any imports at all.
Except your version doesn't read its parameter from the command line
args and doesn't output to standard output, which all of the others do.
On 18/05/2018 19:36, Chris Angelico wrote:
On Sat, May 19, 2018 at 3:27 AM, bartc wrote:
Once again, you're confusing *porting* with *emulating*.
This is the point. Those libraries are specific to Python and cannot be
ported.
And very often they don't just provide general su
On 18/05/2018 18:27, bartc wrote:
(BTW here's a port of that benchmark based on the Lua code:
https://pastebin.com/raw/ivDaKudX
And here's the payoff: I was able to use this version to port it to
Python. One which works better the the originals, as they wrote output
to
On 18/05/2018 15:47, Chris Angelico wrote:
On Sat, May 19, 2018 at 12:37 AM, bartc wrote:
Have a look at some of the implementations here (to test some Mandelbrot
benchmark):
https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/mandelbrot.html
The three Python examples all
On 18/05/2018 13:29, Steven D'Aprano wrote:
On Fri, 18 May 2018 12:09:02 +0100, bartc wrote:
On 18/05/2018 02:45, Steven D'Aprano wrote:
On Fri, 18 May 2018 02:17:39 +0100, bartc wrote:
Normally you'd use the source code as a start point. In the case of
Python, that means Pyt
On 17/05/2018 23:49, Chris Angelico wrote:
On Fri, May 18, 2018 at 8:44 AM, Paul wrote:
I've been using email for thirty years, including thousands of group emails
at many tech companies, and no one has ever suggested, let alone insisted
on, bottom posting. If someone's late to a thread they
On 18/05/2018 02:45, Steven D'Aprano wrote:
On Fri, 18 May 2018 02:17:39 +0100, bartc wrote:
Normally you'd use the source code as a start point. In the case of
Python, that means Python source code. But you will quickly run into
problems because you will often see 'import lib
On 17/05/2018 18:19, Steven D'Aprano wrote:
On Thu, 17 May 2018 15:50:17 +0100, bartc wrote:
Of course, full-on Python code is pretty much impossible to port
anywhere else anyway.
*rolls eyes*
Any pair of languages will have code that is hard to port from one to the
other without ju
On 17/05/2018 15:03, Chris Angelico wrote:
On Thu, May 17, 2018 at 9:58 PM, bartc wrote:
On 17/05/2018 04:54, Steven D'Aprano wrote:
On Thu, 17 May 2018 05:33:38 +0400, Abdur-Rahmaan Janhangeer wrote:
what does := proposes to do?
A simple example (not necessarily a GOOD example,
On 17/05/2018 14:32, Steven D'Aprano wrote:
On Thu, 17 May 2018 12:58:43 +0100, bartc wrote:
On 17/05/2018 04:54, Steven D'Aprano wrote:
On Thu, 17 May 2018 05:33:38 +0400, Abdur-Rahmaan Janhangeer wrote:
what does := proposes to do?
A simple example (not necessarily a GOOD ex
because it assumes left-to-right evaluation
order of the arguments. Even if Python guarantees that, it might be a
problem if the code is ever ported anywhere else.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 16/05/2018 16:09, Ian Kelly wrote:
On Tue, May 15, 2018, 6:36 PM bartc wrote:
On 16/05/2018 01:04, Steven D'Aprano wrote:
I'm not a C coder, but I think that specific example would be immune to
the bug we are discussing, since (I think) you can't chain assignments i
can
augmented assignments (+= and so on).
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
nyway, as it would be
an error in Python) because usually both = and == are plausible in an
expression.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 12/05/2018 05:29, Steven D'Aprano wrote:
On Fri, 11 May 2018 16:56:09 +0100, bartc wrote:
0100, if not intended as octal, is
an undetectable error in C and Python 2.
How fortunate then that Python 2 is history (soon to be ancient history)
and people can use Python 3 where that err
On 11/05/2018 14:24, Chris Angelico wrote:
On Fri, May 11, 2018 at 9:09 PM, bartc wrote:
when 101'11010'000'B then ...
Try /that/ in hex /or/ octal.)
I've no idea what this is supposed to mean, or why you have groups of
three, five, and three. Looks like a pos
On 10/05/2018 21:18, bartc wrote:
On 10/05/2018 19:51, Chris Angelico wrote:
On Fri, May 11, 2018 at 4:31 AM, bartc wrote:
2x100 (4) Binary
3x100 (9) Ternary
4x100 (16) Quaternary
5x100 (25) etc
6x100 (36)
7x100 (49)
8x100 (64) Octal
9x100 (81
On 11/05/2018 01:11, Chris Angelico wrote:
On Fri, May 11, 2018 at 8:43 AM, bartc wrote:
This is Wrong, and would have been just as obviously wrong in 1989.
Having spent many years programming in C and working on Unix, I
strongly disagree.
Using C is apt to give you a rather warped view of
of
three bits, or were divided up on 3-bit boundaries.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
miles
31424 miles
2629 miles
This is Wrong, and would have been just as obviously wrong in 1989.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 10/05/2018 19:51, Chris Angelico wrote:
On Fri, May 11, 2018 at 4:31 AM, bartc wrote:
2x100 (4) Binary
3x100 (9) Ternary
4x100 (16) Quaternary
5x100 (25) etc
6x100 (36)
7x100 (49)
8x100 (64) Octal
9x100 (81)
... (Not implemented 11x to 15x
On 10/05/2018 18:03, Ian Kelly wrote:
On Thu, May 10, 2018 at 10:36 AM, bartc wrote:
What, 0O100 instead of 0100? Yeah that's a big improvement...
Fortunately octal doesn't get used much.
The PEP discusses this:
"""
Proposed syntaxes included things like arbitrar
syntax that doesn't need to be
backwards compatible.
That changed in Python 3. If you slim
the start of PEP 3127, you'll learn the new notation.
What, 0O100 instead of 0100? Yeah that's a big improvement...
Fortunately octal doesn't get used much.
--
Bartc
--
https://mai
On 10/05/2018 09:09, Marko Rauhamaa wrote:
bartc :
On 09/05/2018 06:44, Steven D'Aprano wrote:
But by the time 1.4 came around, Guido had settled on a clean separation
between statements and expressions as part of Python's design.
That separation has gradually weakened over
't however allow augmented assignments in expressions, as it's not
that useful, and it would be too much (and I could never get the
precedences right). But normal assignment is handy.)
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
n't help.)
Is an empty movimientos allowed at this point or not? Is auxb==0 a legal
index here or not?
(Tip: I used these lines in the input loop to simply testing rather than
having to type them in (as 2 and 2) each time:
fila = 1
columna = 1
)
--
bartc
--
https://mail.python.
riendly to say the least for a HELP file of all things
to just flatly not work like without a word of explanation (or even This
file is blocked; do you want to unblock it?)
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
le ))
{ printf( "found at %d\n", offset -( int )strlen( needle )); }}
for( int i = l; i; --i )o[ i ]= o[ i - 1 ];
o[ 0 ]= 0;
goto next;
out: fclose( haystack ); }
end: ; }
Did you say that you teach programming?
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
executable program or a batch file.
The process failed to start (invalid command?). (1 =
I do not know what to do ... Thanks in advance
Try clicking the Start button and typing python.exe into the search box.
(Unless this is Windows 10, then try right-clicking Start and choose
Search.)
ime and to dates. (10-day
weeks? I don't think so.)
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
Or one that is all zeros but
with a sparse smattering of non-zeros?
If not very, then just check the bytes one by one. If non-zero, you will
know as soon as you see the first non-zero byte, possibly the first one.
def allzeros(a):
for x in a:
if x: return 0
return 1
--
3G/4G).
But a temporary WiFi link (eg. a free one at McDonald's) can be useful
to download extra free apps then they can be used off-line.
Of source it might not be very popular without access to social media if
that's the main purpose of the device.
--
bartc
--
https://mail.python.or
C',
'a':'A', 't':'T'}, then the loop might look like this:
D = {}
for c in S:
D[c] = c.upper()
print (D)
Output:
{'c': 'C', 'a': 'A', 't': 'T'}
But, how to fill in the valu
On 27/03/2018 04:49, Richard Damon wrote:
On 3/26/18 8:46 AM, bartc wrote:
Hence my testing with CPython 3.6, rather than on something like PyPy
which can give results that are meaningless. Because, for example,
real code doesn't repeatedly execute the same pointless fragment
millio
On 26/03/2018 16:31, Chris Angelico wrote:
On Mon, Mar 26, 2018 at 11:46 PM, bartc wrote:
On 26/03/2018 13:30, Richard Damon wrote:
On 3/26/18 6:31 AM, bartc wrote:
The purpose was to establish how such int("...") conversions compare in
overheads with actual arithmetic with the
On 26/03/2018 13:30, Richard Damon wrote:
On 3/26/18 6:31 AM, bartc wrote:
The purpose was to establish how such int("...") conversions compare
in overheads with actual arithmetic with the resulting numbers.
Of course if this was done in C with a version that had builtin bignum
On 26/03/2018 03:35, Richard Damon wrote:
On 3/25/18 9:37 PM, bartc wrote:
So the overhead /can/ be substantial, and /can/ be significant
compared with doing bignum calculations.
Of course, once initialised, C might be used a hundred times, then the
overhead is less significant. But it is
On 26/03/2018 10:34, Steven D'Aprano wrote:
On Mon, 26 Mar 2018 02:37:44 +0100, bartc wrote:
If I instead initialise C using 'C = int("288712...")', then timings
increase as follows:
Given that the original number given had 397 digits and has a bit length
of 1
On 26/03/2018 00:27, Richard Damon wrote:
On 3/25/18 8:32 AM, bartc wrote:
Using CPython on my machine, doing a string to int conversion that
specific number took 200 times as long as doing a normal assignment.
That conversion took 4 microseconds.
Not significant if it's only done
On 25/03/2018 16:47, Grant Edwards wrote:
On 2018-03-25, bartc wrote:
On 25/03/2018 02:47, Steven D'Aprano wrote:
The Original Poster (OP) is concerned about saving, what, a tenth of a
microsecond in total? Hardly seems worth the effort, especially if you're
going to end up with
also do the conversion when the line is never executed!)
Even if you write
C =
288714823805077121267142959713039399197760945927972270092651602419743230379915273311632898314463922594197780311092934965557841894944174093380561511397421542416933972905423711002751042080134966731755152859226962916775325475058561019494042000399044321167766199496295392504526987193290703735640322737012784538991261203092448414947289768854060249767681220770716879381217098113222
On 25/03/2018 15:01, Christian Gollwitzer wrote:
Am 25.03.18 um 14:32 schrieb bartc:
Using CPython on my machine, doing a string to int conversion that
specific number took 200 times as long as doing a normal assignment.
That conversion took 4 microseconds.
Not significant if it's only
a normal assignment.
That conversion took 4 microseconds.
Not significant if it's only done once. But it might be executed a
million times.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
x27;ve often wondered what the guys who invented C (around 1970) must have
been smoking to have come up with some of those ideas.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 10/03/2018 20:06, Ben Bacarisse wrote:
bartc writes:
[repost as original seems to have gone to email; my newsreader has
somehow acquired a 'Reply' button where 'Followup' normally goes.]
[I thought it was intended but my reply bounced.]
On 10/03/2018 14:23, Ben B
+) l1 l2 makes a list by pair-wise appending the elements of
l1 and l2.
What's the output? (And what's the input; how do you invoke pn, if
that's how it's done?)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
mber in the triple is the
Plane number, then plane 1 looks like:
1,1,1 1,2,1 1,3,1
2,1,1 2,2,1 2,3,1
3,1,1 3,2,1 3,3,1 ...
...
But whether that has an equivalent traversal path like the diagonals of
the 2-D, I don't know. I'm just guessing.)
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
ialog that
appears then, type cmd and the console window should appear.
With Windows 10 all the useful apps that are now hard to find are listed
by right-clicking the Start button.
The console one is called Command Prompt.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
ssages when running on CPython 2.7 and 3.6, with
the code run from a .py file. (I never use interactive mode.)
But not when running on a PyPy version of 2.7 (however that is not CPython).
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
ns that when you did want to discard an expensive
resource, then X going out of scope, calling del X or whatever, will not
work if a copy of X still exists somewhere.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
m code resides there.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
FromString("__builtins__");
if (builtin_object == NULL)
return 0;
return 1;
}
)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 27/02/2018 02:27, Chris Angelico wrote:
On Tue, Feb 27, 2018 at 12:57 PM, bartc wrote:
On 27/02/2018 00:35, Chris Angelico wrote:
Anyway, even this pure Python version can deliver pseudo random numbers at
some 200,000 per second, while the built-in generator does 450,000 per
second, so
second, so it's not bad going.
Of course, the C version will generate them at over 100 million per second.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 26/02/2018 20:27, bartc wrote:
On 26/02/2018 19:50, Chris Angelico wrote:
On Tue, Feb 27, 2018 at 6:37 AM, Rick Johnson
So what? Latency is latency. And whether it occurs over the
course of one heavily recursive algorithm that constitutes
the depth and breadth of an entire program (a la
ffect PyPy, which ran at the same
speed with i64(), without it, or with both i64() and i64a().)
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 26/02/2018 17:05, Ben Bacarisse wrote:
bartc writes:
A C version is given below. (One I may have messed around with, which
I'm not sure works properly. For an original, google for Marsaglia and
KISS64 or SUPRKISS64.)
The version I know uses unsigned integers. Did you change th
On 26/02/2018 15:09, Chris Angelico wrote:
On Tue, Feb 27, 2018 at 2:02 AM, bartc wrote:
On 26/02/2018 14:04, bartc wrote:
On 26/02/2018 13:42, Ned Batchelder wrote:
Well, once you notice that the
Python code had N=1e5, and the C code had N=1e9 :) If you want to
experiment, with N
On 26/02/2018 14:04, bartc wrote:
On 26/02/2018 13:42, Ned Batchelder wrote:
Well, once you notice that the
Python code had N=1e5, and the C code had N=1e9 :) If you want to
experiment, with N=1e5, the final number should be 5255210926702073855.
OK, I'll try that.
I have that P
x27;hot paths' within a Python program, but
optimises hot paths in the special Python interpreter. One written in
[R]Python. Or something...
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 26/02/2018 13:42, Ned Batchelder wrote:
On 2/26/18 7:13 AM, bartc wrote:
A C version is given below. (One I may have messed around with, which
I'm not sure works properly. For an original, google for Marsaglia and
KISS64 or SUPRKISS64.)
Most integers are unsigned, which have
army of people working on
acceleration projects and tracing JIT compilers. To those people
however, such a benchmark can be a useful yardstick of progress.)
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 26/02/2018 11:40, Chris Angelico wrote:
On Mon, Feb 26, 2018 at 10:13 PM, bartc wrote:
Below is the first draft of a Python port of a program to do with random
numbers. (Ported from my language, which in turned ported it from a C
program by George Marsaglia, the random number guy.)
However
;>17)
xs ^= (xs<<43)
x = s+xcng+xs
print ("Does x= 4013566000157423768")
print (" x=",x)
start()
--
(The code performs N iterations of a random number generator. You get
the result expected, ie. x=401...768, when N is a billion.)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
On 24/02/2018 02:05, Steven D'Aprano wrote:
On Fri, 23 Feb 2018 19:25:35 +0000, bartc wrote:
Python is 10 times slower than a competitor = doesn't matter
My language is 1.5 times slower than the big boys' = matters
a great deal
As for Python's order-of-magnitude speed d
guage. If it doesn't, it
won't.
Benchmarks need to be honest. But Fibonacci I think can't use that
optimisation (although gcc seems to have found another way of not that
much work).
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list
1 - 100 of 1116 matches
Mail list logo