> transcript
>
> a 0.0680 s, a 1.2040 s, a 9.5823 s, a 81.9688 s,
My times are very nearly linear:
a 0.0280 s, a 0.2931 s, a 2.9006 s, a 29.4318 s,
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
assumes some other code has decided which items
to handle; it becomes correspondingly simpler.
--
\ “Two possibilities exist: Either we are alone in the Universe |
`\ or we are not. Both are equally terrifying.” —Arthur C. Clarke, |
_o__)
; print('that is not a number, try again')
> else:
> numbers.append(chip)
>
> print(sum(numbers))
Why would you not keep a running total, rather than list of the numbers?
I've not been following assiduously, so maybe I missed some other
requirement...
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
Bart writes:
> On 07/02/2019 20:45, Ben Bacarisse wrote:
>> Ian Clark writes:
>>
>>> This is my whack at it, I can't wait to hear about it being the wrong big o
>>> notation!
>>>
>>> numbers=[]
>>>
>>> while len(numbers)
Grant Edwards writes:
> On 2019-02-07, Ben Bacarisse wrote:
>> Ian Clark writes:
>>
>>> This is my whack at it, I can't wait to hear about it being the wrong big o
>>> notation!
>>>
>>> numbers=[]
>>>
>>> while len
eve that they own culture, they are so |
_o__) self-righteous about it …” —Nina Paley, 2011 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
to information. They are the tool of choice for the internet |
_o__) highwayman.” —Anthony Taylor |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
quot; + x + " y = "+ y)
f(x)
print("x = " + x)
The material I cut did include the explanation so go back and read the
message you replied to here if you don't follow.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
n't know what it |
`\is. Every once in a while I'll be listening to the radio and I |
_o__)say, ‘I think I might have written that.’” —Steven Wright |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
t
containers, and thinking of them that way will frequently lead you to
the wrong conclusion.
https://nedbatchelder.com/text/names1.html>
--
\ “Theology is the effort to explain the unknowable in terms of |
`\ the not worth knowing.” —Henry L. Mencken |
_o__)
e you tried using that library and timing the result?
--
\ “You don't need a book of any description to help you have some |
`\kind of moral awareness.” —Dr. Francesca Stavrakoloulou, bible |
_o__) scholar, 2011-05-08 |
Ben Finney
--
http
purpose::
with foo.open() as logfile:
frobnicate_the_whelk(logfile=logfile)
--
\ “I don't want to live peacefully with difficult realities, and |
`\ I see no virtue in savoring excuses for avoiding a search for |
_o__) real answers.” —Pau
is to the |
_o__) culinary arts.” —Michael Bacarella |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ovenance of the key that made the signature.
--
\“Human reason is snatching everything to itself, leaving |
`\ nothing for faith.” —Bernard of Clairvaux, 1090–1153 CE |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ne by children. |
`\ They had all the paintings up on refrigerators.” —Steven Wright |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
sier when the RefrigeratedShippingContainer encapsulates
the conversions of temperature units.
--
\ “When we pray to God we must be seeking nothing — nothing.” |
`\—Francis of Assisi |
_o__)
Arup Rakshit writes:
Michael Torrie writes:
> On 03/18/2019 05:55 PM, Ben Finney wrote:
> >> If I call `_c_to_f`, `_f_to_c` methods on `self` instead of
> >> `RefrigeratedShippingContainer` class object, still it works.
> >
> > That's right, and is inde
ex tasks we expect of a programmer's editor like
Vim or GNU Emacs.
--
\“The reason we come up with new versions is not to fix bugs. |
`\ It's absolutely not.” —Bill Gates, 1995-10-23 |
_o__)
is not ignorance but the illusion of |
_o__)knowledge.” —Daniel J. Boorstin, historian, 1914–2004 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
`\ approaches zero. All non-Free software is a dead end.” —Mark |
_o__) Pilgrim, 2006 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ssed before?
Too many times to count :-)
--
\ “Theology is the effort to explain the unknowable in terms of |
`\ the not worth knowing.” —Henry L. Mencken |
_o__) |
Ben Finney
--
https://mail.p
x27;s going to change depending on
the environment).
--
\ “Courage is not the absence of fear, but the decision that |
`\ something else is more important than fear.” —Ambrose Redmoon |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
wants changes what he wants.
Ben
--
Ben Coleman olo...@benshome.net | For the wise man, doing right trumps
http://oloryn.benshome.net/ | looking right. For the fool, looking
Amateur Radio NJ8J | right trumps doing right.
signature.asc
Description: OpenPGP digita
s
what to do with duplicates. The question should be worded so that it's
either clear what is wanted, or so that it is clear that you should
decide what to do.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> Ben Bacarisse writes:
>>Ranjith Bantu writes:
>>>can I solve any problems like this by learning python?
>>You need to learn how to solve problems as well as learning Python --
>
> I do not separate "solv
r?
> PS Since I am going through the list fully the only optimisation I can
> think of a generator to feed it seems sort of redundant. Unless of
> course it was a list of 10,000 numbers then maybe its useful.
I'm not sure what was meant here. I can think of one micro-optimisation
but I'd want to test to see if really makes and difference.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
d, of course, be loads of /other/ things
that would be potential "gotcha"s.)
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
you need to know at least one actual age, rather
than just the age gaps. Maybe the exercise is to write a function that
takes the age of, say, the youngest child and then calculates the
inheritances?
Anyway, your starting point will be to work through an example on paper
so you are clear abo
uot;:
> print("Integer")
>
> Why isn't this working? Advance thanks for your time.
See if this helps...
>>> type(5)
>>> type(type(5))
>>> type("")
so you are comparing two things with different types. An analogous
situation w
imity |
`\of the graveyard.” —Justice Roberts in 319 U.S. 624 (1943) |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
;s no music, no |
`\ choreography, and the dancers hit each other.” —Jack Handey |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ry limited way, fudge it like this:
def myrepr(e):
if isinstance(e, types.BuiltinFunctionType):
return e.__name__
return repr(e)
The trouble is that print does not always mean print because that
identifier can be rebound. Python could try to provide some /other/
name for every object, one that can't be rebound (something like an
environment + string lookup) but it's probably not worth it.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
do you need to also have them bound to separate names; what problem
are you trying to solve that you think this will help?
--
\ “If [a technology company] has confidence in their future |
`\ ability to innovate, the importance they place on protecting |
_o__) their pas
'Banana Split']
The above code produces this output, without any need for binding new
names. So what is it you are actually trying to achieve, and why do you
think the new bindings are necessary?
--
\“The number of UNIX installations has grown to 10, with more |
`\ expected.” —Unix Programmer's Manual, 2nd Ed., 1972-06-12 |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
, 'b', 'c', 'd']
>
> But my question is: Is there any good reason why the split function
> should give an "empty separator" error? I think the meaning of trying
> to split a string into a list using the empty string as a delimiter is
> unambi
Danilo Coccia writes:
> Il 18/07/2019 12:27, Ben Bacarisse ha scritto:
>> Irv Kalb writes:
>>
>>> I have always thought that split and join are opposite functions. For
>>> example, you can use a comma as a delimiter:
>>>
>>>>>> m
is duplicated in IDL?
If the second one were not there, this:
JMP: IF WK(L-1,K-1) EQ 0 THEN BEGIN
L=L+1
GOTO, JMP
ENDIF
would just be a while loop:
while WK[L-1,K-1] == 0:
L=L+1
By the way, all those -1s suggest that the IDL was itself a translation
from a language with 1-based array indexing. All that might be able to
be tidied up.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
OC SQL;', '')]
Your main issue is that | binds weakly. Your whole pattern tries to
match any one of just four short sub-patterns:
PROC SQL;
proc sql;(.*?)RUN;
quit;
QUIT;
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
A S writes:
> On Thursday, 12 December 2019 02:28:09 UTC+8, Ben Bacarisse wrote:
>> A S writes:
>>
>> > I would like to extract all words within specific keywords in a .txt
>> > file. For the keywords, there is a starting keyword of "PROC SQL;" (I
J.Staaf - ¡Móchate! _PromoMix_.wav
?
^
What am I missing when it comes to unquoting the string, or should I do some
other fancy operation on the drive string?
Cheers,
Ben
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, 21 December 2019 21:46:43 UTC, Ben Hearn wrote:
> Hello all,
>
> I am having a bit of trouble with a string mismatch operation in my tool I am
> writing.
>
> I am comparing a database collection or url quoted paths to the paths on the
> users drive.
&g
moi writes:
>>>> 'ÿ'.encode('utf-8')
> b'\xc3\xbf'
>>>> 'ÿ'.encode('utf-16-le')
> b'\xff\x00'
>>>> 'ÿ'.encode('utf-32-le')
> b'\xff\x00\x00\x00'
That all lo
moi writes:
> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a écrit :
>> moi writes:
>>
>> >>>> 'ÿ'.encode('utf-8')
>> > b'\xc3\xbf'
>> >>>> 'ÿ'.encode('utf-16-le')
>> >
moi writes:
> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a écrit :
>> moi writes:
>>
>> >>>> 'ÿ'.encode('utf-8')
>> > b'\xc3\xbf'
>> >>>> 'ÿ'.encode('utf-16-le')
>> >
moi writes:
> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a ÄCcrit :
>> moi writes:
>>
>> >>>> 'Ä¿'.encode('utf-8')
>> > b'\xc3\xbf'
>> >>>> 'Ä¿'.encode('utf-16-le')
>&g
uage will
> start to work properly.
>>> "ÿ".encode('iso-8859-1')
b'\xff'
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
-- Forwarded message -
From: Ben Hansen
Date: Sat, May 23, 2020 at 11:44 AM
Subject: Fwd: installed but doesn't boot
To:
-- Forwarded message -
From: Ben Hansen
Date: Fri, May 22, 2020 at 3:18 PM
Subject: installed but doesn't boot
To:
I have
;t know your intent is far as defaults go.)
> The documentation says that an absolute path in the parameter list for
> join will discard all previous parameters but '\\' is not an absoute
> path!
I think it is. The picture is messy on Windows (because of the drive
letter) but
.
If c:\x\y is a file, calling it c:\x\y\ won't change that, but it might
give you an error when you try to access it. That may be what you want.
If so, appending '.' is likely to be more portable.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
BlindAnagram writes:
> On 27/05/2020 13:30, Ben Bacarisse wrote:
>> BlindAnagram writes:
>>
>>> The issue that I raised here was whether the behaviour of os.path.join()
>>> in treating the Windows directory separator '\\' as an absolute path
>>
BlindAnagram writes:
> On 27/05/2020 16:53, Ben Bacarisse wrote:
>> As it should. Relying on a trailing \ having the right effect is
>> brittle to say the least.
>
> In my case less brittle than leaving it out.
Brittle does not mean broken. I know you can fix it by mak
Roel Schroeven writes:
> Ben Bacarisse schreef op 27/05/2020 om 17:53:
>> There is well-known (*nix) software that relies on a/b/c/ meaning
>> something different to a/b/c but I don't know anyone who thinks this is
>> a good idea. It causes no end of confusion.
>
&
t(add)
>
> output: 9
Hint:
reduce(f, [e1, e2]) is f(e1, e2)
reduce(f, [e1, e2, e3]) is f(f(e1, e2), e3)
reduce(f, [e1, e2, e3, e4]) is f(f(f(e1, e2), e3), e4)
Replace f with a function that adds one to its first argument. Does
that help?
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
gt;
> transcript
>
> 0
> 1
> 2
def f(i = [0]):
i[0] += 1
return i[0]
print(f())
print(f())
print(f())
maybe? More than a bit yucky, though.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
u could even make
a single pattern like this:
(?=.*t.*t)(?=.*a)
While there are probably better ways in Python, this is what I'd do on
the command line. For example
$ grep -P '(?=.*t.*t)(?=.*a)' word-list | wc -l
45677
$ grep 't.*t' word-list | grep a | wc -l
45677
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
se:
to give the return address for an individual reply to the message
author.
--
\ "What I resent is that the range of your vision should be the |
`\ limit of my action." -- Henry James |
_o__)
the background image and blit that to the screen at the start of
every frame you draw.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
le who really do want that behaviour, working around the warning
should involve minimal extra code, with extra clarity thrown in for
free.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
grammer will have to take these considerations
on board when writing their code, whether we want to use them or not.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
Roedy Green <[EMAIL PROTECTED]> writes:
> End users HATE PDF. Why?
>
> It takes so long for the reader to load.
xpdf comes up almost instantly here. Maybe end users should
consider finding a better PDF reader.
--
"Your correction is 100% correct and 0% helpful. Well done!"
--Richard Heathfield
if you need to
represent bidirectional connections. Then you can perform search on
that as required. The only slight complication is avoiding infinite
loops - I might use a dictionary of address->boolean values here and
check off each address as the algorithm progresses.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
it's possible to do this with just 1 symbolic
link somewhere.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
t would be a good idea." -- Mahatma Gandhi (when |
`\asked what he thought of Western civilization) |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
being
unplugged, or a timeout along the way, etc. 5% is a high figure, but
perhaps you connect to hosts that are unreliable for some reason.
You don't have control over this really; just make sure you handle the
exception. Such is life, when dealing with networking.
--
Ben Sizer
--
htt
e original poster seemed to be a client (using
connect_ex) rather than a server, so I think this would only be an
issue if the code was connecting to the same host repeatedly in quick
succession.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
n the main
thread. You could perhaps use an Event object here, which has the
time-out functionality for you.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
here's little Python can do about it. ;)
Which part of the code issues the overflow error? I'm guessing it's the
draw.point() call since that's the only bit I can't test.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
way to do this? I don't like the idea of
looping through 100+ sprites and test them each an arbitary number of
times every update. Is this just something unavoidable which should be
written in C for speed and included with SWIG or something similar?
Ben
(Anti-Zealotry ward)
:0:
* ^Subject:.*Re
em with Python and its libraries, sadly.
The same almost certainly goes for most open source projects.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
x." -- Gore Vidal |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Ben Finney <[EMAIL PROTECTED]> wrote:
> If I want to implement a __repr__ that's reasonably "nice" to the
> programmer, what's the Right Way? Are there recipes I should look
> at?
As a (carefully selected) example from the code I'm writing:
;>> t2 += 12345678910
>>> # Note, both t1 and t2 have been incremented by the same amount.
>>> print t1-t2
0.0389995574951
It appears Yu-Xi Lim beat me to the punch. Using decimal as opposed to
float sorts out this error as floats are not built to handle the size of
number used here.
Ben
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, October 31, 2005 10:23, Sybren Stuvel said:
> Ben O'Steen enlightened us with:
>> Using decimal as opposed to float sorts out this error as floats are
>> not built to handle the size of number used here.
>
> They can handle the size just fine. What they can't
fixed for the next version.
--
Ben Sizer.
--
http://mail.python.org/mailman/listinfo/python-list
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> In <[EMAIL PROTECTED]>, Ben Finney wrote:
>
> > class Human_Sex(str):
> > def __repr__(self):
> > repr_str = "%s(name=%s)" % (
> >
Erik Max Francis <[EMAIL PROTECTED]> wrote:
> Ben Finney wrote:
> > If I want to implement a __repr__ that's reasonably "nice" to the
> > programmer, what's the Right Way? Are there recipes I should look
> > at?
>
> I tend to use:
>
>
ot possibly suit
everybody? You can append "body { font-family: sans-serif; font-size:
10pt; }" to the CSS and make it look 'professional' but it doesn't make
it more readable. Really this just comes down to preconceptions over
how a site 'should' look based on ot
Björn Lindström wrote:
> Actually it does set some fonts ("avantgarde" and
> "lucidasomethignorother") as first choices. I guess you, like me, and
> probably most people in here, doesn't have those installed.
As far as I can tell, those fonts are only set for
ing in life is so exhilarating as to be shot at without |
`\result." -- Winston Churchill |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
e way to do what I'm describing? Am I missing a
common programming pattern?
--
\ "I bought a self learning record to learn Spanish. I turned it |
`\on and went to sleep; the record got stuck. The next day I |
_o__)could only stutter in Spanish." -- Steven Wright |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> the problem is the '..' operator in perl. Is there any equivalent in
> python?
I can't think of anything with a similar operation, to be honest. I'd
try using while loops which look out for the next section delimiter.
--
Ben Sizer.
--
http
rators on an array of bytes:
>
> Actually, no, it's to xor all the bits together and store them in a single
> boolean.
I'd use 'or' rather than 'xor'. The or operator is more likely to yield
a '1' at the end of it, and a 1 is narrower than a 0, o
ot of refactoring later, but in Python this is rarely a
difficult task.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
. Are my assumptions
> correct, or am I falling prey to FUD?
Python is a good language for rapid development and hence testing. So
you could probably create a quick mock-up of your system and then write
some scripts to place it under heavy stress to see how well it holds
up.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
e many reasons that make webservices the way
> of the future (hey, even *MSFT* noticed that recently, it seems...).
But they are not suitable for all applications, and probably never will
be.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
se who dare not, are slaves." -- "Lord" George |
_o__) Gordon Noel Byron |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
gs/viewpost.jsp?thread=92662>
--
\ "The shortest distance between two points is under |
`\ construction." -- Noelie Alito |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
value of nothing." -- Oscar Wilde |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
t;I know the guy who writes all those bumper stickers. He hates |
`\ New York." -- Steven Wright |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
other enemas..." -- Emo Philips |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
heard, even legal fees.
I think that's a poor example - the cost hasn't come from the mere act
of adding protection, but the method in which that protection operates.
I don't think anybody here - certainly not me - is talking about
infecting a user's system to protect our
e, as Alex pointed out, all of these are just keeping honest
> people honest. The crooks have all the advantages in this game, so you
> really can't expect to win.
No, certainly not. But if you can mitigate your losses easily enough -
without infringing upon anyone else's rights, I must add - then why not
do so.
--
Ben Sizer.
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith <[EMAIL PROTECTED]> wrote:
> Ben Finney <[EMAIL PROTECTED]> wrote:
> > Test cases should each run individually, from a known state, and
> > not depend on any other tests. You can define a fixture for
> > several tests in the unittest.TestCase metho
|
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
states could be represented
in the enumeration, and individual states compared to see if they are
"later" that each other. If sequence was not considered important, of
course, this feature would not get in the way.
--
\ "I put instant coffee in a microwave oven and almost went
When I click the button of cancel,
I got the follwoing message. I want to see "Goodbye" on the console screen.What to do?
Traceback (most recent call last): File "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript exec codeObject in __main__.__dict
Is there any pure python ocde there thoguh it is slow?
Not many people know C very well and it will be great to have some python code even for education use.
Ben
I know someone once mentioned that they tried writing one of theDelaunay triangulation algorithms in pure Python and abandoned it
is there any code to decide whether a point is located within the circle by three other points?Thanks!B. Bush
--
http://mail.python.org/mailman/listinfo/python-list
On 11/12/05, Robert Kern <[EMAIL PROTECTED]> wrote:
Ben Bush wrote:> is there any code to decide whether a point is located within the circle> by three other points?
# Converted from my C++ code.# C.f. http://www.ics.uci.edu/~eppstein/junkyard/circumcenter.htmldef circumc
Steven Wright |
`\ |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
1101 - 1200 of 5101 matches
Mail list logo