On 15/06/21 7:32 pm, Jach Feng wrote:
But usually the list creation is not in simple way:-) for example:
a = [1,2]
m = [a for i in range(3)]
m
[[1, 2], [1, 2], [1, 2]]
id(m[0]) == id(m[1]) == id(m[2])
True
The first line is only executed once, so you just get one
list object [1, 2]. You the
On 15/06/21 10:07 pm, Elena wrote:
After the optimization, I will use f just to predict new Xi.
So you're going to use f backwards?
I don't see how that will work. Where are you going to
find a new yi to feed into the inverse of f?
I think I don't understand what role g plays in all of
this.
On 16/06/21 12:15 pm, Avi Gross wrote:
May I ask if there are any PRACTICAL differences if multiple immutable
tuples share the same address or not?
Only if some piece of code relies on the identity of tuples
by using 'is' or id() on them.
There's rarely any need to write code like that, though
On 16/06/21 4:47 am, Chris Angelico wrote:
On Wed, Jun 16, 2021 at 2:41 AM Grimble wrote:
>
was bouncing because haydn.. was not a registered subdomain with
my ISP, whereas bach.. was registered.
>
> I like your naming convention :)
Weirdly, the first association "haydn" trig
On 16/06/21 10:51 pm, Elena wrote:
sorry I wrote it wrongly, my bad, I will use f just to predict yi from new
coming Xi.
Then what do you do with the new yi?
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 23/06/21 3:03 am, Kais Ayadi wrote:
for n in range(1, 7):
print (n)
for x in range(0, n):
print(" ", x)
can this code be more optimised?
Optimised for what? Readability? Execution speed? Code size?
Memory usage?
--
Greg
--
https://mail.python.org/mailman/listinfo/pyt
On 25/06/21 7:06 am, Chris Green wrote:
In python 2 one can do:-
for msg in maildir:
print msg # or whatever you want to do with the message
However in python 3 this produces "TypeError: string argument
expected, got 'bytes'".
How should one iterate over a maildir in pytho
On 11/07/21 2:24 am, Dennis Lee Bieber wrote:
Off-hand, that looks like a BASH command, so stuff it in your .bashrc
or .profile and see what happens.
Or make yourself a little shell script that starts flask with
the appopriate settings.
--
Greg
--
https://mail.python.org/mailman/listi
On 30/07/21 5:57 am, Michael F. Stemper wrote:
I would like to animate the rotation of a 3-cube.ng each step.
However, it seems to me that this is a solved problem, so there is
probably a module that will do most of the scutwork for me.
You might find something useful here:
https://medium.com
On 6/08/21 12:00 pm, Jack Brandom wrote:
It seems
that I'd begin at position 3 (that's "k" which I save somewhere), then I
subtract 1 from 3, getting 2 (that's "c", which I save somewhere), then
I subtract 1 from 2, getting 1 (that's "a", ...), then I subtract 1 from
1, getting 0 (that's J, ...),
On 11/08/21 3:22 pm, Terry Reedy wrote:
Python is a little looser about whitespace than one might expect from
reading 'normal' code when the result is unambiguous in that it cannot
really mean anything other than what it does.
>>> if3: print('yes!')
yes!
That may not be doing what you think
On 13/08/21 11:42 am, Cameron Simpson wrote:
2: It took me a while to see, but this is a type annotiation.
Interestingly, it seems to be parsed as a form of assignment with
a missing RHS.
>>> from ast import parse, dump
>>> dump(parse("if0: print('yes!')"))
"Module(body=[AnnAssign(target=Name(
On 13/08/21 5:52 am, Grant Edwards wrote:
I think what he's talking about is allowing the user to attach
arbitrary _metadata_ to the file ... IOW, something similar to the > "resource
fork" that MacOS used to have.
The resource fork was used for more than just metadata, it was
often the entire
On 16/08/21 1:50 am, Hope Rouselle wrote:
By the way, I'm aware that what I'm doing here is totally unsafe and I
could get my system destroyed. I'm not planning on using this --- thank
you for your concern. I'm just interested in understanding more about
modules.
Okay, I'll assume all the sec
On 18/08/21 4:43 pm, Steve wrote:
"The HAL (hardware abstraction layer) function HalMakeBeep()"
Is the beep that opens the pod bay doors?
def HalMakeBeepUsingPCSpeaker():
raise IOError("I'm sorry, I can't do that, Dave.")
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 19/08/21 3:59 am, joseph pareti wrote:
Another question is on this line:
z = add((x, y))
If I code:
z = add(x, y)
Then the following exception occurs :
*Expected input to be a tuple or list; instead got .*
What exactly is your question? Does add((x, y)) not do what you
want? If not, you'll
On 21/08/21 6:15 am, Hope Rouselle wrote:
code()
'def p():\n import math\n return math.e\n'
exec(code())
p
p()
2.718281828459045
Note that this pollutes the globals of the module that you're calling
exec() from. For better isolation you can pass in an explicit globals
dict:
g = {}
exec
On 21/08/21 1:36 pm, Hope Rouselle wrote:
I wish I could restrict their syntax too, though,
but I fear that's not possible. For instance, it would be very useful
if I could remove loops.
Actually you could, using ast.parse to get an AST and then walk
it looking for things you don't want to all
On 3/09/21 8:11 pm, Christian Gollwitzer wrote:
Unless you have special numbers like NaN or signed zeros etc., a+b=b+a
and a*b=b*a holds also for floats.
The only exception I'm aware of is for NaNs, and it's kind of pendantic:
you can't say that x + NaN == NaN + x, but only because NaNs never
c
On 5/09/21 2:42 am, Hope Rouselle wrote:
Here's what I did on this case. The REPL is telling me that
7.23 = 2035064081618043/281474976710656
If 7.23 were exactly representable, you would have got
723/1000.
Contrast this with something that *is* exactly representable:
>>> 7.875.as_integer
On 7/09/21 11:38 am, Avi Gross wrote:
#define INDEFINITELY_LOOP while (true)
So, how to do something like that in python, is a challenge left to the user 😉
def hell_frozen_over():
return False
while not hell_frozen_over():
--
Greg
--
https://mail.python.org/mailman/listinfo/py
On 8/09/21 2:53 am, Grant Edwards wrote:
#define IF if (
#define THEN ) {
#define ELSE } else {
#define ENDIF }
...
I gather that early versions of some of the Unix utilities were
written by someone who liked using macros to make C resemble Algol.
I guess you can get away with t
On 10/09/21 11:47 am, Terry Reedy wrote:
2. It is rare useful. For loops are common. While loops are occasional
(nearly an order of magnitude less common than for loops. Fractional
loop constructs are rare.
I would say that fractional loops are more common than loops
which truly need to exe
On 10/09/21 6:11 pm, Roland Mueller wrote:
When I call print(s) it even shows ABCD and D is underscored. But copying
the output to mail looses the underscore ...
If the terminal understands unicode, Combining Low Line: U+0332
might help
--
Greg
--
https://mail.python.org/mailman/listinfo/pyth
On 16/09/21 4:23 am, Mostowski Collapse wrote:
I really wonder why my Python implementation
is a factor 40 slower than my JavaScript implementation.
There are Javascript implementations around nowadays that are
blazingly fast. Partly that's because a lot of effort has been
put into them, but it
On 16/09/21 2:56 pm, Mostowski Collapse wrote:
I can access the functor of a compound via:
obj.functor
but when I flatten Compound into arrays, it would become:
obj[0]
Should I declare a constant FUNCTOR = 0?
You could, but keep in mind that access to a global in Python
is somew
On 16/09/21 6:56 am, Mostowski Collapse wrote:
What could be slow, repeatedly requesting the "args"
field. Maybe I should do:
help = term.args
i = 0
while i < len(help) - 1:
mark_term(help[i])
i += 1
term = help[i]
Yes, that will certainly help.
But you're still evaluating len(help) -
On 17/09/21 7:56 am, Mostowski Collapse wrote:
The trail in Dogelog
Runtime is a single linked list:
-->[ A ]-->[ B ]-->[ C ]-->
Now if B becomes unused, you need to rewire
the trail, it should then look like:
-->[ A ]-->[ C ]-->
Python has a way of creating weak references
On 17/09/21 8:41 pm, Mostowski Collapse wrote:
Are exceptions
blocks in Python cheap or expensive? Are they like
in Java, some code annotation, or like in Go
programming language pushing some panic handler?
They're not free, but they're not hugely expensive either.
Don't be afraid to use them w
On 16/09/21 6:13 am, Mostowski Collapse wrote:
So in Python I now do the following:
peek = kb.get(functor, NotImplemented)
if peek is not NotImplemented:
If you're able to use None instead of NotImplemented, you
could simplify that to
peek = kb.get(functor)
if peek:
..
On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse wrote:
On the other hand if I would use the trigger
from Python, I possibly would need a double linked
list, to remove an element.
Here's another idea: Put weak references in the trail, but
don't bother with the scanning -- just skip over dea
On 24/09/21 5:48 pm, Robert Latest wrote:
Never use mutable types in type hint,
No, the lesson is: Don't mutate a shared object if you don't want
the changes to be shared.
If you want each instance to have its own set object, you need to
create one for it in the __init__ method, e.g.
class Fo
On 25/09/21 10:15 am, Steve Keller wrote:
BTW, I like how the min() and max() functions allow both ways of being
called.
That wouldn't work for set.union and set.intersection, because as
was pointed out, they're actually methods, so set.union(some_seq)
is a type error:
>>> a = {1, 2}
>>> b = {
On 25/09/21 6:29 am, Peter J. Holzer wrote:
don't forget that
XML was intended to replace SGML, and that SGML was intended to mark up
text, not represent any data.
And for me this is the number one reason why XML is the wrong
tool for almost everything it's used for nowadays.
It's bizarre. It'
On 25/09/21 6:34 am, Peter J. Holzer wrote:
Several hundred genes were recently renamed because Excel was unable to
read their names as simply strings and insisted on interpreting them as
something else (e.g. dates).
Another fun one I've come across is interpreting phone numbers
as floating poi
On 25/09/21 10:51 am, dn wrote:
XML: Originally invented for text markup, and that shows. Can represent
different types (via tags), can define those types (via DTD and/or
schemas), can identify schemas in a globally-unique way and you can mix
them all in a single document (and there are tools ava
On 25/09/21 11:00 am, Chris Angelico wrote:
On Sat, Sep 25, 2021 at 8:53 AM dn via Python-list
wrote:
and YAML?
Invented because there weren't enough markup languages, so we needed another?
There were *too many* markup languages, so we invented another!
--
Greg
--
https://mail.python.org/
On 29/09/21 4:37 am, Michael F. Stemper wrote:
I'm talking about something made
from tons of iron and copper that is oil-filled and rotates at 1800 rpm.
To avoid confusion, we should rename them "electricity comprehensions".
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 29/09/21 12:21 pm, Chris Angelico wrote:
to the extent that you automatically read 65 and 0x41 as the same
number.
Am I too geeky for reading both of them as 'A'?
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 29/09/21 3:03 pm, 2qdxy4rzwzuui...@potatochowder.com wrote:
Who thinks in little
endian? (I was raised on 6502s and 680XX CPUs; 8080s and Z80s always
did things backwards.)
The first CPU I wrote code for was a National SC/MP, which doesn't
have an endianness, since it never deals with more
On 30/09/21 7:28 am, dn wrote:
Oh yes! The D2 kit - I kept those books for years...
https://www.electronixandmore.com/adam/temp/6800trainer/mek6800d2.html
My 6800 system was nowhere near as fancy as that! It was the
result of replacing the CPU in my homebrew Miniscamp.
--
Greg
--
https://mai
On 23/10/21 8:49 am, dn wrote:
Whereas, creating a list (or tuple...) is legal because the structure's
name is an "identifier"!
No, the restriction only applies to the LHS. The list construction
is on the RHS.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 29/10/21 11:34 am, Chris Angelico wrote:
On Fri, Oct 29, 2021 at 7:31 AM Mostowski Collapse wrote:
QA engineer walks into a bar. Orders a beer. Orders 0 beers.
Orders 9 beers. Orders a lizard. Orders -1 beers.
Orders a sfdeljknesv.
Orders 1 пиво and is served a пиво. QA engin
On 13/11/21 10:51 am, Abdur-Rahmaan Janhangeer wrote:
ow do i get the path from
which miaw the command is called from?
What exactly do you mean by "called from"?
If you want the user's working directory, os.getcwd() will
give you that.
If you want something else, you'll have to give us more
d
On 13/11/21 7:23 pm, Abdur-Rahmaan Janhangeer wrote:
os.getcwd is giving the path of site-packages and not
the directory from
which the command is run from.
Something must be changing the working directory before getcwd
is called. Once that happens there's no way I know of to find
out what it w
On 21/11/21 2:18 pm, Grant Edwards wrote:
My recollection is that it was quite common back in the days before FP
hardware was "a thing" on small computers. CPM and DOS compilers for
various languages often gave the user a choice between binary FP and
decimal (BCD) FP.
It's also very common for
On 22/11/21 4:58 am, Grant Edwards wrote:
Yep, IIRC, it was a 4 bit processor because 4 bits is what it takes to
represent one decimal digit.
That was the Saturn, first used in the HP-71B. The original
architecture (known as the "Nut")was weirder than that. It operated
serially on 56 bit words
On 2021-11-26 11:17 AM, Frank Millman wrote:
Are there any other techniques anyone can suggest, or is the only
alternative to use if...then...else to cater for y = 0?
x[:-y or None]
Seems to work:
>>> l
['a', 'b', 'c', 'd', 'e']
>>> def f(x): return l[:-x or None]
...
>>> f(3)
['a', 'b']
>>>
On 14/12/21 7:07 am, MRAB wrote:
It's difficult to say what the problem is when you haven't given us the
code!
Note: Attachments do not make it to this list.
You will need to insert the code into the message as text.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 13/12/21 8:25 pm, Cristiano Loro wrote:
In production I performed a custom installation defining "for all users", but the modules are placed elsewhere and this is perhaps the problem. How can I put the modules in the correct folder?
How are you installing the modules?
Are you doing it with
On 14/01/22 12:23 pm, dn wrote:
On 14/01/2022 09.48, Dennis Lee Bieber wrote:
On Thu, 13 Jan 2022 15:22:50 -0500, Dennis Lee Bieber
declaimed the following:
Talking to myself in public again... Bad habit...
Recommend that you not start any arguments then
- they will be unwinnable!
On 17/01/22 4:18 am, Mats Wichmann wrote:
the convention for Excel, which is usually the reason
people are using csv, is you can enclose the entire comma-containing
field in "quote marks" (afaik it must be double-quote).
And to include a double quote in a field, quote the field and
double the d
On 20/01/22 12:09 am, Chris Angelico wrote:
At this point, the refcount has indeed been increased.
return self;
}
And then you say "my return value is this object".
So you're incrementing the refcount, then returning it without
incrementing the refcount. Your code is actually
The convention for refcounting in CPython is that a function
takes borrowed references as arguments and returns a new
reference.
The 'self' argument passed in is a borrowed reference. If you
want to return it, you need to create a new reference by
increfing it.
So what you have written is just t
On 4/02/22 5:07 am, Albert-Jan Roskam wrote:
On Feb 3, 2022 17:01, Dan Stromberg wrote:
What profiler do you recommend
If it runs for that long, just measuring execution time should
be enough. Python comes with a "timeit" module to help with
that, or you can use whatever your OS provi
On 8/02/22 8:51 am, Chris Angelico wrote:
Some day, we'll have people on Mars. They won't have TCP connections -
at least, not unless servers start supporting connection timeouts
measured in minutes or hours - but it wouldn't surprise me if some
sort of caching proxy system is deployed.
Or the
On 21/02/22 6:27 am, Abdur-Rahmaan Janhangeer wrote:
Well Python deliberately throws an exception if we do not
pass in a function name. Just wanted to know why it should. As the
above case is a 100% pure anonymous function.
The syntax for a function definition is defined in the grammar
as requi
On 25/02/22 1:08 am, Robert Latest wrote:
My question is: Is this a solid approach? Am I forgetting something?
I can see a few of problems:
* If more than one thread calls get_data() during the initial
cache filling, it looks like only one of them will wait for
the thread -- the others will sk
On 26/02/22 11:22 am, Chris Angelico wrote:
What's the best language for swearing in? Ah, that one I can't help
you with, although I've heard good things about French. :)
Russian seems to be quite good for it too, judging by
certain dashcam footage channels.
--
Greg
--
https://mail.python.org/
On 1/03/22 6:13 am, Albert-Jan Roskam wrote:
I think you need a
BLOB.
https://docs.sqlalchemy.org/en/14/core/type_basics.html#sqlalchemy.types.LargeBinary
That won't help on its own, since you still need to choose a
serialisation format to store in the blob.
I'd be inclined to use JSO
On 4/03/22 1:55 pm, Chris Angelico wrote:
It's much better to treat arguments as a vector of strings
rather than a single string, as the start command tries to.
It would be nice if you could, but as I understand it, Windows always
passes arguments to a program as a single string, and then it's
On 7/03/22 9:36 am, Martin Di Paola wrote:
It *would* be my fault if multiprocessing.Process fails only because I'm
loading the code dynamically.
I'm not so sure about that. The author of the plugin knows they're
writing code that will be dynamically loaded, and can therefore
expect the kind of
On 16/03/22 2:20 am, Les wrote:
I tried to subscribe (twice), but never got the confirmation
email. Checked in the spam folder too, but it is nowhere to be found.
Is there any chance your email provider has some kind of quarantine
system separate from your spam folder?
The University of Canter
On 16/03/22 6:58 pm, Chris Angelico wrote:
And Python's own integers hash to themselves,
> which isn't what I'd call "widely distributed", but which
> works well in practice.
Not exactly, they seem to be limited to 60 bits:
>>> hex(hash(0xfff))
'0xfff'
>>> hex(hash(0x1f
On 19/03/22 9:40 am, Rathmann wrote:
The other challenge/question would be to see if there is a way to implement
this basic approach with lower overhead.
My original implementation of yield-from didn't have this problem,
because it didn't enter any of the intermediate frames -- it just
ran down
On 23/03/22 7:00 am, Avi Gross wrote:
But are there costs or even errors
if you approach an inner part of an object directly? Can there be dunder
methods not
invoked that would be from the standard approach? What kind of inadvertent
errors can creep in?
The attribute could be a property that r
On 23/03/22 11:44 am, Rathmann wrote:
So that sounds like the original CPython implementation had an
O(depth) component, but with a lower constant factor than the current
version?
Yes, but so much lower that I would expect it to be unmeasurable.
--
Greg
--
https://mail.python.org/mailman/list
On 12/04/22 2:28 am, Peter Pearson wrote:
By looping over elements in "books" and incrementing counter i,
which is used as an index both for "books" and for "students",
you will produce an error whenever the number of books exceeds
the number of students.
More fundamentally, it assumes there is
On 15/04/22 10:51 pm, Alan Gauld wrote:
Does anyone know how to launch a Python program from the
desktop without a Terminal window (or at least with an
iconified one!) Does it require Applescript or somesuch?
The easiest and most reliable way is probably to use Automator
with a Run Shell Script
Paul St George wrote:
I had considered meddling with the config.txt to try to enable*
HWSURFACE but from what you say, this is unnecessary.
I don't really have much idea what effect HWSURFACE would have,
if any. It will certainly depend a lot on your hardware and
drivers.
My suggestion would b
On 18/11/19 9:30 am, Dave Cinege wrote:
The few times I looked at CSV module it never looked useful to me. I
seem to use shlex for everything. For example:
def csv_split (s):
lex = shlex.shlex(s, posix=True)
lex.whitespace_split = True
lex.whitespace = ','
return list(lex)
On 27/11/19 10:54 am, Mr. Gentooer wrote:
why would I be a troll? I have never used usenet. I am honestly and
genuinely curious.
The reason people are asking is that wanting a manual on how to
search the Web is a bit like wanting a manual on how to walk.
Most people pick it up by watching othe
On 9/12/19 7:47 am, RobH wrote:
I wanted it to work as is, like it
did for the author, without changing anything.
So why should I now start to learn how python works.
There are many, many reasons a piece of code could work in one
environment but not another. Figuring out why requires actual
u
On 9/12/19 7:46 am, Dennis Lee Bieber wrote:
Minecraftia appears to be a monospaced font meant to look like the
character set of old 8-bit gaming systems from the 80s.
From the name, it's probably mean to resemble the font in
Minecraft. As used in the game it's not actually monospaced,
On 8/12/19 9:30 pm, songbird wrote:
wouldn't it make more sense to just go back and fix the
converter program than to have to manually convert all this
python2 code?
Anything that isn't already fixed by 2to3 is probably
somewhere between very difficult and impossible to fix
using an automate
On 9/12/19 6:28 am, R.Wieser wrote:
Are you sure there's a difference between classes and functions here?
Yes, quite sure.
And we're even more sure that there isn't. :-) Try it with
a test module containing a class definition, a function
definition and some top-level code that does somethin
On 9/12/19 9:15 pm, R.Wieser wrote:
To be honest, I was not aware/did not assume that I could delete a class
definition that way (I even find it a bit weird, but as I'm a newbie in
regard to Python that does not say much).
Python is very dynamic. The class statement is actually an executable
st
On 10/12/19 9:45 pm, R.Wieser wrote:
In my case deleting the instance was needed to release its hold on something
that was taken when the instance was initialised (in my case a GPIO pin on a
Raspberry Pi). I did not even think of garbage collection.
In that case, it was only working by accid
On 11/12/19 7:47 am, R.Wieser wrote:
what happens when the reference becomes zero: is the __del__
method called directly (as I find logical), or is it only called when the
garbage collector actually removes the instance from memory (which Chris
thinks what happens) ?
In CPython, these are the s
On 12/12/19 3:50 am, R.Wieser wrote:
I was rather clear about what my used version of Python was-and-is. I have
no idea why that was ignored. :-(
I think we've all been talking at cross purposes for a while.
What I meant to say originally was that you were relying on
an implementation detail
On 12/12/19 2:17 pm, Python wrote:
I was very impressed back in the day when the
with statement and context manager protocol appeared in
Python. I've always wondered from what language(s) it was
borrowed from
It was partly inspired by the RAII pattern often used
in C++, but as far as I know, al
On 14/12/19 5:13 pm, boB Stepp wrote:
is it true that CPython itself is free to
implement these behaviors differently in its own future versions?
Yes. That's why it's not a good idea to rely on them even
if you only intend to run your code on CPython.
--
Greg
--
https://mail.python.org/mailman
On 20/12/19 2:16 am, Lele Gaifax wrote:
My first approach has been duplicating the Extension() entry in the
setup.py(*), changing the first argument (that is, the name of the module).
Although that did produce the alternative binary module, it could not be
loaded because it contains the wrong PyI
On 21/12/19 1:59 am, Stefan Ram wrote:
I would like to add a method to a string.
This is not possible in Python?
It's not possible. Built-in classes can't have methods added
to them.
You can define your own subclass of str and give it whatever
methods you want.
But in your case:
for
On 29/12/19 11:35 am, DL Neil wrote:
if our mythical collection of
module-functions has an internal-reference, eg b() requires a(), then
function a() MUST exist, ie be defined, 'before' function b().
Not true in Python -- a() must exist by the time b() is run,
but they can be written in the fi
On 29/12/19 11:49 am, Chris Angelico wrote:
"Define before use" is a broad principle that I try to follow, even
when the code itself doesn't mandate this.
I tend to do this too, although it's probably just a habit
carried over from languages such as Pascal and C where you
have to go out of your
On 31/12/19 3:47 am, Barry Scott wrote:
"define before use" is basically email top-posting for code isn't it?
It means that the first things that you read in a module are the least
interesting.
That's not a big problem for top-level code, since you can easily
scroll down to the bottom of the
It looks like what the OP is after already exists:
https://docs.python.org/3/library/zipapp.html
"This module provides tools to manage the creation of zip files
containing Python code, which can be executed directly by the Python
interpreter."
--
Greg
--
https://mail.python.org/mailman/list
On 4/01/20 5:41 am, Alan Bawden wrote:
So I was looking for a predefined object from the standard
library that already /is/ an iterator (with no need to use
»iter«).
Why are you so intent on introducing either next() or iter() to
beginning students? I'd have thought they were somewhat
On 3/01/20 3:31 pm, Abdur-Rahmaan Janhangeer wrote:
But, this proposal is not about native executables. It's about a .jar like
executable.
You can pass a zip file with a .pyz extension to the python
interpreter and it will look for a __main__.py file and run
it.
That seems to give you all th
On 17/01/20 11:12 am, Random832 wrote:
pure-python types that derive from int place __dict__ at the end of
the object, I don't know if it's possible for you to do the same with
the fields you intend to add (for some reason it isn't done with
__slots__), but if all else fails you could do the sam
On 16/01/20 10:06 pm, Muju's message wrote:
“IDLE cannot bind to a TCP/IP port, which is necessary to communicate
with its Python execution server. This might be because no networking
is installed on this computer.
There might be firewall settings or anti-virus software preventing
the port fro
On 21/01/20 6:57 pm, mus...@posteo.org wrote:
If I start with empty global and
local dicts, and an empty __builtins__, and I screen the input string
so it can't contain the string "import", is it still possible to have
"targeted" malicious attacks?
Yes.
Python 3.7.3 (default, Apr 8 2019, 22:2
On 27/01/20 4:15 am, ferzan saglam wrote:
for x in range ( 0, 10):
stars = 'x'
count = 0
By the way, this 'for' loop is unnecessary. The end result is just to
give initial values to three names. You don't need a loop at all for
that, just three assignment statements.
On 29/01/20 6:27 pm, Peng Yu wrote:
Suppose that I use this to read from stdin. But `line` contains
decoded data in python 3. In python 2, it contains the original data.
What is the best way to get the original data in python 3?
Read from stdin.buffer, which is a stream of bytes.
--
Greg
--
ht
On 3/02/20 3:38 am, Stefan Ram wrote:
void( ( print( 2 ), print( 3 )))
If the functions you're calling all return None, you can
do this:
>>> print(2); print(3)
2
3
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 21/02/20 7:59 pm, Frank Millman wrote:
My first attempt was to create a background task for each session which
runs for the life-time of the session, and 'awaits' its queue. It works,
but I was concerned about having a lot a background tasks active at the
same time.
The whole point of asyn
On 26/02/20 4:06 am, BlindAnagram wrote:
My interest in this stems from wanting to keep the dictionary only
available to the function that uses it and also a worry about being
called from threaded code.
Doing this won't make any difference to the way threaded code behaves.
Threading problems ne
On 26/02/20 3:56 am, BlindAnagram wrote:
Does that not have the advantage of preventing the global
directory being directly fiddled with elsewhere?
That depends on what you mean by "prevent". There is nothing
to stop any code from directly accessing the .seen attribute
of the class.
It might m
On 4/03/20 12:52 pm, Marco Sulla wrote:
Why can't an asynchronous coroutine be simply a coroutine that has an
`async` or an `await` in its code, without `async` in the signature?
That wouldn't help as much as you seem to think. You still need
to use 'await' whenever you call a coroutine, so swi
101 - 200 of 484 matches
Mail list logo