ar problem,
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
v2
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.)
--
G
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
much 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 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! :-)
--
go out 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 n
sition, I think).
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
debated, but it wasn't a
bug or an accident.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
y 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.
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/mailma
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
e slightly more 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
d 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
hing fancy.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
impose additional delays
before the data actually gets written.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
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?
-
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
e 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
least 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
king there.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
7;re Dutch?)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
rasing something that the
user didn't type in.
--
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
yped before, without having to
import anything.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
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
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
u haven't initialised yet.
--
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
that?
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
t iterates
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
/stable/gallery/misc/hyperlinks_sgskip.html
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
rrive shortly.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
.
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
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
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
ld check 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://mai
st that 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
have to be disallowed, as it's
not at all clear what it should mean.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
o it would just be syntactic sugar, which is
harder to justify.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
ly an operation on strings, it doesn't look in the
file system.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
you 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
ult firewall settings 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
way to refer 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
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
rather than blindly trying to iterate over the result.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
rs in your ancestry.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
nch 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://ma
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
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 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/listi
, '=', value)
a = A()
a.x = 1
print('a.x =', a.x)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
alled, and returns that instance subsequently. The problem then
doesn't arise.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
poke 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.
--
umber 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
ve what the customer tells you."
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
cases, 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
se. That seems too much for my small head. 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 a
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
er:
def __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
't specify a metaclass.
I find it peculiar that you can give a function as metaclass.
Yes, it just calls whatever object you give it, which allows
for various fun things. You'd be risking a lynching if you took
advantage of it for anything important, though.:-)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
e can then be accessed 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
is can work for any number of 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
TONNE of examples, full 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
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
itself that's the problem,
but the fact that there's a *mutable container* containing that type.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
work too.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
last):
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
"unpacking" 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 as
x[i] < 10; 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
;t require variables 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
't ignored, 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
cal, Turbo Pascal, Delphi, 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
using regular expressions.
Although some might consider that this doesn't contradict
your statement about readability. :-)
--
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.
--
x27;t keep the Form alive after it's been closed.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
e how 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.pytho
f 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
idate)
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 usually 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
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
e-level name from
within a function, e.g.
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
set up 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
ere's usually just one executable file in there. Run that
from a shell and you should see anything written to stdout or stderr.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
.rollback()
Doing an explicit rollback ensures that the transaction is always
rolled back if it is interrupted for any reason.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 8/09/24 11:03 pm, Jon Ribbens wrote:
On 2024-09-08, Greg Ewing wrote:
try:
do something
.commit()
except:
log something
.rollback()
What if there's an exception in your exception handler? I'd put the
rollback in the 'finally' handler, s
tions are
caught and logged.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
he
> standard is to sync _everything_
Again I'm not sure what you mean here. It may be difficult for the
kernel to track down exactly what data is relevant to a particular file,
and so the kernel programmers take the easy way out and just implement
fsync() as sync(). But again tha
ad of collecting the
whole list first.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
eason it has to
lose data.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
written little
endian instead of big endian, but the same argument applies either
way.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
er in that respect.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
think.
BTW you have to be careful testing this, because the compiler sometimes
does constant folding, so you need to be sure it's actually computing
the numbers at run time.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
on found for first-package<2.0.0,>=1.6.0 (from
second-package==0.5.0)
What version number does first-package have?
The caret in the specification "^1.6.0" restricts it to 1.x.x versions.
If you don't want that restriction, use ">=" instead.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
are able to do things
that Python methods cannot.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 18/04/25 9:41 am, Mats Wichmann wrote:
There's just not a really great answer to this.
Seems to me a system-installed application shouldn't be looking in the
user's .local packages in the first place. That should only be for
things the user has installed "for t
On 12/05/25 3:21 am, Left Right wrote:
The point is that the error is wrong.
It cannot be a syntax error and at the same time the program compiles.
But the message doesn't say it's an error. It uses the word "warning",
not "error". You're tilting at a s
hat I said. Currently it's a warning. If and
when it becomes an error, presumably the grammar documentation will be
updated to reflect that. If it isn't, you'll have cause to complain, but
not before.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
o the
class dictionary as a /function/ (not as a string).
That's what he did, or at least that's what he tried to do.
It turns out the misplaced quote was the entire problem -- by a
fluke, it didn't result in a syntax error, and ended up putting
the __init__ function into the dict
1101 - 1198 of 1198 matches
Mail list logo