make altinstall
There were no obvious errors until the end:
The directory '/home/steve/.cache/pip/http' or its parent directory is not
owned by the current user and the cache has been disabled. Please check the
permissions and owner of that directory. If executing pip with sudo, you
may want
ocs.python.org/3/library/cmd.html
You can study that to get some hints for writing a non-interactive
interpreter.
--
Steve
“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
variables have only a single type, which must
be explicitly declared. But modern languages like Rust have very smart
compilers with a very powerful type system, and they don't have that
restriction.
--
Steve
“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
ink*
The way you can usually tell your functional language has given up purity in
favour of mutating implementations is that your code actually runs with
non-toy amounts of data :-)
--
Steve
“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
f the features of Python that keeps it relatively slow is that
function calls are resolved at runtime: calling len(x) has to do a runtime
search for the name "len" before calling it. Victor Stinner is working on
run-time optimizations which can detect when it is safe to replace that
run-t
st, but just the same
list, in four places.
Here are two options:
# Python 3 only: use a dict comprehension
py> d = {x:[] for x in (1, 2, 3)}
py> d
{1: [], 2: [], 3: []}
py> d[1].append('abc')
py> d
{1: ['abc'], 2: [], 3: []}
# any version of Python
d = {}
for
Mail folder?
Unfortunately there are at least four open issues relating to email from the
bug tracker being marked as spam:
http://psf.upfronthosting.co.za/roundup/meta/
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mai
m)
result = print(message)
b.append(result)
print(b)
--
Steve
“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
ake a slice of None. Try this:
a = [1, 2, 3, 4, 5, 6, 7, 8]
random.shuffle(a)
b = a[0:3]
print(b)
--
Steve
“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
ly decide what do you want to do. If the user provides an
invalid hostname, what do you want to happen? If the network is down, what
do you want to happen?
Sometimes the best way to handle errors is not to handle them at all. If you
don't know what to do with a particular error condition, *don
not all older
Unix systems even have env).
> For Python 2: #!/usr/bin/env python
> For Python 3: #!/usr/bin/env python3
>
> It will not matter where Python is installed. 'env' will always
> know where it is.
That's not correct: env only searches the PATH, so if your
quite the right description, but something like that.
> That would be like this:
>
> def temp():
> ret = []
> for x in range(y):
> for y in range(3):
> ret.append((x,y))
> return ret
> temp()
Indeed.
--
Steve
“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
lError: local variable 'y' referenced before assignment
Of course there's no problem with accessing globals in the second loop, so
long as the name doesn't clash with a local:
py> Y = 999
py> [(y, z, x) for x in (1, 2) for z in (10, Y) for y in (100,)]
[(100, 10, 1), (100, 999, 1), (100, 10, 2), (100, 999, 2)]
[1] Function declarations are *slightly* different, so we can write this:
def func(a, b=b)
to define a parameter (local variable) "b" that takes its default value from
b in the surrounding scope. But that's a declaration, not an expression.
--
Steve
“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
ension.
This may be an unexpected side-effect of other choices, but I don't see any
discussion or consideration of this specific issue.
[Aside: Guido's quote in the PEP is unsourced; there's a reference given,
but it goes to a different email from Guido, not one that includes the
claim
terator is evaluated in the defining scope. However, it's only
> documented for generator expressions, in 6.2.8. The documentation for
> comprehensions in 6.2.4 makes no mention of it.
6.2.8? 6.2.4? What are these references to?
--
Steve
“Cheer up,” they said, “things could be worse.” So
be evaluated more often (or
> less, for that matter).
Again, that's quite straight forward.
> Only in extreme edge cases involving name scoping can the evaluation
> of the first iterable depend on whether it's inside or outside the
> invisible function.
I don't think
is not your first language, please say so, and try your best.
It may help if you show some code, and explain what result you want.
--
Steve
“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
nter to abort, Ctrl-C to abort. ENTER
$ Abort aborted. Missiles fired.
--
Steve
“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
sn't even imply it, technically -
> you could want to do other stuff and occasionally check if the user has
> entered a line, though *that* is even *more* involved on Windows because
> it means you can't do it with msvcrt.kbhit.
--
Steve
“Cheer up,” they said, “things
ented input? Why would I do that, when the OS does it?
Okay, sure, if you're programming for some sort of primitive system with no
OS or such a feeble one that it didn't even offer line-oriented text I/O,
then needs must, and you have to do what the OS doesn't provide. But that
sort of low-level I/O is precisely what operating systems are for.
--
Steve
“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 Linux you can't assume any such resources except some apparently
> 1970s-style terminal handling, from what I can figure out.)
And possibly not even that. If your script is running as a cron job, I
believe that there's no terminal attached, and possibly no stdin or stdout.
I don't remember the details.
--
Steve
“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
hon 2.7, I am wondering how
> to switch between 2 and 3 in command prompt.
I don't use Windows, so I am guessing, but you could try:
python2
python27
python3
python35
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https
On Fri, 28 Oct 2016 12:13 am, BartC wrote:
> [repost as original disappeared]
> On 27/10/2016 12:41, Steve D'Aprano wrote:
>> On Thu, 27 Oct 2016 09:42 pm, BartC wrote:
>
>> I don't need one character at a time. I want to pause everything else,
>> ask the
nt to
pass a literal star * you need to escape it so that the shell won't treat
it as a glob and expanding it: \*.py or "*.py" will probably work.
(And yes, shell escaping is one of the more arcane and tricky part of Unix
shell scripting.)
--
Steve
“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
or Americans who ignored the rest of the world. You had IBM PC
extended ASCII, Apple Macintosh extended ASCII, Hewlett-Packard extended
ASCII, Atari extended ASCII ("ATASCII"), Commodore extended ASCII
("PETSCII"), and more.
--
Steve
“Cheer up,” they said, “things could
y".
spam and eggs can remain blank. Inside __init__.py put:
import imptest.spam
print(spam)
Save and close the file, and then launch Python. Try:
import imptest
imptest.spam # this should work
imptest.eggs # this should fail
import imptest.eggs
imptest.eggs # this should now work
Python. In general, Python
won't make any promises that the OS doesn't, nor will it generally offer
any feature that the OS doesn't. In particular, system calls are only
available on platforms that provide that system call. (Duh.)
So no Windows system calls on Unix, and no Unix sy
tring respectively
> (with a default set of separators delimiting the string, or "..." can be
> used). Or values can be read one at a time:
>
> readln
> read a:"h"
Here's an alternative spelling:
readh a
readr b
reads c
Or if you prefer
On Sat, 29 Oct 2016 10:53 pm, BartC wrote:
> On 29/10/2016 02:04, Steve D'Aprano wrote:
>> On Fri, 28 Oct 2016 05:09 am, BartC wrote:
>
>>> For years I've had discussions in comp.lang.c about things that C should
>>> or should not have.
>
>> Ba
import ntpath as path
elif the operating system is Unix:
import posixpath as path
else:
import genericpath as path
So os.path is a module.
--
Steve
“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 words it is a toy, utterly unsuitable for serious use by anyone
who cares about data validity and error checking, only suitable for
teaching bad habits to beginners.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail
Ben's post, or for that matter the
subject line of this thread, you will see he is comparing:
path/to/python3 -m pip install LoremIpsum
against:
pip3 install LoremIpsum
not a direct path to the executable versus a symbolic link to the
executable. The problem here is the "pip3&q
;b"):
yield c + d
so you will get "xa", "xb", "ya", "yb".
Last example:
list(fg(["PQR", "xy", "ab"]))
will loop over "PQR", then as the inner loop it will loop over
fg(["xy", "ab"]). But we already have seen that. So you will get:
"Pxa", "Pxb", "Pya", "Pyb",
"Qxa", "Qxb", "Qya", "Qyb",
"Rxa", "Rxb", "Rya", "Ryb"
and then halt.
--
Steve
“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
le* something happens;
Use a for-loop for:
- loop over each element of a sequence;
- loop a fixed number of times.
--
Steve
“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
udo grep ^$USER\: /etc/shadow
Bash is not involved here. Python is calling grep directly.
You don't have to believe us, you can test this yourself. Create a simple
text file with a single line containing your username, and a simple Python
script that calls grep as you have been:
[ste
On Tue, 1 Nov 2016 06:40 pm, meInvent bbird wrote:
> how to debug this distributed program?
The same way you would debug any other program.
http://sscce.org/
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
ht
than a factor of two slower. I wouldn't call
that "especially bad" -- often times, a factor of two is not important.
What really hurts is O(N**2) performance, or worse.
So at worst, map() is maybe half as fast as a list comprehension, and at
best, its perhaps a smidgen faster. I woul
in the task (going through one list and doing some operation
> on each operation), the difference between map and a comprehension is
> generally going to be negligible.
I wouldn't go quite so far as to say "negligible" -- a factor of two speed
up on a large list is not somethin
ectly into the list, compared to writing to a
temporary list and then copying the lot in one go.
(I find these results unintuitive, but I've seen them often enough that I'm
confident they are real.)
> About Readability & Redundancy
>
> I have misused the terms here, but I wasn't expecting so much nitpicking.
You must be new here :-)
--
Steve
“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, 5 Nov 2016 08:45 pm, Jon Ribbens wrote:
> On 2016-10-31, Steve D'Aprano wrote:
>> On Mon, 31 Oct 2016 07:21 pm, Jon Ribbens wrote:
>>> On 2016-10-31, Ben Finney wrote:
>>>> Instead, you should invoke the exact Python interpreter you want – and,
>&g
for activation.
https://virtualenv.pypa.io/en/stable/userguide/#activate-script
[1] Technically, the application being run may invoke different behaviour
depending on the name it was invoked by. Some editors do that, e.g.
the "joe" editor. But I don't believe Python does any
the use of eval or exec, but
its been too hard to exploit up until now. But with f-strings, chances are
that they too will be trivially exploitable.
--
Steve
“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
t;Hello World")
--- cut ---
Here's the same program in Objective C:
--- cut ---
#import
int main (int argc, const char * argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog (@"Hello, World!");
[pool drain];
return 0;
On Sun, 6 Nov 2016 08:17 am, Ben Bacarisse wrote:
> Steve D'Aprano writes:
>> Here's the same program in Objective C:
>>
>> --- cut ---
>>
>> #import
>>
>> int main (int argc, const char * argv[])
>> {
>> NSAutorel
ng.
First you asked about symlinks, misunderstanding what Ben wrote; then you
denied you asked that and insisted you really asked about activate (despite
not having even mentioned activate); and now you're inventing a new
question, "how does it know it is in a venv?".
Life is too short
e for short scripts
or programmers that run quickly. It takes time for the JIT to warm up and
start showing optimizations.
--
Steve
“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 Tue, 8 Nov 2016 05:47 am, jlada...@itu.edu wrote:
> On Saturday, November 5, 2016 at 6:39:52 PM UTC-7, Steve D'Aprano wrote:
>> On Sun, 6 Nov 2016 09:17 am, Mr. Wrobel wrote:
>>
>>
>> I don't have any experience with GPU processing. I expect that it will
#x27;) # generates __init__ that populates instance with queue
> given as arg
> class Example:
> @classmethod
> def create(cls):
> return cls(Queue())
I don't think that this decorator example makes any sense. At least I cannot
understand it. Why on earth would you write a decorator to inject an
__init__ method into a given class? Unless you have many classes with
identical __init__ methods, what's the point?
--
Steve
“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
for GPU numeric computing. I'll
agree that things are better than I feared.
--
Steve
“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
(t):
for j in range(i):
next(x, None)
return zip(*t)
Can we do better, or is that optimal (for any definition of optimal that you
like)?
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python
che__', '__main__.py', 'abc.py']
You can ignore the __pycache__ directory, that's just used for caching the
byte-code compiled .pyc files. __main__.py is used if you try to run
collections as a script:
python3.5 -m collections # will run collections/__main__.py
a
)
py> finder.report()
Name File
m __main__ /tmp/do_little.py
m math
/usr/local/lib/python3.5/lib-dynload/math.cpython-35m-i386-linux-gnu.so
So I'm not really sure what's going on.
--
Steve
“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
uld be any number of reasons why "it doesn't work",
starting with wrong repos in the apt-get config, typos in the command,
wrong password for sudo, internet connection is down, or keyboard not
plugged in.
--
Steve
“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
ard"
words = ['Hello/Hi', 'my', 'name', 'is', 'Richard/P']
result = " ".join(words)
assert result == "Hello/Hi my name is Richard/P"
and mystring is irrelevant.
--
Steve
“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
rd, word, word]
' '.join(the list) makes a string with the words separated by spaces:
' '.join(['quick', 'brown', 'fox']) => 'quick brown fox'
and then you finally print the result.
--
Steve
“Cheer up,” they said, “things cou
ing video" is just another way of saying "downloading
video, where the video is deleted afterwards".
(Actually, streaming video is just another way of saying "lots of pauses,
stuttering, dropped frames and a really awful user experience".)
--
Steve
“Cheer up,” they said,
def isiterator(obj):
"""Return True if obj is an iterator, and False otherwise.
Iterators can be iterated over, and they provide the following
methods:
- __iter__ which returns itself
- __next__
Iteration over an iterator repeatedly calls __next__ until a
StopI
ndard library by, oh, 90% and still have a decent language
for game scripting.
--
Steve
“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
frame buffer, and even ASCII art.
http://www.pygame.org/
http://www.pygame.org/wiki/about
--
Steve
“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
omething like an "__export__" variable that says what gets exposed to a
> simple "import foo" (sometimes one might want to "import foo" and
> sometimes "from foo import *" for namespace reasons, but why should
> those two statements import different
of Python, dis.dis() will also accept a string:
py> dis.dis('y = x + 1')
1 0 LOAD_NAME 0 (x)
3 LOAD_CONST 0 (1)
6 BINARY_ADD
7 STORE_NAME 1 (y)
10 LOAD_CONST 1 (None)
13 RETURN_VALUE
--
Steve
“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 Fri, 18 Nov 2016 12:19 am, BartC wrote:
> On 17/11/2016 12:20, Steve D'Aprano wrote:
>> On Thu, 17 Nov 2016 10:37 pm, BartC wrote:
>
>>> (I don't know how to disassemble code outside a function, not from
>>> inside the same program. Outside it might b
can do this:
m.append(tbl.copy())
But that won't work in Python 2.7. Or you can do this:
from copy import copy
m.append(copy(tbl))
But the most Pythonic way (the most standard way) is to use a slice to copy
the list: m.append(tbl[:])
> and introducing a local variable will n
ome of them
aren't. They're questions suggested by the "label with string tied to an
object" model of name binding. As experts, we're so used to the limits of
the model that we don't stop to think about all the ways that it can
mislead. But a beginner doesn't know the
ntics in C-like and
Algol-like languages: you have to reason through a level of indirection to
understand variables. And pointer semantics are notoriously difficult. So I
don't think it should be surprising that some people find it hard to
understand, at least at the beginning.
--
Steve
just write
your code to accept *either* a dict, or a list of tuples? Then you don't
have to invent some monstrous hybrid class that is like the product of an
awful teleportation accident.
--
Steve
“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
:
return inst._generic.values()
else:
return [t[1] for t in inst._generic]
(But even better is not to write it at all, and just use the dict, like I
suggested above :-)
--
Steve
“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
*y[1]; z[1] = x[2]*y[0] - \
x[0]*y[2]; z[2] = x[0]*y[1] - x[1]*y[0]"
The results I get are:
1 loops, best of 5: 30 usec per loop
100 loops, best of 5: 1.23 usec per loop
So on my machine, np.cross() is about 25 times slower than multiplying by
hand.
--
Steve
“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
ch simpler. In Python 3, it
doesn't matter whether you write:
class Foo:
class Foo():
class Foo(object):
the result is the same: a new-style class, or type.
The best thing to do in Python 2 is to always, without exception, write
class Foo(object):
to define your base classes. T
On Mon, 21 Nov 2016 11:09 pm, BartC wrote:
> On 21/11/2016 02:48, Steve D'Aprano wrote:
[...]
>> However, your code is not a great way of timing code. Timing code is
>> *very* difficult, and can be effected by many things, such as external
>> processes, CPU caches, eve
later (faster) usage.
>
> But is it really faster? If the pickle is, let's say, twice as large as
> the original file it should take roughly twice as long to read the data...
But the code is more complex, therefore faster.
That's how it works, right?
*wink*
--
Steve
“Cheer u
edtuple("struct", "ta wa ua")
data = []
for line in sys.stdin:
try:
t, w, u = line.strip().split("\t")
except ValueError as err:
print("Problem with line:", line, file=sys.stderr)
data.append(struct(t, w, a))
with open(filename, "wb") as fileObject:
pickle.dump(data, fileObject)
And as a bonus, when you come to use the record, instead of having to write:
line["ta"]
to access the first field, you can write:
line.ta
--
Steve
“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
cient, with less overhead. But given
that your magic compiler runs only on one person's PC in the entire world,
it is completely irrelevant.
--
Steve
“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 Tue, 22 Nov 2016 12:45 pm, BartC wrote:
> On 21/11/2016 14:50, Steve D'Aprano wrote:
>> On Mon, 21 Nov 2016 11:09 pm, BartC wrote:
>
>> Modern machines run multi-tasking operating systems, where there can be
>> other processes running. Depending on what you use
On my computer, numpy took only 10 times longer to cross-multiply 3000 pairs
of vectors than it took to cross-multiply a single pair of vectors. If I
did that in pure Python, it would take 3000 times longer, or more, so numpy
wins here by a factor of 300.
--
Steve
“Cheer up,” they said
eback shows you
which line of code fails with that error, and the full list of lines of
code calling it.
Please COPY and PASTE (don't re-type, don't summarise, don't simplify, and
especially don't take a screen shot) the entire traceback, starting from
the line beginning "
and getting the same error. You should try:
os.mkdir(title.decode('utf-8'))
which will at least give you a new error: you cannot use '/' inside a
directory name. So you can start by doing this:
os.mkdir(title.replace('/', '-').decode('utf-8'))
, the failure can be extremely mysterious, usually involving a
spurious
UnicodeDecodeError: 'ascii' codec
error.
Dealing with Unicode text is much simpler in Python 3. Dealing with
*unknown* encodings is never easy, but so long as you can stick with
Unicode and UTF-8, Python 3 makes it
return self._getval()
So you have something like this?
def _getval(self):
return self._cached_value
def __getval_with_comp(self):
value = ... # long computation
self._cached_value = value
self.getval = self._getval
# return value
return self._getval()
# why call the m
e underlying attribute, but not by using the public methods.
Then give it a public method (or better, a property) to tell.
@property
def needs_computation(self):
return not hasattr(self, '_cached_value')
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and s
mp.lang.python. You are reusing its content inappropriately and without
> authorization. What you are doing must be stopped.
This newsgroup is a mirror of the mailing list, not the other way around.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things g
orks, but I lose the
> ability to include it in a larger print statement.
Any time you find yourself directly calling dunder methods, you're probably
doing it wrong. This is one of those times.
--
Steve
“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 up
IEEE-754 semantics.
If x is a float, then x == x is not always true.
--
Steve
“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
running on, specifically how much RAM do you have. If you're trying to
process a 40GB file in memory on a machine with 2GB of RAM, you're going to
have a bad time...
--
Steve
“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
C:\My Documents\directory\'
(3) Or escape all your backslashes with more backslashes:
'192.168.0.1\\fe18cb0618cabd41\\ninjatrader$EURUSDTestRun
2016-11-25-11-11.csv'
--
Steve
“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
ection trivially easy in cases
where they were previously diabolically hard.
Yay for progress.
--
Steve
“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, 27 Nov 2016 11:25 am, Chris Angelico wrote:
> On Sun, Nov 27, 2016 at 11:13 AM, Steve D'Aprano
> wrote:
>> So-called f-strings haven't even hit the already been implicated in a
>> code-injection vulnerability:
>>
>> http://bugs.python.org/issue28
in__.Counter object at 0x0123> completed
<__main__.Counter object at 0x0246> completed
<__main__.Counter object at 0x048c> completed
<__main__.Counter object at 0x0918> completed
<__main__.Counter object at 0x1230> completed
--
Steve
“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 Tue, 29 Nov 2016 09:35 am, Gregory Ewing wrote:
> Steve D'Aprano wrote:
>> I daresay you are right that a sufficiently clever adversary may have
>> found an exploit. But there's no sign that anyone actually did find an
>> exploit, until f-strings made exploitin
_complete or event_loop.create_task, or as
> Chris suggested awaiting them as an aggregate.
I thought that's what I had done, by calling
loop.run_until_complete(main())
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
htt
On Tue, 29 Nov 2016 12:03 am, Chris Angelico wrote:
> On Mon, Nov 28, 2016 at 11:48 PM, Steve D'Aprano
> wrote:
>> When I try running that, I get no output. No error, no exception, the
>> run_until_complete simply returns instantly.
>
> When I do, I get this
ading a file. You're reading a file and converting
millions of strings to floats.
You are processing 7GB of data in 80 minutes, or around 1.5MB per second. Do
you have reason to think that's unreasonably slow? (Apart from wishing that
it were faster.) Where are you reading the file from?
>> Google's first hit for 'aenumerate' is
>>
https://pythonwise.blogspot.com/2015/11/aenumerate-enumerate-for-async-for.html
>
> Ok, so how about:
>
>aall(aiterable)
>aany(aiterable)
>class abytearray(aiterable[, encoding[, errors]])
[...]
get_event_loop().call_later(3, self.set_result, 42)
Not to be confused with concurrent.Futures.
https://docs.python.org/3.5/library/concurrent.futures.html
https://docs.python.org/3.5/library/asyncio-task.html#asyncio.Future
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheere
On Thu, 1 Dec 2016 03:18 am, Steve D'Aprano wrote:
> On Thu, 1 Dec 2016 01:48 am, Daiyue Weng wrote:
>
>> Hi, in order to use fabric, I tried to install pycrypto on Win X64. I am
>> using python 3.5 and using
[...]
> Although pycrypto only officially supports up to Pyth
python.org/pypi/pycrypto-on-pypi
but I suspect it is older and only supports Python 2.
--
Steve
“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
27;t
do the method lookup on the instance, but on the class instead:
return type(aiter).__anext__()
That matches the behaviour of the other dunder attributes, which normally
bypass the instance attribute lookup.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and
pdf
More here:
http://cwe.mitre.org/data/definitions/367.html
> Would this take care of race conditions?
Probably not, since locks are generally cooperative. The right way to
recover from an error opening a file (be it permission denied or file not
found or something more exotic) is to wrap the open() in a try...except
block.
--
Steve
“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
, other):
return self.additionFunction(self.value, other.value)
def __mul__(self, other):
return self.multiplyFunction(self.value, other.value)
Or better:
def __add__(self, other):
return self.value + other.value
def __mul__(self, other):
return self.value
active'
with open(filename,'w') as f:
print f.read()
# --- end ---
Now, a second script which naively, or maliciously, just deletes the file:
# --- bandit.py ---
import os, time
filename = 'thefile.txt'
time.sleep(1)
print 'deleting file, mwah
901 - 1000 of 7146 matches
Mail list logo