On Mon, Dec 15, 2014 at 10:46 PM, Jason Swails
wrote:
>
> This was a problem posed to me, which I solved in Python. I thought it
was neat and enjoyed the exercise of working through it; feel free to
ignore. For people looking for little projects to practice their skills
with (or a simple distrac
This was a problem posed to me, which I solved in Python. I thought it was
neat and enjoyed the exercise of working through it; feel free to ignore.
For people looking for little projects to practice their skills with (or a
simple distraction), read on.
You have a triangle of numbers such that ea
Steven D'Aprano writes:
> If you don't have and won't open an account on the tracker, if you can
> come up with a minimal example that demonstrates the issue, I'll open
> an issue for you. (But I'd rather you did it yourself :-)
Thank you for the offer. Fortunately, the Python bug tracker does n
Ethan Furman writes:
> On 12/15/2014 05:36 PM, Ben Finney wrote:
> > I'm increasingly of the opinion this is a subtle bug in ‘__import__’
> > that should be fixed instead of worked around.
And other people agree: https://bugs.python.org/issue21720>.
> Of course. But you'll still need to work ar
Ben Finney wrote:
> I'm increasingly of the opinion this is a subtle bug in ‘__import__’
> that should be fixed instead of worked around. But it will likely be
> rejected because the documentation advises against using ‘__import__’.
> Bah.
I think its worth raising an issue on the bug tracker and
Ned Batchelder writes:
> On 12/15/14 7:42 PM, Ben Finney wrote:
> > As for the advice to avoid such a declaration, you're arguing against
> > the official guide for porting Python 2 code to 2-and-3 compatible code:
> >
> > For text you should either use the from __future__ import
> > un
On 12/15/2014 05:36 PM, Ben Finney wrote:
>
> That's not the issue at all. I know how to declare a literal such that
> it is Unicode in Python 2 and Python 3 (that's what the ‘from __future__
> import unicode_literals’ does).
>
> Rather, the problem is ‘__import__’ having incompatible expectation
Ethan Furman writes:
> On 12/14/2014 11:29 PM, Ben Finney wrote:
> > The ‘__import__’ built-in function, though, is tripping up.
>
> One work-around I have used is:
>
> if isinstance(some_var, bytes):
> some_var = some_var.decode('ascii')
> # at this point some_var is unicode in both Py
On 12/15/14 7:42 PM, Ben Finney wrote:
As for the advice to avoid such a declaration, you're arguing against
the official guide for porting Python 2 code to 2-and-3 compatible code:
For text you should either use the from __future__ import
unicode_literals statement or add a u prefix t
On Mon, Dec 15, 2014 at 4:42 PM, Ben Finney wrote:
> Devin Jeanpierre writes:
>
>> On Sun, Dec 14, 2014 at 11:29 PM, Ben Finney
>> wrote:
>> > from __future__ import unicode_literals
>>
>> Ordinarily, for 2.x/3.3+ code I would suggest not doing this --
>> instead, b'...' for bytes, u'...' f
Devin Jeanpierre writes:
> On Sun, Dec 14, 2014 at 11:29 PM, Ben Finney
> wrote:
> > from __future__ import unicode_literals
>
> Ordinarily, for 2.x/3.3+ code I would suggest not doing this --
> instead, b'...' for bytes, u'...' for unicode, and '...' for native
> "string" type (bytes on 2.
pyspread 0.4
Pyspread 0.4 is released.
In this release, rendering has switched to Cairo, which enhances
quality and performance.
Grid content can now be exported into high quality PDF and SVG files.
Cells can now display SVG images and text with markups.
The nn function
Again Thanks for your help.
I saw that there was a debate about "namespace" nature.
That is what a book says about it(Learning Python 5 Ed. By Mark Lutz):
*
"Classes and Instances
Although they are technically two separate object types in the Python
On 12/14/2014 11:29 PM, Ben Finney wrote:
>
> This entails, I believe, the admonition to ensure text literals are
> Unicode by default::
>
> from __future__ import unicode_literals
>
> and to specify bytes literals explicitly with ‘b'wibble'’ if needed.
For some scripts this works great (I
Hi,
I'm searching a tool to translate an xsl file to executable python code.
I know how to execute xslt with python. What I want is to process my xslt
rules *in* python.
Example :
Mr
Mrs
I would like it to be translated in a python test statement.
Does anyone know something like this ? Or
I released Benchmarker ver 4.0.0
http://pypi.python.org/pypi/Benchmarker/
http://pythonhosted.org/Benchmarker/
Benchmarker is a small utility to benchmark your code.
*NOTICE* This release doesn't have compatibility with ver 3.x.
Installation
$ sudo pip install Benchmarker
Ex
Ben Finney wrote:
> Howdy all,
>
> What should I do, in a world where all text literals are Unicode by
> default, to make ‘__import__’ work in both Python 2 and 3?
One approach I frequently use is a conditional import. Off the top of my
head, I'd do something like this:
try:
import builtin
Albert van der Horst wrote:
> With some perseverance, you can ask the interpreter what `` ** ''
> does:
>
> help(**)
>
> maybe so?
> help('**')
> Indeed, a whole description.
Yes! Well spotted!
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
I played around with changing the names in the aliases.py and locale.py
files (from iso8859 to iso-88559), but this broke mailman.
I ended up changing the charset.py file
input_charset = codecs.lookup(input_charset).name
except LookupError:
pass
if (inpu
In article ,
Skip Montanaro wrote:
>-=-=-=-=-=-
>
>I want to add one more thing to the other responses. People new to Python
>often seem unaware that being an interpreted language, often the best way
>to figure something out is to simply try it at the interpreter prompt. The
>OP saw "var ** 2" in
On 13 December 2014 at 12:24, Steven D'Aprano
wrote:
> Mateusz Loskot wrote:
>
>> On 12 December 2014 at 12:26, Chris Angelico wrote:
>>> On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot
>>> wrote:
I've got several cases which are not obvious to me.
For instance, class Foo has a boolea
On Sun, Dec 14, 2014 at 11:29 PM, Ben Finney wrote:
> I'm slowly learning about making Python code that will run under both
> Python 2 (version 2.6 or above) and Python 3 (version 3.2 or above).
>
> This entails, I believe, the admonition to ensure text literals are
> Unicode by default::
>
>
22 matches
Mail list logo