On Wednesday 20 July 2016 16:45, Lawrence D’Oliveiro wrote:
> I was trying something like
>
> ctx.dashes = ((0.1, 0.03, 0.03, 0.03), 0)
>
> and wondering why it wasn’t working...
And so are we. Since you've already solved the problem, maybe you could
enlighten us?
T
bjects without declaring
them, or the duck-typing of booleans.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 20 Jul 2016 05:09 pm, Antoon Pardon wrote:
> Op 20-07-16 om 07:42 schreef Steven D'Aprano:
>> Floating point maths is hard, thinking carefully about what you are doing
>> and whether it is appropriate to use == or a fuzzy almost-equal
>> comparison, or if equali
return list(x)
return x
def enumerate_down(it):
seq = sequencefy(it)
n = len(seq) - 1
for item in reversed(seq):
yield (n, item)
n -= 1
for i, item = enumerate_down(x):
...
An advantage of this is that it works well with lazy sequences like
(x)range. T
than everyone else.
Poor quality answer:
"Probably not a good idea to mix that with read/write properties..."
Better:
"Probably not a good idea to mix that with read/write properties, for the
following reasons: [succinct explanation of the reasons why one should
avoid mixing ordi
French and cabbage-eating Huns for
kicking you out of the EU against your will.
England Prevails!
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
On Thursday 21 July 2016 15:28, Rustom Mody wrote:
> On Wednesday, July 20, 2016 at 11:13:05 AM UTC+5:30, Steven D'Aprano wrote:
>> On Tuesday 19 July 2016 14:58, Rustom Mody wrote:
>>
>> > So I again ask: You say «"Never compare floats for equality" is a
On Thursday 21 July 2016 16:28, Rayne wrote:
> Thanks! One more question: Does "pip install" require Internet to work?
Yes, you must have internet access.
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 21 Jul 2016 11:14 pm, Rustom Mody wrote:
> On Thursday, July 21, 2016 at 12:04:35 PM UTC+5:30, Steven D'Aprano wrote:
>> On Thursday 21 July 2016 15:28, Rustom Mody wrote:
>> > BTW APL whose main domain of application is scientific chooses to
>> > enshrine
ithub.com/) and share
> the link.
Are you going to read "thousands of lines" of unfamiliar code trying to work
out what changes need to be made to fix an underspecified problem?
Yeah, sure you are. Have fun.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheere
s true
...
else:
# do the thing you want to do when blnDesiredInd is not true
...
You have to replace the dots ... with actual code, of course, but we can't
help you with that. It's *your* project, not ours, we have no idea what you
want to happen.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
mode:
open("foo", "rb")
open("foo", "wb")
> If it's true, then why can't it do that
> automatic encoding when I trying to write a 'str' to socket ?
Probably because nobody has requested that functionality before.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
replace that line with:
>
> if stock is None or type(stock) != dict:
Generally speaking, the right way to test whether something is an instance
of a type is to use the isinstance() function:
if stock is None or not isinstance(stock, dict): ...
That will work correctly even if stock belong
Obviously the "if" block is empty. But for consistency, and simplicity, the
interpreter requires a pass there too. One less thing to be programmed, one
less thing for the user to remember. Just require pass any time you have an
empty block, rather than try to remember where it is requi
x in sequence:
> print("Something")
> end
> print("Something else")
>
> (And no speculation at all if 'end' was mandatory. Python already
> provides 'else' (and 'except'?) which can do a similar job in some
> circumstances.)
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, 24 Jul 2016 04:18 am, gst wrote:
> Heuh case 2 :
>
> "String1" or "String2"
>
> Evaluates to "String1" ?
Correct. What did you expect?
Have you read the Fine Manual?
https://docs.python.org/3/reference/expressions.html#boolean-operations
g and inserting "pass" in their code.
> But thinking about it some more, it wouldn't work. All the blocks that
> don't now use 'end' would look odd. I think it would either have to be
> all or nothing. I guess nothing.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
r -tt to raise errors.
(5) Or for that matter any version of Python going all the way
back to Python 1.5, if not older. There has been no excuse for
getting bitten by mixed tabs/spaces since at least 1998.
(6) Or upgrade to Python 3, which will automatically enforce the
rule about not mixing t
LON EMD END
" QUOTE We invited the strippers, COMMA JFK COMMA and Stalin. END " QUOTE
END END
-- DASH DASH SPACE END END
Steven END END
“ QUOTE Cheer up, COMMA ” END they said, COMMA “ QUOTE things could be
worse. END ” QUOTE So I cheered up, COMMA and sure enough, COMMA things got
worse. END END
--
https://mail.python.org/mailman/listinfo/python-list
.
> Or if you prefer things of a more ‘practical’ (so-called_ nature:
>
http://www.testingexcellence.com/reasons-automated-tests-fail-to-find-regression-bugs/
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
Python for .Net:
https://github.com/pythonnet/pythonnet
http://pythonnet.github.io/
https://pypi.python.org/pypi/pythonnet
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
On Monday 25 July 2016 13:46, Rustom Mody wrote:
> The bald fact that tests are finite and the actual search space for cases for
> anything remotely non-trivial is infinite is undeniable.
I deny it :-P
"Infinity" is pretty big. It's *really* big. It's bigger than most people
think. You might th
ssue27619
What decided it for me was that the shell getopt on my system ignores
leading and trailing spaces.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
nt call last):
File "", line 2, in
ZeroDivisionError: division by zero
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
ptions as well, such as distributing
it bundled into a zip file. What benefit do you get from using PyInstaller?
> but the thing is, I don’t know what smaller I could import
> with these set of modules. Is there a program that could tell me this.
> Sorry if this question is really basic,
On Wednesday 27 July 2016 13:45, Cai Gengyang wrote:
> How to debug this error message ?
Start by reading the message:
invalid literal for int() with base 10: ''
Now try to experiment at the interactive interpreter:
int('45') # works
int('xyz') # ValueError: invalid literal for int() with ba
On Wednesday 27 July 2016 14:52, Thomas 'PointedEars' Lahn wrote:
> Carter Temm wrote:
>
>> I’m writing a couple different projects at the moment, and when I compile
>> it into a single executable using pyinstaller, it becomes extremely large.
>> I’m guessing this is because of the modules used.
On Thursday 28 July 2016 12:39, Larry Martell wrote:
> I have an object of type Target:
>
> (Pdb) type(target)
>
>
> And I pickle it like this:
>
> (Pdb) type(pickle.dumps(target))
>
>
> And then it looks like this:
>
> (Pdb) pickle.dumps(target)
>
"ccopy_reg\n_reconstructor\np0\n(cworkite
Perl 5.24 is now 100% forwards compatible with Perl 6.
The Perl community is agreed that Perl 6 is, in fact, a completely different
language than Perl 5. Unlike Python 3 which differs only in a few minor (but
important) ways from Python 2, Perl 6 is a significant break from the past,
enough to
Split them over separate posts!
Responses, with changes of subject line, will follow.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
s(arg)
rather than:
def function_of_one_argument(x):
return function_of_two_arguments(arg, x)
If it happens to be faster than the alternative, that's a bonus.
I don't know whether or not it saves time when invoking async exec. Have you
tried it to see?
--
Steven
“Cheer up,
uot;all the time", "fairly often") replace except blocks
with `pass`. I call shenanigans -- perhaps you do it *occasionally*, but as
a general rule, you can rarely replace the exception handler with a
do-nothing clause and expect your code to work:
try:
block
except SomeExceptio
would be a
lot smaller: for example, suppose the decimal place was fixed after three
digits. The largest number would be 999.999 and the smallest
would be 0.0000001.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
On Fri, 29 Jul 2016 11:55 pm, Antoon Pardon wrote:
> Op 29-07-16 om 15:43 schreef Steven D'Aprano:
>> Of course it won't, which is why I don't believe all these folks who
>> claim that they regularly ("all the time", "fairly often") replac
as one time in 100 lines, it is still
not an onerous requirement.
You should see how many times Ruby programmers have to write "end", 99.9% of
which are unneeded but forced on them by the language.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 30 Jul 2016 04:32 am, Antoon Pardon wrote:
> Op 29-07-16 om 16:38 schreef Steven D'Aprano:
>> On Fri, 29 Jul 2016 11:55 pm, Antoon Pardon wrote:
>>
>>> Op 29-07-16 om 15:43 schreef Steven D'Aprano:
>>>> Of course it won't, which is why
89
# twelve thousand, three hundred and forty-five, point six seven eight nine
-1.75 # minus one point seven five
0.0 # zero
3.0 # three
1.23e45 # one point two three times ten to the power of forty-five
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enou
uivalent to the critical
loop:
for value in sequence:
# critical loop
print("Offset %d foo bar" % (self._offset))
...
with no test, unless you pass -O as a command-line option to Python, in
which case both the test and the call to print will be completely removed:
ftwo number: # special syntax
> That's apart from the obligatory indents which, with an 'end'-delimited
> scheme, are not always necessary.
Of course they're necessary. The participants of the old "indent style wars"
of the 80s and 90s didn't agree on much,
on must have a "add 10" statement, and forbid the
plus operator, so that poor quality code like the above will be a syntax
error?
# new and improved special syntax
addten x as y
print never should have been a statement. Being a built-in function is
special enough.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
ng.)
One function is simpler than two, so print() with explicit keyword arguments
is obviously simpler AND more powerful.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
re_me: None, range(10)))
But the idea that somebody might call print(i), and put up with its HIGHLY
VISIBLE side-effects, just for the return result of None, instead of just
writing None, is too implausible to take seriously. If I saw such code, I'd
immediately submit it to The Daily WTF.
-
myself wishing I could write Hypertalk code repeat loops (not since
1998 or thereabouts) in Python, since they don't "feel" right for the
language: at best, it would be like suddenly dropping into Lolcat in the
middle of an ordinary English sentence. Good for a giggle, but that's
On Sun, 31 Jul 2016 12:16 am, BartC wrote:
> On 30/07/2016 14:06, Steven D'Aprano wrote:
>
>> End of story. As far as I am concerned, the 97% of languages which allow
>> the visual structure of the code to differ from their logical structure
>> are BAD LANGUAGES.
On Sat, 30 Jul 2016 11:06 pm, Steven D'Aprano wrote:
> If it a sign of a poor programmer that
> ignores the common idioms of a language and writes in another
> language's "grammar".
/face-palm
"If it a sign..."
Of course that was not intentional.
On Sun, 31 Jul 2016 12:47 am, Steven D'Aprano wrote:
> On Sat, 30 Jul 2016 09:39 pm, Rustom Mody wrote:
[...]
>> - Prior Art: Its builtin and special in Fortran, Pascal, Basic
>
> Possibly Fortran. But which version of Fortran? Do we really want to take
> decisions mad
roglang.html
Not a very useful discussion. His argument basically boils down to:
"Lisp came up with some good ideas that were copied by other languages.
Therefore Lisp is a good teaching language."
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
en
On Sun, 31 Jul 2016 04:46 am, BartC wrote:
> On 30/07/2016 16:48, Steven D'Aprano wrote:
>> On Sat, 30 Jul 2016 11:58 pm, BartC wrote:
>>
>>> The 'i' is superfluous. Why not:
>>>
>>> for 10:
>>
>> Why bother? What'
On Sun, 31 Jul 2016 04:16 am, Michael Torrie wrote:
> On 07/30/2016 11:53 AM, Steven D'Aprano wrote:
>> On Sun, 31 Jul 2016 02:29 am, Rustom Mody wrote:
>>
>>> MIT on practical reasons for python over scheme:
>>>
>>
https://www.wisdomandwonder.com/link
inners make the mistake of writing:
mylist = mylist.sort()
or try to write:
mylist.sort().reverse()
If we had procedures, that would be an obvious error (possibly even a
compile-time syntax error) instead of a perplexing source of mystery bugs.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, 31 Jul 2016 02:01 pm, D'Arcy J.M. Cain wrote:
> On Sun, 31 Jul 2016 13:32:16 +1000
> Steven D'Aprano wrote:
>> Many beginners make the mistake of writing:
>>
>> mylist = mylist.sort()
>>
>> or try to write:
>>
>> mylist.sort
On Sun, 31 Jul 2016 08:18 pm, BartC wrote:
> On 31/07/2016 03:10, Steven D'Aprano wrote:
>> On Sun, 31 Jul 2016 04:46 am, BartC wrote:
>
>>> No named loop variable to invent, create, maintain, and destroy. No
>>> range object to create, destroy etc. If you
On Sun, 31 Jul 2016 05:39 pm, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>> It has always perplexed me that Lisp's prefix notation is held up as
>> the /sine qua non/ of elegance and power, while Forth is ignored if not
>> ridiculed.
>
> The reason Lisp
ven't are
indistinguishable from the thousands who harvest email addresses from
websites, address books, or just randomly generate addresses hoping they'll
be delivered.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail
ought.
None of this even *remotely* supports your assertions such as "[Turing]
wishes to put the soul into the machine". Maybe he did. But this essay
gives no reason to think so, or any reason to think that Turing's personal
beliefs about souls is the slightest bit relevant to computer science.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailman/listinfo/python-list
On Monday 01 August 2016 18:05, [email protected] wrote:
> You think that my nearly 30 years' experience of designing interpreted
> languages and writing fast bytecode interpreters doesn't make my opinions
> have any more merit, that's fine.
If you are the only one who has ever seen or used the
On Tuesday 02 August 2016 13:14, Michael Torrie wrote:
> On 08/01/2016 01:13 AM, Michael Selik wrote:
>> You might benefit from watching the talk "Stop Writing Classes"
>> https://www.youtube.com/watch?v=o9pEzgHorH0
>
> Great talk! Thanks for posting that.
It is a great talk, but for a counter-
On Tue, 2 Aug 2016 07:14 pm, Arshpreet Singh wrote:
> is there any approach I can go with so auto_order_buy() auto_order_sell()
> function only executed once?
Take them out of the while loop.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things go
On Wed, 3 Aug 2016 01:12 am, Robin Becker wrote:
> A reportlab user found he was doing the wrong thing by calling canvas.save
> repeatedly, our documentation says you should not use Canvas objects after
> the save method has been used. The user had mixed results :(
>
> It would be better to make
On Tue, 2 Aug 2016 11:28 pm, Rustom Mody wrote:
>> I think the real reason is not willing to admit that the language lacks
>> something that could actually be useful, and especially not to an
>> upstart on usenet who is not even an expert in that language.
>
> And earlier you said:
>
>> But dedi
On Wed, 3 Aug 2016 02:56 am, BartC wrote:
> (And I expect that next they will eliminate languages altogether. All
> you need is some way of specifying a sequence of calls to library
> functions and sprinkling around some control statements;
That would be called "a language".
> it could be
> dr
On Wed, 3 Aug 2016 03:12 am, BartC wrote:
> That's not a fundamental language feature. Repeat-N is. And if properly
> designed, isn't an extra feature at all but a special case of a generic
> loop.
Which means it is NOT a fundamental language feature.
"Repeat N without tracking the loop variable
On Wednesday 03 August 2016 05:14, BartC wrote:
> It's fundamental in that, when giving instructions or commands in
> English, it frequently comes up when you want something done a set
> number of times:
>
> "Give me 20 push-ups"
At which point the person will invariable drop to the ground and s
On Wednesday 03 August 2016 05:22, Paul Rubin wrote:
>> The Halting Problem is easily solved for Bloop languages: they always
>> halt.
>
> If Bloop is powerful enough to "solve the halting problem" as you
> describe, that gives it capabilities that Turing-complete languages
> lack. (Of course it
Is there a good guide to getting started with type-checking Python code?
Specifically as an aid to porting from Python 2 to 3.
There are the PEPs, of course. Anything else?
Apart from mypy, what type checkers are available?
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered
On Wed, 3 Aug 2016 08:16 pm, BartC wrote:
> On 03/08/2016 06:43, Steven D'Aprano wrote:
>
>> Not everything that is done is worth the cognitive burden of memorising a
>> special case.
>
>
>> In some ways, Python is a more minimalist language than you like
On Thursday 04 August 2016 19:13, BartC wrote:
> On 04/08/2016 04:23, Steven D'Aprano wrote:
>> On Wed, 3 Aug 2016 08:16 pm, BartC wrote:
>
>>> So the idea that remembering 'repeat N' is a cognitive burden, and the
>>> myriad string operations for e
On Fri, 5 Aug 2016 01:31 am, GBANE FETIGUE wrote:
> try:
> parsed_response = json.loads(response)
> deployid = parsed_response[u'id']
> print "Your deployid is: " + deployid
> except:
> print 'Seems the named id already exists!'
I'm not going to try to debug your code blindfolded wit
On Fri, 5 Aug 2016 08:41 am, [email protected] wrote:
> I hereby ask that only people who know and use Python reply, not the
> theoretical idiots who could not fight their way out of a wet paper bag.
So it's only people who are theoretically idiots that are prohibited from
replying? Actual,
Log in to Activestate:
https://code.activestate.com/recipes/langs/python/new/
and click "Add a Recipe". I get
Forbidden
You don't have permission to access /recipes/add/ on this server.
Apache Server at code.activestate.com Port 443
Broken for everyone, or just for me?
--
Steve
“Cheer
On Sat, 6 Aug 2016 08:00 am, Marco Sulla wrote:
> I have a simple curiosity: why Python has much keywords, and some
> builtin types and methods, that are different from the other
> languages? What is the rationale?
You should ask those other languages. Which languages do you have in mind?
> I'
On Sat, 6 Aug 2016 08:31 am, Chris Angelico wrote:
> On Sat, Aug 6, 2016 at 8:00 AM, Marco Sulla via Python-list
> wrote:
[...]
>> I'm referring to:
>> * `except` instead of `catch`
>
> Not sure. Python does seem to be roughly unique in this.
Delphi does uses the same terminology. Standard Pasc
On Sat, 6 Aug 2016 10:13 am, Chris Angelico wrote:
> On Sat, Aug 6, 2016 at 9:21 AM, Marco Sulla
> wrote:
>> I want to clarify that when I say "different from the other
>> languages", I mean "different from the most used languages", that in
>> my mind are C/C++, C#, Java, PHP and Javascript, main
On Sun, 7 Aug 2016 04:33 am, Terry Reedy wrote:
> On 8/6/2016 2:30 AM, Michael Selik wrote:
>
>> When people ask me why the core classes are lowercased,
>
> Int, float, list, dict, etc were once functions that return objects of
> type 'int', 'float', 'list', 'dict', etc, before they became 'new-
On Sun, 7 Aug 2016 07:33 am, Michael Torrie wrote:
> On 08/05/2016 07:14 PM, Steven D'Aprano wrote:
>> In English, we refer to ourselves in the first person as I, me, myself,
>> and sometimes "self", never as "this". One can say "this one has a ha
On Sun, 7 Aug 2016 03:16 am, Dave wrote:
> I am trying to associate the .py file extension with idle...where IS
> idle? Can you make it a bit more difficult to load/use your software
> please.
We certainly could, but we're not going to make it more difficult just to
suit you. You can make it
On Sun, 7 Aug 2016 08:05 am, Lawrence D’Oliveiro wrote:
> On Saturday, August 6, 2016 at 12:08:30 PM UTC+12, [email protected]
> wrote:
>> A couple or three years old but this is well worth seeing for anybody,
>> regardless of your Python expertise.
>> http://nedbatchelder.com/text/iter.html
>
>
On Sun, 7 Aug 2016 01:31 pm, Steven D'Aprano wrote:
> If there is a shortcut on the desktop, right click on the desktop and use
> that to locate IDLE.
Sorry, I meant right-click on the SHORTCUT.
> Or use Start Menu > Find File (or whatever Windows calls it) to find IDLE.
>
Seen in the office IRC channel:
(13:23:07) fred: near_limit = []
(13:23:07) fred: near_limit.append(1)
(13:23:07) fred: near_limit = len(near_limit)
(13:23:09) fred: WTF
Speaks for itself.
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 8 Aug 2016 08:03 am, Tim Delaney wrote:
> On 7 August 2016 at 16:54, Steven D'Aprano <
> [email protected]> wrote:
>
>> Seen in the office IRC channel:
>>
>>
>> (13:23:07) fred: near_limit = []
>> (13:23:07)
On Mon, 8 Aug 2016 09:19 am, Rick Johnson wrote:
> On Saturday, August 6, 2016 at 10:43:01 PM UTC-5, Steven D'Aprano wrote:
>
>> Yes. The two ways of ending the loop are distinct and different:
>>
>> - reach the end, and stop;
>> - bail out early.
>>
&
I have cloned the Python source repo, and build CPython, as described here:
https://docs.python.org/devguide/
Now a little bit later, I want to update the repo, so I run:
hg fetch
to get and apply any changes. How do I know if I need to rebuild Python? I
don't want to have to rebuild after eve
On Mon, 8 Aug 2016 04:37 am, Panayiotis Mangafas wrote:
> So i've downloaded python on a new laptop(Windows) and apparently i
> downloaded it in a wrong folder and now when i try to install a library i
> cant. I have tried both pip install and install setup.py but i cant make
> it work. It doesn't
On Mon, 8 Aug 2016 10:20 pm, [email protected] wrote:
> Hello guys! I was answering a question on a piece of homework of mine.
> Sadly I can't answer it correctly due to the repetitive error being "Make
> sure you removed all debugging print statements." Hopefully one of you
> guys can help
On Tuesday 09 August 2016 13:59, Chris Angelico wrote:
> On Tue, Aug 9, 2016 at 1:46 PM, Rick Johnson
> wrote:
>> On Sunday, August 7, 2016 at 1:54:51 AM UTC-5, Steven D'Aprano wrote:
>>> Seen in the office IRC channel:
>>>
>>>
>>> (13
On Tuesday 09 August 2016 15:37, Chris Angelico wrote:
[...]
>> You can't be too careful with memory management.
>
> Right. Of course, it gets very onerous, so we tend to use a context
> manager instead.
>
> def process(self, stuff):
> with deallocate() as cleanup:
> clea
On Tuesday 09 August 2016 11:52, Charles Ross wrote:
> I’ve begun a new book called Meta Python that I’m looking for assistance
> with.
Are you looking for people to be co-authors? Are you offering payment, or
credit? A free copy of the book? A kick to the head? Or just looking for
volunteers t
On Tue, 9 Aug 2016 08:56 pm, [email protected] wrote:
> Hello.
>
> My python script should run on Linux, Win and MacOS, but I can't find a
> way to have logging.conf configuration that works out of the box accross
> all these OSes.
Oh! Wait, I didn't pick up on the logging.conf part! D'oh!
> [ha
On Tue, 9 Aug 2016 08:56 pm, [email protected] wrote:
> Hello.
>
> My python script should run on Linux, Win and MacOS, but I can't find a
> way to have logging.conf configuration that works out of the box accross
> all these OSes.
>
> I don't want my users to have to edit configuration files man
Can I please have step by step instructions that have been verified to work
with Windows 10 and Python 3.7.7 that list all requirements, dependencies and
processes to install and run pip and then install libraries such as numpy and
pillow.
Any help would be greatly appreciated.
Regards,
Steven
Reinhold Birkenfeld wrote:
>
> This is Open Source. If you want an initiative, start one.
+1 QOTW.
STeVe
--
http://mail.python.org/mailman/listinfo/python-list
nything. That made sense back in
the distant past when users used dumb terminals and they had perhaps half
a dozen dot files. But at the point your home directory has three times as
many dot files as regular files, the time has come to stop doing things
just because that's the way they have al
guess:
L = [(score, name) for (name, score) in scores.items()]
L.sort()
L.reverse()
# L is now sorted from highest down to lowest by score.
best_guess = L[0]
second_best_guess = L[0]
if best_guess[0] > 10*second_best_guess[0]:
fp.close(
Erik Wilsher wrote:
> And I think the discussion that followed proved your point perfectly
> Fredrik. Big discussion over fairly minor things, but no "big
> picture". Where are the initiatives on the "big stuff" (common
> documentation format, improved build system, improved web modules,
> rew
C)
py> inst
<__main__.C instance at 0xf6d2d6cc>
py> inst.truffles(3)
<__main__.C instance at 0xf6d2d6cc> 3
No surprises there. But look what happens when we use a new instance:
py> x = C()
py> x
<__main__.C instance at 0xf6d2ca6c>
>>> x.truffles(3)
<__main__.C instance at 0xf6d2d6cc> 3
Hope this is useful to some folks.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 25 Sep 2005 14:52:56 +, Ron Adam wrote:
> Steven D'Aprano wrote:
>
>
>> Or you could put the method in the class and have all instances recognise
>> it:
>>
>> py> C.eggs = new.instancemethod(eggs, None, C)
>> py> C().eggs(3)
Uri Nix wrote:
> Using the following snippet:
> p =
> subprocess.Popen(nmake,stderr=subprocess.PIPE,stdout=subprocess.PIPE, \
>universal_newlines=True, bufsize=1)
> os.sys.stdout.writelines(p.stdout)
> os.sys.stdout.writelines(p.stderr)
> Works fine on the command li
Steven D'Aprano wrote:
> py> class Klass:
> ... pass
> ...
> py> def eggs(self, x):
> ... print "eggs * %s" % x
> ...
> py> inst = Klass() # Create a class instance.
> py> inst.eggs = eggs # Dynamically add a function/method.
&g
immer of light... are you using
a single string, something like "this is a list of arguments"? The
function is expecting a list of strings ["this", "is", "a", "list", "of",
"arguments"].
You may find the split() method useful for breaking up a single string
into a list of strings.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 27 Sep 2005 20:28:53 +, Claudio Grondi wrote:
> what about:
>>>> lst = [digit for digit in '06897']
>>>> lst
> ['0', '6', '8', '9', '7']
No need to use a list comprehension when th
3701 - 3800 of 15563 matches
Mail list logo