u have to ask, is it really
worth performing this optimisation? The overhead of raising and
handling the exception is likely to completely swamp that of
executing the original code.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.
Craig Citro wrote:
Ok, I'm obviously being silly here, but sure you can:
dis.dis("raise TypeError()")
If producing different bytecode were considered a reason
against performing an optimisation, then no code optimisations
would be permissible a
pt Exception, e:
...
Usually this kind of thing is only done in test code or
illustrative snippets, but even so, it should work as
expected.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Uns
ving it refuse to
compile would be annoying in that case.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
peculating whether a 1-byte build
might be of further advantage in a few specialised cases.
No matter how much RAM or processing speed you have, it's always
possible to find an application that stresses the limits.
--
Greg
___
Python-Dev mailing
ed
this too, so perhaps it could be made more prominent.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
el scripts with
some extension *other* than .py?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
which can't be
done if they're in different tabs of the same window.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev
ow to another. My perceptions may be
coloured a bit from using Crimson Editor on Windows, where
you only get *one* top-level window that you can use either
in tabbed or MDI mode. :-(
I do use xemacs on linux, and with the ability to display
any buffer in any window at will, it's fine
ts parents
exist" is very commonly required, e.g. when installing software.
It makes sense to have it easily available.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://m
Ray Allen wrote:
I think both os.mkdir() and
os.makedirs() should add a keyword argument to suppress the "OSError:
[Errno 17] File exists".
This could be seen as violating the "no constant arguments"
guideline. Maybe separate function would
page says this about signal(3) in the ERRORS section:
[EINVAL] An attempt is made to ignore or supply a handler for
SIGKILL or SIGSTOP.
Not sure why it gets reported as a RuntimeError rather
than an OSError, though.
--
ts would always
be a constant that chooses between two or more different
behaviours, then it would probably be better to have
separate functions for each of the behaviours.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mai
eems suboptimal to require people to use a
recipe like this to get the behaviour that is wanted
in the overwhelming majority of cases.
I don't see what would be so bad about adding a new
function for this. Think of it as correcting the mistake
of not making makedirs() behave this way from the
with on Windows. Am I
worrying too much?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
de that special-cases SIGKILL
in the implementation of signal(). Although he
didn't express the question all that clearly, so
it's hard to tell.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/pyth
recently?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
On 23/07/10 04:24, gregory.smi...@sympatico.ca wrote:
I've suggested :name, which doesn't break old code,
I'm not so sure about that. Consider
foo[a::b]
Do you parse that as a 3-element slice, or as a
2-element slice with :b as the second el
the
time, even by Guido himself, and he eventually came around
to the view that treating generator returns specially wasn't
worth the trouble.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/pytho
C library
wherever reasonable, its lack would seem a bit odd.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
from my
Python code.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
aracterish stuff or just raw data. It wouldn't affect the
behaviour in any way except that the repr would come out in
hex instead of text.
Then b"..." and h"..." literals could produce bytes objects
with different settings for the raw-data bit.
--
Greg
___
Hrvoje Niksic wrote:
mktree would only create a
single "branch", not an entire tree.
Maybe mkbranch, then?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscr
;d be upset if I could no longer write
games in Python that achieve smooth animation because of
unpredictable GC pauses.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
ke it special,
and broke their code, which is within the rules as you
just stated them. The rule doesn't say anything about what
*kinds* of breakage are allowed, so anything goes, including
making it impossible to assign to the name any more.
--
Greg
__
gt;> next(gi)
1
>>> gi.close()
Traceback (most recent call last):
File "", line 3, in g
GeneratorExit
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "", line 5, in g
ValueErr
andling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 4, in
RuntimeError: Ooops
That's a bit different, because the fact that the program
was terminated by Ctrl-C could be useful information.
--
Greg
_
try:
yield 1
finally:
raise ValueError("Hovercraft contains eels")
except Exception:
tb.print_exc()
gi = g()
next(gi)
del gi
--
Greg
def g():
... try: yield 1
... finally: 1/0
...
gi = g()
next(gi)
1
del gi
Excepti
Nick Coghlan wrote:
A toy example,
that isn't obviously broken at first glance, but in fact fails when
close() is called:
Okay, you've convinced me. I'll consider it to be correct
behaviour and update my expected yield-from test results
accord
ython/yield-from/
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
out losing the user's preferences from the previous
version.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
them is good.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
any system that's "just like Windows"
except that it uses something other than colons.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/o
Barry Warsaw wrote:
Wait. It's a joke?!
Probably, but it's also useful behaviour -- I hope
it stays!
(Not that I would ever presume to use it in any
code inflicted on anyone else, but it's nice to
know I have a choice in the privacy of my own
computer.)
Heil-the
re,
because it suggests a contiguous range of legal values, which
isn't the case.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
in incompatible
ways with every release, the result is that extensions for
versions of Python older than N years can no longer be compiled
with any legally-available free MS compiler.
If you're talking about pragmatism, I think this situation
causes very pragmat
e how this can happen, because
pgen seems to use the same tokenizing code as Python itself.
Is there anything else I need to do? Does some file need
to be manually re-made?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.pyt
omatically just from
seeing a '?' in the grammar.
I just tried an experiment -- I changed the grammar to accept
'?' as an alternative to '+', and tried to use the parser
module to parse "1?2". It reported a SyntaxError.
--
Greg
__
id indeed not work.
Does anyone know if there's a way to tell Apple's linker to
use a framework from a specific location and not go looking
anywhere else?
In the meantime, I think I'll switch to a non-framework
build for this project.
--
Greg
__
), s)
sys.path.append(s)
However, it doesn't always work, because distutils.util.get_platform
tries to find a Makefile in the install location, which
doesn't exist if the Python you're building has never been
installed!
--
Greg
___
Python-Dev
as, it would be good to have a mingw-based alternative.
Otherwise everyone is forced to convert to the Windows religion.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://
>>> ast.dump(t)
"Expression(body=Subscript(value=Name(id='x', ctx=Load()),
slice=Slice(lower=None, upper=None, step=Name(id='None', ctx=Load())), ctx=Load()))"
In other words,
x[::]
is being parsed as though it had been writte
doesn't seem to significantly simplify the compiler
either, because compiler_slice() could just as easily
treat it the same way as the other slice arguments and
emit an instruction to load None if it's missing.
So it's a mystery. Perhaps it made life easier for some
earlier ver
its own special method.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
some people may want.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
s
in order to just return a value!
Even with your proposal, you'd still have to use a 'creepy
abstraction' every time one of your coroutines calls another.
That's why PEP 380 deals with 'more than just return'.
--
Greg
_
t; extra zero too!
But if I add another zero, it begins to slow to a crawl as it uses swap
space. ;-)
How would a "yield from" version compare?
... there is still a Python frame in existence for each
active invocation of the generator, so it would probably
us
ake a FILE* directly in the
first place.
Maybe PyObject_Print should be deprecated in favour of
something that takes a Python I/O object instead.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/
. For every Python function
that allocates something, there's a corresponding function
for freeing it, and you do it any other way at your peril.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/
On 02/09/10 09:04, Nick Coghlan wrote:
I think it would be better if everything dealing with FILE* was a
macro rather than a function, yes.
How would that help?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org
ou to that would be
prevented by making it read-only?
Seems to me that the only way you could exploit a writable
__builtins__ would be to put a function in there that does
something bad. But if you can create or obtain such a
function in the first place, you can just call it directly.
--
Robert Collins wrote:
__builtins__ is in everyone's global namespace, so if it can be
mutated, different python programs running in the same sandbox can
affect each other.
So give each program its own copy of __builtins__.
--
Greg
___
Pytho
x27;t follow. Trusted functions such as proxy() shouldn't
be sharing a __builtins__ dict with sandboxed code.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.
need to be isolated, each one
should run in its own sandbox with its own __builtins__ dict.
> should I create a new copy of __builtins__ for each
frame?
No, not for each frame, just for each computation that needs
to be isolated.
--
Greg
___
P
,
return it if found.
2) Look for a match ignoring case. If one is found, test it to
see if it refers to the same file as the given path, and if so
return it.
3) Otherwise, raise an exception.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
ht
ar problem in some ways.
It seems to me this whole thing should be hashed out on ‘python-ideas’.
Good point -- I've redirected the discussion there.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/list
lpath().
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
e they're guaranteed to return the
actual case rather than something that happens to work.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/o
in a paragraph?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Guido van Rossum wrote:
Now it is time to
withdraw the anti-recommendation.
Or at least re-word them all to make it clear that they're
talking about the *old* style of relative import in 2.x.
--
Greg
___
Python-Dev mailing list
Python-Dev@pytho
nable answer is that you should be able
to refer to it simply as 'mymodule'.
This may require treating it as a bit of a special case,
but it would make intuitive sense.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.pyth
efer some scheme involving 'python -m ...'
or some other option to Python itself, rather than a separate
executable.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http
remember
On Windows I think it's easier and more reliable to set things
up so that you can invoke a .py file directly as a command.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscri
equire
install-time path hacking of the sort that some people are uncomfortable
about.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
corresponding special method.
If that's the case, the appropriate place for initial
discussion would be python-ideas.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
as sorting that require a total ordering
could use __cmp__ and complain if they get an unordered
result.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mai
sually come with prefixes to manage C's totally-global
namespace. So there's a bit of a double bind there.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
ndant).
What about names imported from other modules that are used by
the module, but not intended for re-export? How would you
prevent them from turning up in help() etc. without using
__all__?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
-public
functions or something private that's accidentally been given
a non-underscore name.
Greg Ewing wrote:
Also it means that help() wouldn't show me documentation for
the support functions, which is a bad thing if they really are
intended for public use.
I don't see why... if you
.
The bool type was added for much the same reason -- otherwise
we would simply have gotten builtin names False = 0 and
True = 1.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
ht
Antoine Pitrou wrote:
Well, it's been inherited by C-like languages, no doubt. Like braces and
semicolumns :)
The idea isn't confined to the C family. Pascal and many of the
languages inspired by it also have enumerated types.
--
Greg
value assignment, seeing as it's another
common pattern.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
r.red
print(c)
printing "red" rather than "(255, 0, 0)".
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
#x27;s only in the C family
that you get this bastardised conflation of enumerations with
arbitrary named constants...
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.
ght
be the least worst option.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
opular and
well-reviewed application software.
"""
Maybe Python should have used UTF-8 as its internal unicode
representation. Then people who were foolish enough to assume
one character per string item would have their programs break
rather soon under only light
On 24/11/10 13:22, James Y Knight wrote:
Instead, provide bidirectional iterators which can traverse the string by byte,
codepoint, or by grapheme
Maybe it would be a good idea to add some iterators like this
to Python. (Or has the time machine beaten me there?)
--
Greg
er,
because it would all be encapsulated in one object.
So I don't really see what you're arguing for here. How do
*you* think positions in unicode strings should be represented?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://ma
urn appropriate iterators.
(Or possibly iterable views, but that would raise the
expectation that the views could also be randomly indexed
by char or grapheme, which we probably wouldn't want to
support.)
--
Greg
___
Python-Dev mailing list
Python
On 25/11/10 12:38, average wrote:
Is immutability a general need that should have general solution?
I don't think it really generalizes. Tuples are not just frozen
lists, for example -- they have a different internal structure
that's more efficient to create and access
objects, this means that the size of the tuple must be known
when the object is created.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/pytho
s as two
blocks, and give up some of the performance advantages of the
current tuple structure.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/option
trying to group them together afterwards.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
imported
from, I also know which file to look in for its
definition. If a module can be spread over several
files, that feature would be lost.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Uns
Guido van Rossum wrote:
> Then let's allow
>
> nonlocal x = 12
>
> as a shortcut for
>
> nonlocal x
> x = 12
I thought you didn't like that, because in
nonlocal x = 12
x = 42
it's not clear whether these are ta
Mike Krell wrote:
> If I've followed the discussions correctly, I think the parent scope
> would be operative, so I humbly suggest "parent".
-1, this is far too commonly used as a variable name.
--
Greg
___
Python-Dev ma
Matthew Barnes wrote:
> its
> meaning in C/C++ (i.e. the symbol is defined outside of the current
> scope).
It means more than that -- it means defined outside
the current *file*. That's much too drastic for
what we want.
--
Greg
___
Pyth
ither -- at least not so much
as to be relegated to a myth!
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
ot), the decision was
made to disallow it.
Does that version sound less like a creation myth?-)
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
"a plus b". Now, "plus" has a somewhat wider meaning
than "sum". It sounds quite in order to say things
like "I have a sandwich plus an apple in my lunch
box", but it would be odd to say "I have the sum
of a sandwich and an apple in my lunch box&q
Wolfgang Langner wrote:
> @main
> def whatever():
> ...
This seems like replacing one unpythonic feature
with another. (I *still* can't get used to that
@ syntax -- it looks like an intruder from
Rubyland...)
--
Greg
___
Python-De
e rest of the args,
so the first thing you always do is args[1:].
It's not so bad in C, where it's just as easy to
start indexing argv from 1 instead of 0. But it
makes no sense in Python, IMO. It would be much
more sensible to move it into a
Jeroen Ruigrok van der Werven wrote:
> - Open classes would be nice.
What do you mean by "open classes"? Python
classes already seem pretty open to me, by
the standards of other languages!
--
Greg
___
Python-Dev mailing list
Python-D
sure you
remember, has been highly debated. :-)
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
C++ likely don't see this as a problem. But
since I've come to appreciate the benefits of
Python's module system, I don't want to go back
to that nightmare.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.or
importless interpreter you suggest wouldn't be
unnecessarily crippled).
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Guido van Rossum wrote:
> I'nm afraid if we
> were to split it by functionality we'd have to split it 5-way or so...
What about just splitting it into "mutable" and
"immutable" parts? That would be a fairly clear
division, I think.
--
Greg
__
inode number or
> whatever.
I don't think that applies to the Python args[] though,
since its args[0] isn't the path of the OS-level
executable, it's the path of the main Python script.
But you could still end up without one, if the main
script comes from somewhe
s of an impression that stuff is
being sprung on the community unawares.
> OT1H I think there
> will always be people or projects that won't try anything until the
> gold release,
Well, at least they've had a chance to try it. If they
don't take that chance, they don
taclasses. I don't think it would hurt to have
it available as a __future__ import as well.
There's also the advantage that all of a
module's future assumptions could then be
documented uniformly in one place, i.e. in
a __future__ import at the top.
--
Greg
_
1001 - 1100 of 2499 matches
Mail list logo