p a local server
You should also be able to download a .tar.gz from PyPI and use pip
to install that. Although you'll have to track down the dependencies
yourself in that case.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
.
spam = 17
def f():
global spam
spam = 42
f()
# spam is now 42
A script is a module, so everything that applies to modules also
applies to scripts.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 30/03/24 7:21 pm, HenHanna wrote:
https://xkcd.com/1306/
what does SIGIL mean?
I think its' a Perl term, referring to the $/@/# symbols in front of
identifiers.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
works. If you run out of memory, you
run a GC there and then. You don't have to wait for GCs to occur on
a time schedule.
Also, as a previous poster pointed out, GCs are typically scheduled
by number of allocations, not by time.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
)
for j, b in enumerate(answer)
)
)
This is not correct. score((1,1,1), (1,1,2)) gives (2,4). According to
the usual rules of Mastermind, it should be (2, 0).
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
it helps at all, you can think of an async function as being
very similar to a generator, and "await" as being very similar to
"yield from". In the current implementation they're almost exactly
the same thing underneath.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
weak references help here at all. If the transient
object goes away, all references from it to the permanent objects also
go away.
A weak reference would only be of use if the reference went the other
way, i.e. from the permanent object to the transient object.
--
Greg
--
https://mail.python.org
keep the Form alive after it's been closed.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 16/01/24 11:55 am, Mats Wichmann wrote:
Windows
natively has something called python.exe and python3.exe which is
interfering here
I'm wondering whether py.exe should be taught to recognise these stubs
and ignore them. This sounds like something that could trip a lot of
people up.
--
Greg
regular expressions.
Although some might consider that this doesn't contradict
your statement about readability. :-)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
, etc.
enjoyed a lot of popularity. A variant of UCSD was the main language
for Macintosh application development for a number of years.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
it appears in the grammar by means of
INDENT and DEDENT lexical tokens.
It's true that the meaning of these tokens is described informally
elsewhere, but that's true of all the lexical features.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
to
be declared separately from their use. But this is a very common
feature of dynamic languages generally. As language oddities go,
it hardly rates a mention.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
x[i]++)
printf("%d\n", x[i]);
}
Output:
0
1
2
3
4
5
6
7
8
9
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
g" in Python. I
don't know anything about Hyperspec, so I don't know what it means
there.
The fact that i was being printed inside the loop made me think
that some deeper level of surprise was being intended, such as
the value of i somehow getting changed by the assignment.
--
Greg
--
htt
File "", line 1, in
NameError: name 'i' is not defined
There's no destructuring going on here, just assignment to a
sequence item.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
too.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
at's the problem,
but the fact that there's a *mutable container* containing that type.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
has no way to be sure
of that.
You could try declaring it as a collections.Mapping, which is immutable.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
ull documentation and a number of
tutorials. The Sourceforge acts as the main help site, but there is also a
Discord site dedicated to help and support.
I sincerely hope this helps!
Greg Walters
--
*My memory check bounced*
Greg Walters
--
https://mail.python.org/mailman/listinfo/python-list
modules. You aren't limited to just two.
I hope this helps.
Greg
--
*My memory check bounced*
Greg Walters
--
https://mail.python.org/mailman/listinfo/python-list
ed by both scripts.
The biggest caveat is that the shared variable MUST exist before it can be
examined or used (not surprising).
I sincerely hope this helps.
Greg
--
*My memory check bounced*
Greg Walters
--
https://mail.python.org/mailman/listinfo/python-list
f __init__(self):
self.cm = device_open()
self.device = self.cm.__enter__()
# Other methods here for doing things with
# self.device
def close(self):
self.cm.__exit__(None, None, None)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 27/11/23 9:03 am, Stefan Ram wrote:
Above, "have" is followed by another verb in "have been",
so it should be eligible for a contraction there!
Yes, "been" is the past participle of 'to be", so "I've been" is
fine.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
ad. Can you help?
Well, there are inherently two cases, and they're different, so
I don't think you're doing anything wrong here. It was asymmetrical
to begin with. If you were doing it iteratively you would also be
leaving the accumulator alone when the exponent is even.
--
Greg
--
https://mai
, such as this one.
There are various ways you could work around this. I would suggest
moving the offending code outside the class and qualifying the
constants it uses with the class name.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
tomer tells you."
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
into
the landline field or vice versa and reject it, then it can figure out
whether it can text to a given numner or not without you having
to tell it!
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
values into RAM
to change its behaviour to some extent, and that got them out
of trouble a few times, but they couldn't patch the code.
It might have been possible with the Gemini computer, since
it loaded its code from tape. I don't know if it was ever
done, though.
--
Greg
--
https
, and returns that instance subsequently. The problem then
doesn't arise.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
)
a = A()
a.x = 1
print('a.x =', a.x)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 27/09/23 3:30 pm, Chris Roy-Smith wrote:
surely running a 64 bit version of python in a 23mbit version of windows
will cause significant problems!
23 millibits? I don't think you'd be able to run much at all
with that few bits! :-)
--
Greg
--
https://mail.python.org/mailman/listinfo/python
On 23/09/23 4:51 am, Stefan Ram wrote:
[]=[]
(Executes with no error.)
#
[]=[]
( 1 )
#\_/#
(Executes with no error.)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 23/08/23 2:45 am, Ian Pilcher wrote:
How can I programmatically get 'logging.Handler' from the class object?
Classes have a __module__ attribute:
>>> logging.Handler.__module__
'logging'
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
of the if. You need to ensure it's always defined. Here's
one way that should work:
gttran = _
def foobar(translate):
def _(txt):
if translate:
return gttran(txt)
else:
return txt
return _('Hello')
--
Greg
--
https://mail.python.org/mailman/listinfo
in your ancestry.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
rather than blindly trying to iterate over the result.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
I would question the wisdom of designing an API that
can return either a sequence or None. If it normally
returns a sequence, and there are no items to return,
it should return an empty sequence.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
to the
value that isn't just a bare name. One way would be to
define your constants using an enum:
class Options(Enum):
RANGE = "RANGE"
MANDATORY = "MANDATORY"
match stuff:
case Options.RANGE:
...
case Options.MANDATORY:
...
--
Greg
--
https://mail.python.
not letting you connect to a local
socket (nice one, Microsoft). I don't know whether that's still
an issue.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
would have to do in the face of inactive maintainers regardless
of where or how the project was hosted. This is not a github problem
or a big-corporation problem, it's a people problem.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
an operation on strings, it doesn't look in the
file system.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
just be syntactic sugar, which is
harder to justify.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
have to be disallowed, as it's
not at all clear what it should mean.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
at reversed()
itself should return a sequence view rather than an iterator.
That would require restricting it to working on sequences,
which would be an incompatible change.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
for it earlier, but there's still the possibility
of a race condition -- someone could delete the folder and replace
it with a file in the meantime. Or just delete it and not replace
it with anything. So you need to be prepared to deal with failures
at any point.
--
Greg
--
https://mail.python.org/mailman
into a package named after the script, e.g. put the local
modules used by foo.py into a package called foolib.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
How are you invoking your script? Presumably you have some code
in your embedding application that takes a script path and runs
it. Instead of putting the code to update sys.path into every
script, the embedding application could do it before running
the script.
--
Greg
--
https
.
There are Clifford algebras, Lie algebras, ...
Not sure what any of those should do to strings, though. :-)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
shortly.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
/stable/gallery/misc/hyperlinks_sgskip.html
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
over it. Hopefully that would be implemented in a thread-safe
way (although the docs don't currently promise that).
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
that?
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
, and open() is a function again
that builds the appropriate combination of underlying
objects.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 10/03/23 4:00 pm, 2qdxy4rzwzuui...@potatochowder.com wrote:
My ~/.pythonrc contains the following:
import readline
import rlcompleter
readline.parse_and_bind( 'tab: complete' )
I don't have a ~/.pythonrc, so that's not what's doing it
for me.
--
Greg
--
https
On 10/03/23 2:57 pm, Chris Angelico wrote:
import sys; "readline" in sys.modules
Is it?
Yes, it is -- but only when using the repl!
If I put that in a script, I get False.
My current theory is that it gets pre-imported when using
Python interactively because the repl itself uses it
e, without having to
import anything.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 10/03/23 12:43 pm, Grant Edwards wrote:
When a computer dies, I
generally just cp -a (or rsync -a) $HOME to a new one.
Same here, more or less. My current machine has multiple
archaeological layers going back about 5 generations of
technology...
--
Greg
--
https://mail.python.org/mailman
hing that the
user didn't type in.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
?)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
there.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
parttly inspired by functional languages
such as Haskell. Haskell has always allowed indentation as one way of
expressing structure. Python wasn't the first language to use
indentation semantically.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
o be a lot of
overlap between entries containing "V" and entries containing "6",
so you end up searching the same data multiple times.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 7/03/23 4:35 am, Weatherby,Gerard wrote:
If mailing space is a consideration, we could all help by keeping our replies
short and to the point.
Indeed. A thread or two of untrimmed quoted messages is probably
more data than Dino posted!
--
Greg
--
https://mail.python.org/mailman/listinfo
On 6/03/23 11:43 am, Stefan Ram wrote:
A user tries to chop of sections from a string,
but does not use "split" because the separator might become
more complicated so that a regular expression will be required
to find it.
What's wrong with re.split() in that case?
--
Gre
impose additional delays
before the data actually gets written.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
watch out for horcruxes during code
reviews.
I'll note that he was fluent in Parseltongue, which is not a good
sign.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
efficient, as it avoids a
global lookup and a function call. But as always, measurement
would be required to be sure.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 2/03/23 10:59 am, gene heskett wrote:
Human skin always has the same color
Um... no?
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 28/02/23 4:24 pm, Hen Hanna wrote:
is it poss. to peek at the Python-list's messages
without joining ?
It's mirrored to the comp.lang.python usenet group, or
you can read it through gmane with a news client.
--
Greg
--
https://mail.python.org/mailman/listinfo
they are easier to type.
I tend to use the convention of double quotes for strings seen
by the outside world, and single quotes for internal constants
(such as enumerated types that happen to be represented by
strings).
I guess this means I can't use Black. :-(
--
Greg
--
https://mail.python.org
be debated, but it wasn't a
bug or an accident.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
).
The semantics of list comprehensions was originally defined
in terms of nested for loops. A consequence was that the loop
variables ended up in the local scope just as with ordinary for
loops. Later it was decided to change that.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
of their way to read the tutor list -- something that
is not of personal benefit to them.
Also, pointing people towards tutor lists, if not done carefully,
can give the impression of saying "newcomers are not welcome here".
That's not a message we want to send to Python newcomers at all
On 24/02/23 9:26 am, avi.e.gr...@gmail.com wrote:
Python One-Liners: Write Concise, Eloquent Python Like a Professional
Illustrated Edition
by Christian Mayer (Author)
I didn't know there were any Professional Illustrated Editions
writing Pythom. You learn something every day! :-)
--
Greg
better than an interpreter.
There are some similarities between Python and Lisp-family
languages, but really Python is its own thing.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
. :-)
On the other hand, if they really want to, they will still
be able to abuse semicolons by doing this sort of thing:
a = 5; pass
b = 7; pass
c = a * b; pass
Then everyone will know it's some really serious code!
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
the term [call by name] suggests this should be possible.
But Python doesn't use call-by-name or anything remotely like it.
(Even if it did, the word "name" in that context doesn't mean
what it sounds like it means. The Algol docs used some words in
weird ways.)
--
Greg
--
https://mail.
,
since 1/3 isn't exactly representable in decimal either.
To avoid it you would need to use an algorithm that computes nth
roots directly rather than raising to the power 1/n.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
For a moment I thought this was going to be a script that
uses ChatGPT to generate a random news post and post it
to Usenet...
Which would also have been kind of cool, as long as it wasn't
overused.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
of it, and that was something he saw his colleagues failing to do.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
devoted to each
fruit, but only ever one crate of fruit in each aisle, one would think
they could make better use of their shelf space.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
hardware, you don't have to budget for replacing it. But you can't
expect third party software to be maintained forever -- particularly
when, as with Python, the maintenance is mainly being done by
*volunteers*.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
the original copyright notice as requested, maybe with a "based on
work by..." attribution.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
.7 to make
it easier to write code that would work in both versions.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
roblem.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
e suddenly cease to execute.
No, but it was decided that Python 3 would have to be backwards
incompatible, mainly to sort out the Unicode mess. Given that,
the opportunity was taken to clean up some other mistakes as well.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
syntax in the language.
Functions don't need to return things to justify their existence,
and in fact the usual convention is that functions whose purpose
is to have an effect just return None.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
l go
wrong 255 times out of 256.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
the argument out of
argv directly.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
that are *very* frequently
referenced. Use full unabbreviated names for everything else.
* Don't 'import foo as foo', just 'import foo'.
* Don't try to line the code up in columns, it doesn't really
help readability IMO.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
, it will be very fast. If
it has to fall back on a linear search, it probably won't be
significantly faster than your existing Python implementation.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
* sizeof(int));
arr1[0] = 10;
arr1[1] = 11;
arr1[2] = 12;
Does that help your understanding?
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
and non-mutating methods, and
to help catch mistakes resulting from mixing them up.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
t;> dtdm * (1/1000 - 10/1000)
3.4004053539917275e-28
which agrees with your Decimal calculation to 3 digits,
and should be as precise as the input numbers (about
4 digits in this case).
This is a good example of why it's important to choose
an appropriate numerical algorithm!
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
.
If you can post some code we might be able to help you further.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
hat's what linters are for. I wouldn't
like the core interpreter to be producing a bunch of warnings
for things like this.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 14/11/22 1:31 pm, Jon Ribbens wrote:
On 2022-11-13, DFS wrote:
But why is it allowed in the first place?
Because it's an expression, and you're allowed to execute expressions.
To put it a bit more clearly, you're allowed to evaluate
an expression and ignore the result.
--
Greg
1 - 100 of 1560 matches
Mail list logo