"Chris Angelico" wrote in message
news:CAPTjJmrXp4MSO9f=xb_brupnrz7xrksktkbfvo-e5n7lr_m...@mail.gmail.com...
> On Sun, Mar 8, 2015 at 6:30 PM, Frank Millman wrote:
>> Actually, as I write this, I realise that there is a more important
>> question
>> that had not occurred to me before. Is this
On Sun, Mar 8, 2015 at 6:30 PM, Frank Millman wrote:
> Actually, as I write this, I realise that there is a more important question
> that had not occurred to me before. Is this a potential security risk? My
> intention is that the caller would only call functions within my own
> modules, but this
On Sun, Mar 8, 2015 at 6:20 PM, Marko Rauhamaa wrote:
> * it still isn't bijective between str and bytes:
>
>>>> '\udd00'.encode('utf-8', errors='surrogateescape')
>Traceback (most recent call last):
> File "", line 1, in
>UnicodeEncodeError: 'utf-8' codec can't encode character
Hi all
It is well known that if you import a module more than once, the overhead
for the subsequent imports is negligible.
Does anyone happen to know if the same is true of the following?
module_name, func_name = func_name.rsplit('.', 1)
module = importlib.import_module(module_n
On Saturday, March 7, 2015 at 4:39:48 PM UTC+5:30, Steven D'Aprano wrote:
> Rustom Mody wrote:
> > This includes not just bug-prone-system code such as Java and Windows but
> > seemingly working code such as python 3.
>
> What Unicode bugs do you think Python 3.3 and above have?
Literal/Legalisti
Steven D'Aprano :
> For those cases where you do wish to take an arbitrary byte stream and
> round-trip it, Python now provides an error handler for that.
>
> py> import random
> py> b = bytes([random.randint(0, 255) for _ in range(1)])
> py> s = b.decode('utf-8')
> Traceback (most recent call
On 3/7/2015 10:19 PM, Grant Edwards wrote:
On 2015-03-07, Gregory Ewing wrote:
alister wrote:
a popular UK soap made an extreme effort not to show a cross or
Christmas tree during a church wedding in case it "offended
not-Christians".
In today's climate, when offending certain varieties
of
On Saturday, March 7, 2015 at 11:41:53 AM UTC+5:30, Terry Reedy wrote:
> On 3/6/2015 11:20 AM, Rustom Mody wrote:
>
> > =
> > pp = "💩"
> > print (pp)
> > =
> > Try open it in idle3 and you get (at least I get):
> >
> > $ idle3 ff.py
> > Traceback (most recent call last):
> >Fil
On 2015-03-07, Gregory Ewing wrote:
> alister wrote:
>
>> a popular UK soap made an extreme effort not to show a cross or
>> Christmas tree during a church wedding in case it "offended
>> not-Christians".
>
> In today's climate, when offending certain varieties
> of non-Christian can get you blown
On Saturday, March 7, 2015 at 11:49:44 PM UTC+5:30, Mark Lawrence wrote:
> On 07/03/2015 17:16, Marko Rauhamaa wrote:
> > Mark Lawrence:
> >
> >> It would clearly help if you were to type in the correct UK English
> >> accent.
> >
> > Your ad-hominem-to-contribution ratio is alarmingly high.
> >
>
Marko Rauhamaa wrote:
> Steven D'Aprano :
>
>> Marko Rauhamaa wrote:
>>
>>> That said, UTF-8 does suffer badly from its not being
>>> a bijective mapping.
>>
>> Can you explain?
>
> In Python terms, there are bytes objects b that don't satisfy:
>
>b.decode('utf-8').encode('utf-8') == b
Are
On Sat, 07 Mar 2015 19:00:47 +, Mark Lawrence wrote:
> Isn't pathlib
> https://docs.python.org/3/library/pathlib.html#module-pathlib
> effectively a more recent attempt at smoothing or even removing (some
> of) the bumps? Has anybody here got experience of it as I've never
> used it?
I almos
--- Original Message -
> From: Chris Angelico
> To:
> Cc: "python-list@python.org"
> Sent: Saturday, March 7, 2015 6:26 PM
> Subject: Re: Newbie question about text encoding
>
> On Sun, Mar 8, 2015 at 4:14 AM, Marko Rauhamaa wrote:
>> See:
>>
>> $ mkdir /tmp/xyz
>> $ touch /tm
Dan Sommers :
> I think we're all agreeing: not all file systems are the same, and
> Python doesn't smooth out all of the bumps, even for something that
> seems as simple as displaying the names of files in a directory. And
> that's *after* we've agreed that filesystems contain files in
> hierarch
On 07/03/2015 18:34, Dan Sommers wrote:
On Sun, 08 Mar 2015 05:13:09 +1100, Chris Angelico wrote:
On Sun, Mar 8, 2015 at 5:02 AM, Dan Sommers wrote:
On Sun, 08 Mar 2015 04:59:56 +1100, Chris Angelico wrote:
On Sun, Mar 8, 2015 at 4:50 AM, Marko Rauhamaa wrote:
Correct. Linux pathnames a
On Sun, Mar 8, 2015 at 5:34 AM, Dan Sommers wrote:
> I think we're all agreeing: not all file systems are the same, and
> Python doesn't smooth out all of the bumps, even for something that
> seems as simple as displaying the names of files in a directory. And
> that's *after* we've agreed that
On Sun, 08 Mar 2015 05:13:09 +1100, Chris Angelico wrote:
> On Sun, Mar 8, 2015 at 5:02 AM, Dan Sommers wrote:
>> On Sun, 08 Mar 2015 04:59:56 +1100, Chris Angelico wrote:
>>
>>> On Sun, Mar 8, 2015 at 4:50 AM, Marko Rauhamaa wrote:
>>
Correct. Linux pathnames are octet strings regardless o
On 07/03/2015 17:16, Marko Rauhamaa wrote:
Mark Lawrence :
It would clearly help if you were to type in the correct UK English
accent.
Your ad-hominem-to-contribution ratio is alarmingly high.
Marko
You've been a PITA ever since you first joined this list, what about it?
--
My fellow Py
On 3/7/2015 11:44 AM, fl wrote:
Hi,
I once learnt Python for a few weeks. Now, I try to using a Python package
pymc. It has the following example code:
import pymc
import numpy as np
n = 5*np.ones(4,dtype=int)
x = np.array([-.86,-.3,-.05,.73])
x is defined here as a module ('global') name
On Sun, Mar 8, 2015 at 5:02 AM, Dan Sommers wrote:
> On Sun, 08 Mar 2015 04:59:56 +1100, Chris Angelico wrote:
>
>> On Sun, Mar 8, 2015 at 4:50 AM, Marko Rauhamaa wrote:
>
>>> Correct. Linux pathnames are octet strings regardless of the locale.
>>>
>>> That's why Linux developers should refer to
On Sun, 08 Mar 2015 04:59:56 +1100, Chris Angelico wrote:
> On Sun, Mar 8, 2015 at 4:50 AM, Marko Rauhamaa wrote:
>> Correct. Linux pathnames are octet strings regardless of the locale.
>>
>> That's why Linux developers should refer to filenames using bytes.
>> Unfortunately, Python itself viola
On Sun, Mar 8, 2015 at 4:50 AM, Marko Rauhamaa wrote:
>> There are two things happening here:
>>
>> 1) The underlying file system is not UTF-8, and you can't depend on
>> that,
>
> Correct. Linux pathnames are octet strings regardless of the locale.
>
> That's why Linux developers should refer to
Chris Angelico :
> On Sun, Mar 8, 2015 at 4:14 AM, Marko Rauhamaa wrote:
>> File names encoded with Latin-X are quite commonplace even in UTF-8
>> locales.
>
> That is not a problem with UTF-8, though. I don't understand how
> you're blaming UTF-8 for that.
I'm saying it creates practical proble
On Sun, Mar 8, 2015 at 4:14 AM, Marko Rauhamaa wrote:
> See:
>
>$ mkdir /tmp/xyz
>$ touch /tmp/xyz/
> \x80'
>$ python3
>Python 3.3.2 (default, Dec 4 2014, 12:49:00)
>[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux
>Type "help", "copyright", "credits" or "license" for more
Mark Lawrence :
> It would clearly help if you were to type in the correct UK English
> accent.
Your ad-hominem-to-contribution ratio is alarmingly high.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
Chris Angelico :
> If you really REALLY can't use the bytes() type to work with something
> that is, yaknow, bytes, then you could use an alternative encoding
> that has a value for every byte. It's still not Unicode text, so it
> doesn't much matter which encoding you use. But it's much better to
On 07/03/2015 16:48, Marko Rauhamaa wrote:
Mark Lawrence :
On 07/03/2015 16:25, Marko Rauhamaa wrote:
Here's an example:
b = b'\x80'
Yes, it generates an exception. IOW, UTF-8 is not a bijective mapping
from str objects to bytes objects.
Python 2 might, Python 3 doesn't.
Python
On Sun, Mar 8, 2015 at 3:54 AM, Marko Rauhamaa wrote:
> You can't operate on file names and text files using Python strings. Or
> at least, you will need to add (nontrivial) exception catching logic.
You can't operate on a JPG file using a Unicode string, nor an array
of integers. What of it? You
On Sun, Mar 8, 2015 at 3:54 AM, Marko Rauhamaa wrote:
>> All you've proven is that there are bit patterns which are not UTF-8
>> streams...
>
> And that causes problems.
Demonstrate.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
Chris Angelico :
> On Sun, Mar 8, 2015 at 3:25 AM, Marko Rauhamaa wrote:
> Marko Rauhamaa wrote:
>> That said, UTF-8 does suffer badly from its not being
>> a bijective mapping.
>
>> Here's an example:
>>
>>b = b'\x80'
>>
>> Yes, it generates an exception. IOW, UTF-8 is not a
On Sun, Mar 8, 2015 at 3:40 AM, Mark Lawrence wrote:
>> Here's an example:
>>
>> b = b'\x80'
>>
>> Yes, it generates an exception. IOW, UTF-8 is not a bijective mapping
>> from str objects to bytes objects.
>>
>
> Python 2 might, Python 3 doesn't.
He was talking about this line of code:
b.de
Mark Lawrence :
> On 07/03/2015 16:25, Marko Rauhamaa wrote:
>> Here's an example:
>>
>> b = b'\x80'
>>
>> Yes, it generates an exception. IOW, UTF-8 is not a bijective mapping
>> from str objects to bytes objects.
>
> Python 2 might, Python 3 doesn't.
Python 3.3.2 (default, Dec 4 2014, 1
Hi,
I once learnt Python for a few weeks. Now, I try to using a Python package
pymc. It has the following example code:
import pymc
import numpy as np
n = 5*np.ones(4,dtype=int)
x = np.array([-.86,-.3,-.05,.73])
alpha = pymc.Normal('alpha',mu=0,tau=.01)
beta = pymc.Normal('beta',mu=0,tau=.01)
On 07/03/2015 16:25, Marko Rauhamaa wrote:
Chris Angelico :
On Sun, Mar 8, 2015 at 2:48 AM, Marko Rauhamaa wrote:
Steven D'Aprano :
Marko Rauhamaa wrote:
That said, UTF-8 does suffer badly from its not being
a bijective mapping.
Can you explain?
In Python terms, there are bytes object
On Sun, Mar 8, 2015 at 3:25 AM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> On Sun, Mar 8, 2015 at 2:48 AM, Marko Rauhamaa wrote:
>>> Steven D'Aprano :
>>>
Marko Rauhamaa wrote:
> That said, UTF-8 does suffer badly from its not being
> a bijective mapping.
Can you ex
On 07/03/2015 15:55, polyver...@gmail.com wrote:
Out of curiosity, is there any plan to use a more recent version of Visual
Studio (i.e.: 2013) to compile the official Python3 distribution for Windows?
Is it in discussion? Maybe waiting for the 2015 version?
I'm working on a C++ software that e
Chris Angelico :
> On Sun, Mar 8, 2015 at 2:48 AM, Marko Rauhamaa wrote:
>> Steven D'Aprano :
>>
>>> Marko Rauhamaa wrote:
>>>
That said, UTF-8 does suffer badly from its not being
a bijective mapping.
>>>
>>> Can you explain?
>>
>> In Python terms, there are bytes objects b that don't
On Sun, Mar 8, 2015 at 2:55 AM, wrote:
> Out of curiosity, is there any plan to use a more recent version of Visual
> Studio (i.e.: 2013) to compile the official Python3 distribution for Windows?
> Is it in discussion? Maybe waiting for the 2015 version?
>
> I'm working on a C++ software that em
On Sun, Mar 8, 2015 at 2:48 AM, Marko Rauhamaa wrote:
> Steven D'Aprano :
>
>> Marko Rauhamaa wrote:
>>
>>> That said, UTF-8 does suffer badly from its not being
>>> a bijective mapping.
>>
>> Can you explain?
>
> In Python terms, there are bytes objects b that don't satisfy:
>
>b.decode('utf-
On Thu, 5 Mar 2015 23:36:47 -0700, Ian Kelly
wrote:
>
>I'm not following what it is that you want to accomplish in this
>example by modifying the slice object.
Yeah. That code doesn't show anything. It was just meant to illustrate
what I was doing, not how. But in retrospect it just made my post
Out of curiosity, is there any plan to use a more recent version of Visual
Studio (i.e.: 2013) to compile the official Python3 distribution for Windows?
Is it in discussion? Maybe waiting for the 2015 version?
I'm working on a C++ software that embeds Python3, currently compiled with
MSVC2010 an
On Sat, Mar 7, 2015 at 4:15 AM, Lakshmipathi.G
wrote:
> Hi,
>
> I'm following this example :
> http://nedbatchelder.com/text/whirlext.html#h_making_a_type and trying
> to add
> new data into 'CountDict' type
>
> Adding a simple 'char' works well.
>
> typedef struct {
>PyObject_HEAD
>PyObj
Steven D'Aprano :
> Marko Rauhamaa wrote:
>
>> That said, UTF-8 does suffer badly from its not being
>> a bijective mapping.
>
> Can you explain?
In Python terms, there are bytes objects b that don't satisfy:
b.decode('utf-8').encode('utf-8') == b
Marko
--
https://mail.python.org/mailman/l
Marko Rauhamaa wrote:
> That said, UTF-8 does suffer badly from its not being
> a bijective mapping.
Can you explain?
As far as I am aware, every code point has one and only one valid UTF-8
encoding, and every UTF-8 encoding has one and only one valid code point.
There are *invalid* UTF-8 encod
On Fri, 6 Mar 2015 21:09:24 +1100, Chris Angelico
wrote:
>
>there was a time (maybe times, I don't remember) when
>Microsoft tried hard to require "managed code" everywhere (aka ".NET
>runtime only"), and the push-back was so strong that they had to
>abandon the requirement. But somehow, people ac
On 07/03/2015 11:09, Steven D'Aprano wrote:
Rustom Mody wrote:
This includes not just bug-prone-system code such as Java and Windows but
seemingly working code such as python 3.
What Unicode bugs do you think Python 3.3 and above have?
Methinks somebody has been drinking too much loony ju
On 07/03/2015 12:02, Chris Angelico wrote:
On Sat, Mar 7, 2015 at 10:53 PM, Marko Rauhamaa wrote:
The main dream was a fixed-width encoding scheme. People thought 16 bits
would be enough. The dream is so precious and true to us in the West
that people don't want to give it up.
So... use Pike,
On Sat, Mar 7, 2015 at 10:53 PM, Marko Rauhamaa wrote:
> The main dream was a fixed-width encoding scheme. People thought 16 bits
> would be enough. The dream is so precious and true to us in the West
> that people don't want to give it up.
So... use Pike, or Python 3.3+?
ChrisA
--
https://mail
Steven D'Aprano :
> Rustom Mody wrote:
>> My conclusion: Early adopters of unicode -- Windows and Java -- were
>> punished for their early adoption. You can blame the unicode
>> consortium, you can blame the babel of human languages, particularly
>> that some use characters and some only (the equi
On Sat, Mar 7, 2015 at 10:09 PM, Steven D'Aprano
wrote:
> Stop using MySQL, which is a joke of a database[1], and use Postgres which
> does not have this problem.
I agree with the recommendation, though to be fair to MySQL, it is now
possible to store full Unicode. Though personally, I think the
Rustom Mody wrote:
> On Thursday, March 5, 2015 at 7:36:32 PM UTC+5:30, Steven D'Aprano wrote:
[...]
>> Chris is suggesting that going from BMP to all of Unicode is not the hard
>> part. Going from ASCII to the BMP part of Unicode is the hard part. If
>> you can do that, you can go the rest of the
Hi, I was doing a fresh installation for Python 2.7.9 (32 bit) and 3.4.3 (32
bit) (downloaded from PSF) on Win7 X64 today, and I found that there is no
'Script' folder in 'Python27' and 'Python34' folder as first child level
folder, but there is one in Tools. However, I couldn't find pip within
Hi,
I'm following this example :
http://nedbatchelder.com/text/whirlext.html#h_making_a_type and trying
to add
new data into 'CountDict' type
Adding a simple 'char' works well.
typedef struct {
PyObject_HEAD
PyObject * dict;
int count;
char c; //add this and placed an entry into PyM
53 matches
Mail list logo