Hi All,
The new explicit relative import syntax is great.
I wanted to relatively import a module.
import .mymoduleinmypackage
...and got a SyntaxError in Python 2.6.
I guess I need to do:
from . import mymoduleinmypackage
...but it does feel weirdly asymetric that:
from .mymoduleinmypackage
On 07/12/2010 20:26, Vinay Sajip wrote:
I would suggest that when unit testing, rather than adding StreamHandlers to log
to stderr, that something like TestHandler and Matcher from this post:
http://plumberjack.blogspot.com/2010/09/unit-testing-and-logging.html
For Python 2, my testfixtures pa
On 28/01/2011 19:21, Michael Foord wrote:
I've helped quite a few "python newbies" on Windows who are also
surprised / frustrated on learning that "python" on the command line
doesn't work after installing python.
Yes, I've always found it a surprising disappointment that I have to
manually mu
On 06/02/2011 15:20, Brian Curtin wrote:
There are still outstanding considerations in the various issues on the
tracker, so it would be best to address them before requesting
integration. Example: What should happen when there is another Python
installation on the path?
Same as happens with mo
On 06/02/2011 15:25, Brian Curtin wrote:
So put the new path before the old path, or replace it? The current
patch appends to the end.
I believe the last path wins in Windows land, so that would be fine.
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
Hi All,
A friend of mine is coming over to Python and asked a question I thought
would have a better answer than it appears to:
How do I know which version of Python a PEP lands in?
I was expecting there to be a note at the bottom of the PEP, 342 in this
case, but that doesn't appear to be t
On 19/07/2011 22:21, R. David Murray wrote:
The basic additional API is that a 'source' attribute contains the
text the generator read from the input source, and a 'value' attribute
that contains the value with all the Content-Transfer-Encoding stuff
undone so that you have a real unicode string.
On 31/07/2011 07:47, Raymond Hettinger wrote:
It's really nice for stub functions:
def foo(x):
...
I guess pass is too pass-é?
;-)
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
_
Hi All,
Any chance the version of sphinx used to generate the docs on
docs.python.org could be updated?
I'd love to take advantage of the "new format" intersphinx mapping:
http://sphinx.pocoo.org/ext/intersphinx.html#confval-intersphinx_mapping
...but since it looks like docs.python.org uses
On 16/08/2011 16:05, Sandro Tosi wrote:
Hello Chris,
On Wed, Aug 17, 2011 at 00:58, Chris Withers wrote:
Hi All,
Any chance the version of sphinx used to generate the docs on
docs.python.org could be updated?
I think what's needed first is to run a pilot: take the current 2.7
doc,
On 15/09/2011 19:31, Michael Foord wrote:
The current tools are a real pain for versioning anyway. If your pypi
page even *links* to a page that offers an alpha or beta (in development
version) for download then both pip and easy_install will fetch that, in
preference to the most recent version o
On 24/09/2011 00:32, Guido van Rossum wrote:
The interactive console is optimized for people entering code by
typing, not by copying and pasting large gobs of text.
If you think you can have it both, show us the code.
Anatoly wants ipython's new qtconsole.
This "does the right thing" because
What's the python-dev view on this?
Original Message
Subject: Anyone still using Python 2.5?
Date: Wed, 21 Dec 2011 07:15:46 +
From: Chris Withers
To: Python List ,
"testing-in-pyt...@lists.idyll.org" ,
simplis...@googlegroups.com
Hi All,
What's t
Finally, a reason to use Python 3 ;-)
Chris
On 13/01/2012 16:00, Guido van Rossum wrote:
AWESOME!!!
On Fri, Jan 13, 2012 at 4:14 AM, Nick Coghlan mailto:ncogh...@gmail.com>> wrote:
I marked PEP 380 as Final this evening, after pushing the tested and
documented implementation to hg.pyt
On 14/01/2012 16:14, Sandro Tosi wrote:
Hello,
just a heads-up: documentation for 2.7 branch has been ported to use
sphinx 1.0, so now the same syntax can be used for 2.x and 3.x
patches, hopefully easying working on both python stacks.
That's great news, does that now mean the objects inventor
On 01/02/2012 17:50, Guido van Rossum wrote:
Another question: a common pattern is to use (immutable) class
variables as default values for instance variables, and only set the
instance variables once they need to be different. Does such a class
benefit from your improvement?
A less common patt
On 27/01/2012 15:09, Antoine Pitrou wrote:
On Fri, 27 Jan 2012 15:21:33 +0200
Eli Bendersky wrote:
Following an earlier discussion on python-ideas [1], we would like to
propose the following PEP for review. Discussion is welcome. The PEP
can also be viewed in HTML form at
http://www.python.org
On 10/02/2012 09:44, Maciej Fijalkowski wrote:
you can download the PyPy 1.8 release here:
http://pypy.org/download.html
Why no Windows 64-bit build :'(
Is the 32-bit build safe to use on 64-bit Windows?
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
On 21/03/2012 09:33, Jonathan Hartley wrote:
On 21/03/2012 08:25, Dirkjan Ochtman wrote:
On Wed, Mar 21, 2012 at 07:00, Georg Brandl wrote:
OK, that seems to be the main point people make... let me see if I can
come up with a better compromise.
Would it be possible to limit the width of the
Hi All,
Sorry if this is considered slightly off topic, but Sphinx is the tool
we use for the Python core docs so:
Who's looking after Sphinx nowadays? I've hit what I consider to be a bug:
https://groups.google.com/group/sphinx-dev/browse_thread/thread/197fc26ba570913d?hl=en
So I forked on
Hi Georg,
On 26/07/2012 21:07, Georg Brandl wrote:
If you're patient enough, I'll take care of your problem eventually.
If not, and you're looking for a project to co-maintain, we can set
something up :)
I'm certainly interested in helping out where I can, Sphinx has been a
fantastic tool...
Hi All,
This feels like a bug, but just wanted to check here before filing a
report if I've missed something:
buzzkill$ python2.7
Enthought Python Distribution -- www.enthought.com
Version: 7.2-2 (32-bit)
Python 2.7.2 |EPD 7.2-2 (32-bit)| (default, Sep 7 2011, 09:16:50)
[GCC 4.0.1 (Apple Inc
Hi All,
I bumped into this using Michael Foord's Mock library.
It feels like a bug to me, but thought I'd ask here before logging one
in the tracker in case people know that we won't be able to fix it:
On 05/11/2012 13:43, Michael Foord wrote:
class Foo(object):
... def __setattr__(s, k,
Hi All,
I wanted to run the unit tests before checking in the patch for
http://bugs.python.org/issue16441, even though it's a trivial change, so
I was trying to follow the instructions at:
http://docs.python.org/devguide/
I'm on MacOS, so following the "unix" instructions did:
./configure -
On 09/11/2012 10:52, Michael Foord wrote:
However, I can't find the python it's built...
It should be python.exe (yes really).
Hah! Should http://docs.python.org/devguide/ be updated to reflect this
or does this only affect Mac OS? (or should we correct the build so it
doesn't spit out a
On 09/11/2012 11:54, Ronald Oussoren wrote:
On 9 Nov, 2012, at 11:57, Chris Withers wrote:
On 09/11/2012 10:52, Michael Foord wrote:
However, I can't find the python it's built...
It should be python.exe (yes really).
Hah! Should http://docs.python.org/devguide/ be updated
On 09/11/2012 11:54, Hans Mulder wrote:
I tried "make test", and I got:
test test_urllib failed -- Traceback (most recent call last):
File "/Users/hans/python/cpython/cpython-2.7/Lib/test/test_urllib.py",
line 235, in test_missing_localfile
fp.close()
UnboundLocalError: local variable 'f
Hi All,
A colleague pointed me at Doug's excellent article here:
http://www.doughellmann.com/articles/misc/dict-performance/index.html
...which made me a little sad, I suspect I'm not the only one who finds:
a_dict = dict(
x = 1,
y = 2,
z = 3,
...
)
...easier to read than:
On 14/11/2012 09:58, Merlijn van Deen wrote:
On 14 November 2012 10:12, Chris Withers wrote:
...which made me a little sad
Why did it make you sad? dict() takes 0.2µs, {} takes 0.04µs. In other
words: you can run dict() _five million_ times per second, and {}
twenty-five million times per
On 14/11/2012 10:11, mar...@v.loewis.de wrote:
Zitat von Chris Withers :
a_dict = dict(
x = 1,
y = 2,
z = 3,
...
)
What can we do to speed up the former case?
It should be possible to special-case it. Rather than creating
a new dictionary from scratch, one could try
On 14/11/2012 21:40, Greg Ewing wrote:
* If the compiler were allowed to recognise builtins, it could
turn dict(a = 1, b = 2) into {'a':1, 'b':2} automatically.
That would be my naive suggestion, I am prepared to be shot down in
flames ;-)
Would be even more awesome if it could end up with t
On 14/11/2012 22:37, Chris Withers wrote:
On 14/11/2012 10:11, mar...@v.loewis.de wrote:
def xdict(**kwds):
return kwds
Hah, good call, this trumps both of the other options:
$ python2.7 -m timeit -n 100 -r 5 -v
"{'a':1,'b':2,'c':3,'d':4,
On 15/11/2012 06:32, Stefan Behnel wrote:
Donald Stufft, 15.11.2012 00:00:
$ pypy -m timeit 'dict()'
10 loops, best of 3: 0.000811 usec per loop
$ pypy -m timeit '{}'
10 loops, best of 3: 0.000809 usec per loop
$ pypy -m timeit 'def md(**kw): return kw; md()'
1 loops, b
Hi All,
Would anyone object to me making a change to the docs for 2.6, 2.7 and
3.x to clarify the following:
http://docs.python.org/3/library/subprocess.html#subprocess.Popen.poll
A couple of my colleagues have ended up writing code like this:
proc = Popen(['some', 'thing'])
code = proc.poll
On 05/12/2012 16:34, Antoine Pitrou wrote:
http://docs.python.org/3/library/subprocess.html#subprocess.Popen.poll
The doc looks clear to me. poll() returns the returncode attribute which
is described thusly:
"A None value indicates that the process hasn’t terminated yet."
Therefore, I don't u
On 05/12/2012 17:15, Steven D'Aprano wrote:
"""
Check if child process has terminated. Returns None while the child is
still running,
any non-None value means that the child has terminated. In either case,
the return
value is also available from the instance's returncode attribute.
"""
Do you w
Hi All,
Where would I look to find out which release a fix for an issue
(http://bugs.python.org/issue15822 if you're interested ;-)) will land in?
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
On 08/02/2013 11:17, Antoine Pitrou wrote:
Le Fri, 08 Feb 2013 10:58:36 +,
Chris Withers a écrit :
Hi All,
Where would I look to find out which release a fix for an issue
(http://bugs.python.org/issue15822 if you're interested ;-)) will
land in?
Just read that issue's co
Hi All,
Just had a bit of an embarrassing incident in some code where I did:
sometotal =+ somevalue
I'm curious why this syntax is allowed? I'm sure there are good reasons,
but thought I'd ask...
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- ht
On 08/02/2013 15:42, Benjamin Peterson wrote:
2013/2/8 Chris Withers:
Hi All,
Just had a bit of an embarrassing incident in some code where I did:
sometotal =+ somevalue
That's just a strange way of expressing
sometotal = +somevalue
Indeed, but why should this be possible? When cou
On 08/02/2013 16:17, Oscar Benjamin wrote:
Decimal.__pos__ uses it to return a Decimal instance that has the
default precision of the current Decimal context:
from decimal import Decimal
d = Decimal('0.33')
d
Decimal('0.33
Hi All,
I'm finally getting around to porting some of the packages I maintain
over to Python 3.
One rough edge I've hit: I see the atexit module has moved to be C-based
and, as far as I can tell, no longer allows you to introspect what
atexit functions have been registered.
If I'm writing
Hi All,
I see in Python 3, some ImportErrors have grown a '_not_found'
attribute. What's the significance of this attribute and where/how is it
added?
The only way I can seem to create this attribute is:
ex = ImportError
ex._not_found = True
cheers,
Chris
--
Simplistix - Content Managemen
On 11/02/2013 10:54, Nick Coghlan wrote:
On Mon, Feb 11, 2013 at 6:08 PM, Chris Withers wrote:
Hi All,
I see in Python 3, some ImportErrors have grown a '_not_found' attribute.
What's the significance of this attribute and where/how is it added?
The only way I can seem
Hi all,
So, dicts in Python 3 return "something different" from their keys and
values methods:
>>> dict(x=1, y=2).keys()
dict_keys(['y', 'x'])
>>> type(dict(x=1, y=2).keys())
I have vague memories of these things being referred to as views or some
such? Where can I learn more?
More import
On 12/02/2013 21:03, Maciej Fijalkowski wrote:
We recently encountered a performance issue in stdlib for pypy. It
turned out that someone commited a performance "fix" that uses += for
strings instead of "".join() that was there before.
That's... interesting.
I fixed a performance bug in httpli
On 13/02/2013 11:53, Steven D'Aprano wrote:
I fixed a performance bug in httplib some years ago by doing the exact
opposite; += -> ''.join(). In that case, it changed downloading a file
from 20 minutes to 3 seconds. That was likely on Python 2.5.
I remember it well.
http://mail.python.org/pip
Hi All,
I've run into "some issues" installing lxml for python 3.3 on my mac:
One of the stumbling blocks I've hit is that I built python 3.3 from
source (./configure && make && make altinstall), and it used clang:
buzzkill:virtualenvs chris$ /src/Python-3.3.0/python.exe
Python 3.3.0 (defaul
On 14/02/2013 09:18, Chris Withers wrote:
Hi All,
I've run into "some issues" installing lxml for python 3.3 on my mac:
(forgot the links)
https://mailman-mail5.webfaction.com/pipermail/lxml/2013-February/006730.html
https://mailman-mail5.webfaction.com/pipermail/lxml/2013-
On 14/02/2013 12:15, Ronald Oussoren wrote:
buzzkill:virtualenvs chris$ /src/Python-3.3.0/python.exe
Python 3.3.0 (default, Jan 23 2013, 09:56:03)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
201 - 250 of 250 matches
Mail list logo