On 21 July 2013 13:28, Serhiy Storchaka wrote:
> 21.07.13 14:29, Joshua Landau написав(ла):
>
>> On 21 July 2013 08:44, Serhiy Storchaka wrote:
>>>
>>> 20.07.13 20:03, Joshua Landau написав(ла):
>>>
Still, it seems to me that it should be optimizable for sensible
builtin types such that
21.07.13 14:29, Joshua Landau написав(ла):
On 21 July 2013 08:44, Serhiy Storchaka wrote:
20.07.13 20:03, Joshua Landau написав(ла):
Still, it seems to me that it should be optimizable for sensible
builtin types such that .translate is significantly faster, as there's
no theoretical extra wor
On 21 July 2013 08:44, Serhiy Storchaka wrote:
> 20.07.13 20:03, Joshua Landau написав(ла):
>
>> Still, it seems to me that it should be optimizable for sensible
>> builtin types such that .translate is significantly faster, as there's
>> no theoretical extra work that .translate *has* to do that
20.07.13 20:03, Joshua Landau написав(ла):
Still, it seems to me that it should be optimizable for sensible
builtin types such that .translate is significantly faster, as there's
no theoretical extra work that .translate *has* to do that .replace
does not, and .replace also has to rebuild the str
On 20 July 2013 22:56, Dave Angel wrote:
> On 07/20/2013 02:37 PM, Joshua Landau wrote:
>>
>> The problem can be solved, I'd imagine, for builtin types. Just build
>> an internal representation upon calling .translate that's faster. It's
>> especially easy in the list case
>
> What "list case"? l
On 07/20/2013 02:37 PM, Joshua Landau wrote:
On 20 July 2013 19:04, Dave Angel wrote:
On 07/20/2013 01:03 PM, Joshua Landau wrote:
Still, it seems to me that it should be optimizable for sensible
builtin types such that .translate is significantly faster, as there's
no theoretical extra work
On 20 July 2013 19:37, Joshua Landau wrote:
> mapping int -> int
Well, on second thought it's not quite this unless it's a 1:1 mapping.
Point remains valid, though, I think.
--
http://mail.python.org/mailman/listinfo/python-list
On 20 July 2013 19:04, Dave Angel wrote:
> On 07/20/2013 01:03 PM, Joshua Landau wrote:
>>
>> Still, it seems to me that it should be optimizable for sensible
>> builtin types such that .translate is significantly faster, as there's
>> no theoretical extra work that .translate *has* to do that .re
On 07/20/2013 01:03 PM, Joshua Landau wrote:
On 20 July 2013 12:57, Serhiy Storchaka wrote:
20.07.13 14:16, Joshua Landau написав(ла):
However, some quick timing shows that translate has a very
high penalty for missing characters and is a tad slower any way.
Really, though, there sh
On 20 July 2013 12:57, Serhiy Storchaka wrote:
> 20.07.13 14:16, Joshua Landau написав(ла):
>>
>> On 19 July 2013 18:29, Serhiy Storchaka wrote:
>>>
>>> The string replace() method is fastest (at least in Python 3.3+). See
>>> implementation of html.escape() etc.
>>
>>
>> def escape(s, quote=True
On 07/20/2013 07:48 AM, Serhiy Storchaka wrote:
19.07.13 21:08, Skip Montanaro написав(ла):
Serhiy> The string replace() method is fastest (at least in Python
3.3+). See
Serhiy> implementation of html.escape() etc.
I trust everybody knows by now that when you want to use regular
expressions yo
On 07/20/2013 07:16 AM, Joshua Landau wrote:
On 19 July 2013 18:29, Serhiy Storchaka wrote:
19.07.13 19:22, Steven D'Aprano написав(ла):
I also expect that the string replace() method will be second fastest,
and re.sub will be the slowest, by a very long way.
The string replace() method is
20.07.13 14:16, Joshua Landau написав(ла):
On 19 July 2013 18:29, Serhiy Storchaka wrote:
The string replace() method is fastest (at least in Python 3.3+). See
implementation of html.escape() etc.
def escape(s, quote=True):
if quote:
return s.translate(_escape_map_full)
ret
19.07.13 21:08, Skip Montanaro написав(ла):
Serhiy> The string replace() method is fastest (at least in Python 3.3+). See
Serhiy> implementation of html.escape() etc.
I trust everybody knows by now that when you want to use regular
expressions you should shell out to Perl for the best performance
On 19 July 2013 18:29, Serhiy Storchaka wrote:
> 19.07.13 19:22, Steven D'Aprano написав(ла):
>
>> I also expect that the string replace() method will be second fastest,
>> and re.sub will be the slowest, by a very long way.
>
>
> The string replace() method is fastest (at least in Python 3.3+). S
On 07/19/2013 05:44 PM, Devyn Collier Johnson wrote:
On 07/19/2013 12:22 PM, Steven D'Aprano wrote:
On Fri, 19 Jul 2013 09:22:48 -0400, Devyn Collier Johnson wrote:
I have some code that I want to simplify. I know that a for-loop would
work well, but can I make re.sub perform all of the below
On 07/19/2013 12:22 PM, Steven D'Aprano wrote:
On Fri, 19 Jul 2013 09:22:48 -0400, Devyn Collier Johnson wrote:
I have some code that I want to simplify. I know that a for-loop would
work well, but can I make re.sub perform all of the below tasks at once,
or can I write this in a way that is m
Serhiy> The string replace() method is fastest (at least in Python 3.3+). See
Serhiy> implementation of html.escape() etc.
I trust everybody knows by now that when you want to use regular
expressions you should shell out to Perl for the best performance. :-)
Skip
--
http://mail.python.org/mailma
19.07.13 19:22, Steven D'Aprano написав(ла):
I also expect that the string replace() method will be second fastest,
and re.sub will be the slowest, by a very long way.
The string replace() method is fastest (at least in Python 3.3+). See
implementation of html.escape() etc.
--
http://mail.p
On Fri, 19 Jul 2013 09:22:48 -0400, Devyn Collier Johnson wrote:
> I have some code that I want to simplify. I know that a for-loop would
> work well, but can I make re.sub perform all of the below tasks at once,
> or can I write this in a way that is more efficient than using a
> for-loop?
>
> D
In Devyn Collier Johnson
writes:
> I have some code that I want to simplify. I know that a for-loop would
> work well, but can I make re.sub perform all of the below tasks at once,
> or can I write this in a way that is more efficient than using a for-loop?
> DATA = re.sub(',', '', 'DATA')
>
On Friday, July 19, 2013 7:22:48 AM UTC-6, Devyn Collier Johnson wrote:
> I have some code that I want to simplify. I know that a for-loop would
>
> work well, but can I make re.sub perform all of the below tasks at once,
> or can I write this in a way that is more efficient than using a for-loo
I have some code that I want to simplify. I know that a for-loop would
work well, but can I make re.sub perform all of the below tasks at once,
or can I write this in a way that is more efficient than using a for-loop?
DATA = re.sub(',', '', 'DATA')
DATA = re.sub('\'', '', 'DATA')
DATA = re.sub
23 matches
Mail list logo