mplexity for just four sub-
tasks, but worth keeping in mind.
--
Steven
299792.458 km/s — not just a good idea, it’s the law!
--
https://mail.python.org/mailman/listinfo/python-list
exit status to another value, but only for exceptions
handled by my_error_handler?
--
Steven
299792.458 km/s — not just a good idea, it’s the law!
--
https://mail.python.org/mailman/listinfo/python-list
eviation between
measurements. But who wants to do that by hand?
--
Steven
299792.458 km/s — not just a good idea, it’s the law!
--
https://mail.python.org/mailman/listinfo/python-list
raceNum==4: #this line has an error for some reason
This is the line where the error is reported. The error is actually on the
previous line. Do you see it now?
--
Steven
299792.458 km/s — not just a good idea, it’s the law!
--
https://mail.python.org/mailman/listinfo/python-list
i've played around with .ecode('latin-1') or ('utf8') but i was not yet
able to sove this simple issue.
Tanks in advance,
Truppe Steven
--
https://mail.python.org/mailman/listinfo/python-list
I've made a pastebin with a few examples: http://pastebin.com/QQQFhkRg
On 2016-11-22 21:33, Steven Truppe wrote:
I all,
i'm using linux and python 2 and want to parse a file line by line by
executing a command with the line (with os.system).
My problem now is that i'm o
str.encode()
and other thing but i think i'm missing here.
I want to create filename out of the DATA, it's realy
important.
Hope in regards,
Truppe Steven
On 2016-11-23 02:32, Steve D'Aprano wrote:
On Wed, 23 Nov 2016 09:00 am, Lew Pitcher wrote:
2) Apparently os.mkdir() (at l
use the "pending..." value. The
only tricky part is to make sure you only start the thread once.
--
Steven
299792.458 km/s — not just a good idea, it’s the law!
--
https://mail.python.org/mailman/listinfo/python-list
7;) as f:
f.write("hellohello")
except (OSError, IOError):
pass
> What will be the best way to catch the exception in the above program ?
Not catching it at all.
> Can we replace both the with statement in the above program with something
> like below
>
> try:
> for i in range(1000):
>with open(os.path.join(QA_TEST_DIR,"filename%d" %i),'w') as f:
>f.write("hello")
> except IOError as e:
> raise
What's the point of that? All you are doing is catching the exception and then
immediately raising it again. That's the same as not catching it.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday 29 November 2016 02:18, Ganesh Pal wrote:
> On Mon, Nov 28, 2016 at 1:16 PM, Steven D'Aprano <
> [email protected]> wrote:
>
>>
>>
>> There is no need to return True. The function either succeeds, or it
>> raises an
>
ned
>> blocking?
>
> "await" means "don't continue this function until that's done". It
> blocks the function until a non-blocking operation is done.
So that would be... "yes"?
--
Steven
"Ever since I learned about confirmation bias, I
system, like Windows, OS X or Linux, a lot can happen in the microseconds
between checking for the file's existence and actually accessing the file.
This is called a "Time Of Check To Time Of Use" bug, and it can be a security
vulnerability.
--
Steven
"Ever since I l
And you thought Agile development was simple:
https://pbs.twimg.com/media/CyjbCtGXcAEhQi8.jpg:large
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
7;
ls: cannot access foo: No such file or directory
The quotation marks are part of the filename, and so they need to be protected
from the shell or else you get an error quite similar to the one you got:
no such column: R
but there is (or so it appeared) a column 'R' (he
pre-processing for a single command.
The fact that there is no easy, well-known way to do so indicates just how
unusual Bart's use-case is. Linux and Unix sys admins are really good at
scratching their own itches, and believe me, if there was widespread wish to
disable pre-processing for a singl
ar
I can't easily know in advance what globbing rules I can use for a particular
command, but I can know what rules my shell uses, and now *all* commands
support the same, whether they know it or not.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
i
roviding a binary
> executable. For the moment, I'm using C source code as every Unix system
> has a C compiler. I suppose it could be Python source too, but I doubt
> if my interpreters written in Python will run quite as briskly --
bash is about an order of magnitude slower than Pyth
ty/1996-Novembe
>r/msg00026.html>
Whereas if it were mandatory locking, enforced by the OS, it wouldn't be a
problem?
Here's that URL without the indent and word-wrapping:
https://www.redhat.com/archives/linux-security/1996-November/msg00026.html
--
Steven
"Ever since I l
ars of directed evolution by
thousands of sys admins who have designed the shells to work the way they want.
And it looks like Windows is ever-so-slowly converging on the same, or at least
similar, sets of conventions: by copying Unix globbing metacharacters in the
first place, then by adding the
over the number of characters here,
>>>> or this bogeyman of "one million files" in a directory.
>>>
>>> Because /you/ brought it up as a reason why 'globbing' would help when
>>> there are command limits?
>>
>> I did?
>>
y*. Its not a feature you care for, but its not
designed for you.
So get over it.
[...]
>> Looks like you have a lot of wheels that need re-inventing before you come
>> even close to parity with the features of the Linux shell.
>
> These are wheels I don't *want* to re-invent! I'm not writing a shell.
Indeed, and nobody wants to force you to.
But the people who wrote sh, bash, zsh, etc ARE writing shells, and they've
given them the features that shell users demand so that you, the application
author, don't have to.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
27;: 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,
'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
There you go, fixed that.
As for the rest, I haven't bothered to check you
ozenset()
frozenset()
> And then some figuring out how to get an empty set into a set
> This is the best I get:
>>>> f([f([])])
> frozenset({frozenset()})
py> Ø = frozenset()
py> frozenset([Ø])
frozenset({frozenset()})
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
tialiser" just seems to be the obvious
term for it. (Do I really need to spell it out? __INIT__/INITialiser.)
Python's object creation model seems to be a lot closer to that of ObjectiveC
or C++ than Javascript, so copying Javascript's terminology seems risky to me.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
wo distinct things as the "constructor", depending on
what you are doing. [Source: my resident Ruby expert at work.] If you are
talking about *writing* a class, the constructor is the initialize method:
class MyClass
def initialize
...
end
end
But if you are talking about *cr
e stdlib ?
You could try raising a feature request on the bug tracker.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
u know: an instance attribute will shadow the class attribute.
(Actually, that's not *completely* true. It depends on whether x.sin is a
descriptor or not, and if so, what kind of descriptor.)
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
interpreter Django uses? I’ve
> been through the official docs a couple of times today, but detailed
> explanations of pyvenv, let alone this dual version feature, have not been
> found. If you can point me to a good one, please do. Meanwhile...
How do you control which interpreter Django
f ..." line, it also needs to end with a colon.
So the first thing is that when asking for help, be *extra careful* that the
code you show us is the same as the code you are actually running. (Otherwise
we waste our time trying to debug code that you aren't even using!) You should
always COPY AND PASTE your code, not retype it.
But let's assume that your actual code does include the needed colons, so it
will run. What values do you check for?
- "to low"
and that's it. Look again at the values that higher_or_lower can actually be.
Is there any way that higher_or_lower gets the value "to low"?
No. Remember that Python can't read your mind and realise that when you check
for "to low", you actually mean just "low". So there is no way that the first
if... clause will be triggered, so it always falls through to the else clause
and prints "Sorry your are too high. Try again."
(P.S. you mean "Sorry you are too high", not "your are".)
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
int(1, 100)
while a beginner is still puzzling over their first mistake. Don't stress about
it, it is all just part of the learning process. All code starts off full of
bugs.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere."
-based editor would look like. Maybe
one that used a ribbon-based interface, like MS Office? Or perhaps Leo?
http://leoeditor.com/
[My resolution for 2017: stop talking about Leo and actually download the damn
thing and try it out.]
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
Or I can do this from the operating system's
shell prompt:
steve@runes:~$ python -c "print 'http://www.example.com'"
http://www.example.com
If I do this in GNOME Terminal 2.30.2, the URL http... is a clickable link. But
that's specific to the terminal. Other terminals may or may not recognise it.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday 04 January 2017 15:46, Deborah Swanson wrote:
> Steven D'Aprano wrote, on January 03, 2017 8:04 PM
[...]
>> Of course you have to put quotes around them to enter them in
>> your source code.
>> We don't expect this to work:
>>
>> print
y to go. And with tab completion, you don't have to type as much as you
might think. It just becomes second nature after a while.
I type something like "pypathwhat" and the shell will
autocomplete directory and filenames.
Anyway, this isn't an argument over which is
Ls in Python are not first-class. They start as a string,
and then you parse them into a tuple:
https://docs.python.org/3/library/urllib.parse.html
https://docs.python.org/2/library/urlparse.html
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everyw
f ..." line, it also needs to end with a colon.
So the first thing is that when asking for help, be *extra careful* that the
code you show us is the same as the code you are actually running. (Otherwise
we waste our time trying to debug code that you aren't even using!) You should
always COPY AND PASTE your code, not retype it.
But let's assume that your actual code does include the needed colons, so it
will run. What values do you check for?
- "to low"
and that's it. Look again at the values that higher_or_lower can actually be.
Is there any way that higher_or_lower gets the value "to low"?
No. Remember that Python can't read your mind and realise that when you check
for "to low", you actually mean just "low". So there is no way that the first
if... clause will be triggered, so it always falls through to the else clause
and prints "Sorry your are too high. Try again."
(P.S. you mean "Sorry you are too high", not "your are".)
--
Steven
"Ever since I learned about confirmation bias, I've been seeing it everywhere."
- Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday 04 January 2017 15:46, Deborah Swanson wrote:
> Steven D'Aprano wrote, on January 03, 2017 8:04 PM
[...]
>> Of course you have to put quotes around them to enter them in
>> your source code.
>> We don't expect this to work:
>>
>> pri
int(1, 100)
while a beginner is still puzzling over their first mistake. Don't stress about
it, it is all just part of the learning process. All code starts off full of
bugs.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing it everywhere."
-based editor would look like. Maybe
one that used a ribbon-based interface, like MS Office? Or perhaps Leo?
http://leoeditor.com/
[My resolution for 2017: stop talking about Leo and actually download the damn
thing and try it out.]
--
Steven
"Ever since I learned about confirmation bias, I've been seeing it everywhere."
- Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
this from the operating system's
shell prompt:
steve@runes:~$ python -c "print 'http://www.example.com'"
http://www.example.com
If I do this in GNOME Terminal 2.30.2, the URL http... is a clickable link. But
that's specific to the terminal. Other terminals may or may not recognise it.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing it everywhere."
- Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
go. And with tab completion, you don't have to type as much as you
might think. It just becomes second nature after a while.
I type something like "pypathwhat" and the shell will
autocomplete directory and filenames.
Anyway, this isn't an argument over which is better, IDLE
-based editor would look like. Maybe
one that used a ribbon-based interface, like MS Office? Or perhaps Leo?
http://leoeditor.com/
[My resolution for 2017: stop talking about Leo and actually download the damn
thing and try it out.]
--
Steven
"Ever since I learned about confirmation bias, I've been seeing it everywhere."
- Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
to guess, I'd guess:
- you actually mean \r rather than /r;
- paragraphs in Word docs always end with a carriage return \r;
- and whoever typed the paragraph accidentally hit the spacebar after typing
the word "match".
But its just a guess. For all I know, the software you are
e)
Record(A=10, B=20, C=30)
py> Record(999, *instance[1:])
Record(A=999, B=20, C=30)
The recommended way is with the _replace method:
py> instance._replace(A=999)
Record(A=999, B=20, C=30)
py> instance._replace(A=999, C=888)
Record(A=999, B=20, C=888)
Note that despite the leading underscor
Grumpy, an experimental project from Google, transpiles Python code into Go,
allowing Python programs to be compiled and run as static binaries using the Go
toolchain.
http://www.infoworld.com/article/3154624/application-development/google-boosts-python-by-turning-it-into-go.html
--
Steven
On Sunday 08 January 2017 20:53, Deborah Swanson wrote:
> Steven D'Aprano wrote, on January 07, 2017 10:43 PM
>>
>> On Sunday 08 January 2017 16:39, Deborah Swanson wrote:
>>
>> > What I've done so far:
>> >
>> > with open('E:\\Co
n(x)]]
I can't decide whether that's an awesome trick or a horrible hack...
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
On Monday 09 January 2017 15:09, Chris Angelico wrote:
> On Mon, Jan 9, 2017 at 2:53 PM, Steven D'Aprano
> wrote:
>> [(tmp, tmp + 1) for x in data for tmp in [expensive_calculation(x)]]
>>
>>
>> I can't decide whether that's an awesome trick or a horr
:
...
Good, bad or indifferent?
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
xBros import *
would be more familiar syntax :-)
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday 10 January 2017 16:55, Ethan Furman wrote:
> On 01/09/2017 09:18 PM, Steven D'Aprano wrote:
>
>> The docs say that enums can be iterated over, but it isn't clear to me
>> whether they are iterated over in definition order or value order.
>>
>&
On Tuesday 10 January 2017 00:12, Antoon Pardon wrote:
> Op 09-01-17 om 04:53 schreef Steven D'Aprano:
>> Suppose you have an expensive calculation that gets used two or more times
>> in a loop. The obvious way to avoid calculating it twice in an ordinary loop
>> is
, as useless as that it.
Note that in Python 3.3 and better, abstractproperty is deprecated: the ABC
metaclass is smart enough to work with the regular property decorator:
https://docs.python.org/3.6/library/abc.html#abc.abstractproperty
> Or, am I just not grokking it properly?
No, I agree
ist, or even a tuple, and of course l[0]
doesn't work because l is actually a class?
Its easy to criticise us for answering the questions you ask instead of the
questions you intended, but we're not mind-readers. We don't know what you're
thinking, we only know what you com
t you confirm that it also
occurs in the standard Python interpreter and isn't iPython specific.
Just run your same code but directly from python, not the interactive iPython
console.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere."
tproof, but anyone wanting to subclass my
class should need to work for it, which hopefully will tell them that they're
doing something unsupported.
Any hints?
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday 17 January 2017 18:05, Steven D'Aprano wrote:
> I wish to emulate a "final" class using Python, similar to bool:
[...]
> Any hints?
I may have a solution: here's a singleton (so more like None than bools) where
instantiating the class returns the singleton,
On Tuesday 17 January 2017 20:37, Antoon Pardon wrote:
> Op 17-01-17 om 08:05 schreef Steven D'Aprano:
>> I wish to emulate a "final" class using Python, similar to bool:
>>
>> py> class MyBool(bool):
>> ... pass
>> ...
>> Tr
> more for folks.
Perhaps some Python-on-Windows user who cares about this issue should raise it
on the bug tracker as a feature request.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
cls
raise TypeErrror('Possible metaclass conflict')
but that's disallowed. Any ideas?
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
nt)
>
> The O(N) cost has to be paid at some point, but I'd put forth that
> other operations like .find() already pay that O(N) cost and can
> return an opaque "offset token" that can be subsequently used for O(1)
> indexing (multiple times if needed).
Sure -- but only at the cost of blowing out the complexity and memory
requirements of the string, which completely negates the point in using UTF-8
in the first place.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
r.
And sure enough, C is prone to indent/brace mismatch errors.
When I design my killer language, it won't fail when there's a mismatch between
indentation and open/close delimiters. Nor will it just give priority to one or
the other. Instead, it will learn from your errors and typo
ll the stuff, keep
> all the memory usage.
Keep in mind that I'm only *guessing* from the impression that the author
gives. I don't *know* that is what he's doing.
He makes all these claims about Python, but doesn't show his code, so the best
we can do is try to predict
t; [1] Wonder how many of today's generation of programmers have actually
> heard a record skip...
Haven't you heard? Vinyl is making a comeback. Seriously.
--
Steven
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." - Jon Ronson
--
ht
?
>
> Read the history of shutil.get_terminal_size(). All this was discussed.
Yes, it was discussed, but not resolved: Antoine Pitrou just closed the task
and declared it done, without resolving the failures I am talking about here.
http://bugs.python.org/issue13609
(Thanks Eryk Sun for the li
On Tue, 06 Mar 2018 11:52:22 +0300, Kirill Balunov wrote:
> I propose to delete all references in the `filter` documentation that
> the first argument can be `None`, with possible depreciation of `None`
> as the the first argument - FutureWarning in Python 3.8+ and deleting
> this option in Python
On Tue, 06 Mar 2018 14:09:53 -0800, Ooomzay wrote:
> Unfortunately, despite having conquered it, without a _guarantee_ of
> this behaviour from the language, or at least one mainstream
> implementation, I will not invest in python again.
Oh well, so sad. See you later.
--
Steve
--
https://ma
On Tue, 06 Mar 2018 23:03:15 -0500, Andrew Z wrote:
> Hello,
> with 3.6 and latest greatest lxml:
>
> from lxml import etree
>
> tree = etree.parse('Sample.xml')
> etree.register_namespace('','http://www.example.com')
> it seems to not be happy with the empty tag . But i'm not sure why and
> h
On Wed, 07 Mar 2018 16:57:51 -0500, C W wrote:
> Hello,
>
> I am new to OOP. I'm a bit confused about the following code.
>
> class Clock(object):
> def __init__(self, time):
> self.time = time
Here you set the instance attribute "self.time".
> def print_time(self):
> t
I'm afraid the original post by 노연수 has not come
through to me, so I will have to reply to Ben's reply.
On Fri, 09 Mar 2018 12:59:52 +1100, Ben Finney wrote:
> I am not using Python 3.7 (it isn't released yet); I recommend staying
> with the latest Python release. Today, that is version 3.6.
3
On Fri, 09 Mar 2018 00:47:21 +, MRAB wrote:
> On 2018-03-08 23:57, Ben Finney wrote:
>> You mean the tool is not always looking for mistakes while you type?
[...]
>> Certainly it'd be good to always have a *perfect* overseer checking for
>> mistakes . Until that happy day, though, let's use t
On Thu, 08 Mar 2018 20:25:42 -0500, C W wrote:
> Thank you guys, lots of great answers, very helpful. I got it!
>
> A follow-up question:
>
> How did the value of "object" get passed to "time"? Obviously, they have
> different names. How did Python make that connection?
It didn't. You have misu
On Fri, 09 Mar 2018 10:22:23 +0100, Stefan Behnel wrote:
> Andrew Z schrieb am 07.03.2018 um 05:03:
>> Hello,
>> with 3.6 and latest greatest lxml:
>>
>> from lxml import etree
>>
>> tree = etree.parse('Sample.xml')
>> etree.register_namespace('','http://www.example.com')
>
> The default names
On Fri, 09 Mar 2018 13:08:10 +0100, Stefan Behnel wrote:
>> Is there a good reason not to support "" as the empty prefix?
>
> Well, the "empty prefix" is not an "empty" prefix, it's *no* prefix. The
> result is not ":tag" instead of "prefix:tag", the result is "tag".
That makes sense, thanks.
I am trying to enumerate all the three-tuples (x, y, z) where each of x,
y, z can range from 1 to ∞ (infinity).
This is clearly unhelpful:
for x in itertools.count(1):
for y in itertools.count(1):
for z in itertools.count(1):
print(x, y, z)
as it never advances beyond x=
On Sat, 10 Mar 2018 11:15:49 +, Paul Moore wrote:
> On 10 March 2018 at 02:18, MRAB wrote:
[...]
>> This might help, although the order they come out might not be what you
>> want:
>>
>> def triples():
>> for total in itertools.count(1):
>> for i in range(1, total):
>>
On Sun, 11 Mar 2018 01:40:01 +, Ben Bacarisse wrote:
> I'm sure deep recursion is not needed, it's just tricky translating from
> a lazy language when one is not familiar with all the iterator
> facilities in Python. For example, I couldn't find an append operation
> that returns an iterable.
On Mon, 12 Mar 2018 13:17:15 +, Robin Becker wrote:
> It's possible to generalize the cantor pairing function to triples, but
> that may not give you what you want. Effectively you can generate an
> arbitrary number of triples using an iterative method. My sample code
> looked like this
>
>
How do Fractions convert to ints when they have no __int__ method?
py> from fractions import Fraction
py> x = Fraction(99, 2)
py> int(x) # works fine
49
py> x.__int__
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'Fraction' object has no attribute '__int__'
--
Ste
On Tue, 13 Mar 2018 12:40:26 +0100, Robin Koch wrote:
> Am 13.03.2018 um 12:16 schrieb Steven D'Aprano:
>
>> How do Fractions convert to ints when they have no __int__ method?
>
> It uses __trunc__:
Ah, thanks!
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 13 Mar 2018 10:58:42 -0400, Terry Reedy wrote:
> On March 10, on thread "Python 2.7 -- bugfix or security before EOL?",
> Guido van Russum wrote
>
> "The way I see the situation for 2.7 is that EOL is January 1st, 2020,
> and there will be no updates, not even source-only security patches
Explain the difference between these two triple-quoted strings:
Here is a triple-quoted string containing spaces and a triple-quote:
py> """ \""" """
' """ '
But remove the spaces, and two of the quotation marks disappear:
py> """\""
'"'
If nobody gets the answer, I shall reveal all late
On Fri, 16 Mar 2018 11:04:22 +0530, Ganesh Pal wrote:
> All that I am trying to do here is write a generic function that will
> re-retry
> the command few more times before failing the test
Something like this should do it. It gives up immediately on fatal errors
and tries again on temporary
The bug tracker currently has a discussion of a bug in the median(),
median_low() and median_high() functions that they wrongly compute the
medians in the face of NANs in the data:
https://bugs.python.org/issue33084
I would like to ask people how they would prefer to handle this issue:
(1) Put
On Fri, 16 Mar 2018 22:08:42 -0400, Terry Reedy wrote:
> On 3/16/2018 7:16 PM, Steven D'Aprano wrote:
>> The bug tracker currently has a discussion of a bug in the median(),
>> median_low() and median_high() functions that they wrongly compute the
>> medians in th
On Sat, 17 Mar 2018 16:41:01 +1100, Ben Finney wrote:
>> (4) median() should strip out NANs.
>
> Too much magic.
Statistically, ignoring NANs is equivalent to taking them as missing
values. That is, for the purposes of calculating some statistic (let's
say, median, although it applies to other
On Mon, 19 Mar 2018 10:04:53 -0700, Irv Kalb wrote:
> Some people say
> that this type of thing is fine and these warnings should just be
> ignored. While others say that all instance variables should be defined
> in the __init__ method.
Whenever anyone says "you should do this", the question to
On Tue, 20 Mar 2018 02:43:13 -0400, Terry Reedy wrote:
> I think a claim that in all programs all attributes should be set *in*
> __init__, as opposed to *during* initialization, is wrong. All
> attribute setting is side-effect from a functional view (and usually
> 'bad' to a functionalist). The
On Tue, 20 Mar 2018 11:14:13 +, Alister via Python-list wrote:
> but why would a functional programmer be programming an OOP class?
I read a really good blog post a while back, which I sadly can no longer
find (I had it bookmarked until Firefox ate my bookmarks) that discussed
exactly that
On Mon, 19 Mar 2018 22:08:09 +0530, Ganesh Pal wrote:
I'm sorry Ganesh, you have appeared to have just quoted my post without
writing anything new. (I haven't taken the time to read your post in fine
detail.) Apart from "Regards, Ganesh" at the very end, everything is
quoted text (starting with
On Wed, 21 Mar 2018 02:20:16 +, Larry Martell wrote:
> Is there a way to use the multiprocessing lib to run a job on a remote
> host?
Don't try to re-invent the wheel. This is a solved problem.
https://stackoverflow.com/questions/1879971/what-is-the-current-choice-for-doing-rpc-in-python
I'
On Tue, 13 Mar 2018 23:56:37 +0100, Denis Kasak wrote:
[...]
> The triples can be viewed as a pair of a pair and a natural number:
>
> (1,1),1 (1,1),2 (1,1),3 ...
> (2,1),1 (2,1),2 (2,1),3 ...
> (1,2),1 (1,2),2 (1,2),3 ...
[...]
> This leads fairly naturally to the implementation.
>
> from
On Wed, 21 Mar 2018 03:15:30 -0700, gurpreetsinghluky wrote:
> Please help me
We'd love to help if only we knew what you wanted.
Can you explain what you want? Give an example of the data you are
working with and the results you expect?
--
Steve
--
https://mail.python.org/mailman/listinfo/
sure your JSON files are pure ASCII, which
> is the common subset of UTF-8 and Latin-1.
And that's utterly unnecessary, since any character which can be stored
in the Latin-1 MySQL database can be stored in the Unicode JSON.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 23 Mar 2018 11:08:56 +1100, Chris Angelico wrote:
> On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano
> wrote:
>> On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote:
>>
>>>> I was reading though, that JSON files must be encoded with UTF-8. So
&
On Fri, 23 Mar 2018 12:05:34 +1100, Chris Angelico wrote:
> Latin-1 is not "arbitrary bytes". It is a very specific encoding that
> cannot decode every possible byte value.
Yes it can.
py> blob = bytes(range(256))
py> len(blob)
256
py> blob[45:55]
b'-./0123456'
py> s = blob.decode('latin1')
py>
On Fri, 23 Mar 2018 18:35:20 +1100, Chris Angelico wrote:
> That doesn't seem to be a strictly-correct Latin-1 decoder, then. There
> are a number of unassigned byte values in ISO-8859-1.
That's incorrect, but I don't blame you for getting it wrong. Who thought
that it was a good idea to disting
On Fri, 23 Mar 2018 10:39:05 -0600, Malcolm Greene wrote:
>> Perhaps it doesn't need to be said, but just to be sure: don't use eval
>> if you don't trust the people writing the configuration file. They can
>> do nearly unlimited damage to your environment. They are writing code
>> that you are
On Fri, 23 Mar 2018 07:46:16 -0700, Tobiah wrote:
> If I changed my database tables to all be UTF-8 would this work cleanly
> without any decoding?
Not reliably or safely. It will appear to work so long as you have only
pure ASCII strings from the database, and then crash when you don't:
py> te
On Sat, 24 Mar 2018 11:21:09 +1100, Chris Angelico wrote:
>>> If I changed my database tables to all be UTF-8 would this work
>>> cleanly without any decoding?
>>
>> Not reliably or safely. It will appear to work so long as you have only
>> pure ASCII strings from the database, and then crash when
2501 - 2600 of 15563 matches
Mail list logo