moi 在 2022年12月12日 星期一下午5:38:50 [UTC+8] 的信中寫道:
> >>> ast.literal_eval("r'\x7a'") == ast.literal_eval("r'z'")
> True
> >>> ast.literal_eval("r'\xe0'") == ast.literal_eval("r'à'")
> True
> >>> ast.literal_eval("r'\x9c'") == ast.literal_eval("r'œ'")
> False
>
> -
>
>
> >>> print(codec
> ./cl.py '^M
> '
> Input
> -
> - length 3
> 13 32 10
> From: Python-list on
> behalf of Jach Feng
> Date: Thursday, December 8, 2022 at 9:31 PM
> To: pytho...@python.org
> Subject: Re: How to convert a raw string r'xdd' to 'xdd' mo
moi 在 2022年12月9日 星期五晚上11:41:20 [UTC+8] 的信中寫道:
> PS C:\humour> py38 sysargwithliteral.py a\x0ab\x09c\x0a\x80uro\x0ax\x08z
> cp1252
> a
> b c
> €uro
> z
>
> PS C:\humour> $a = py38 sysargwithliteral.py a\x0ab\x09c\x0a\x80uro\x0ax\x08z
> cp1252
>
> PS C:\humour> licp($a)
> a U+0061
> b U+0
)
for c in args.data:
print(f'{ord(c)} ',end='')
print()
Using bash on Linux:
./cl.py '^M
'
Input
-
- length 3
13 32 10
From: Python-list on
behalf of Jach Feng
Date: Thursday, December 8, 2022 at 9:31 PM
To: python-list@python.org
Subject: Re: How to co
Jach Feng 在 2022年12月7日 星期三上午10:23:20 [UTC+8] 的信中寫道:
> s0 = r'\x0a'
> At this moment it was done by
>
> def to1byte(matchobj):
> return chr(int('0x' + matchobj.group(1), 16))
> s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
>
> But, is it that difficult on doing this simple thing?
>
>
Jach Feng 在 2022年12月7日 星期三上午10:23:20 [UTC+8] 的信中寫道:
> s0 = r'\x0a'
> At this moment it was done by
>
> def to1byte(matchobj):
> return chr(int('0x' + matchobj.group(1), 16))
> s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
>
> But, is it that difficult on doing this simple thing?
>
>
On 08/12/2022 02:17, Jach Feng wrote:
Peter Otten 在 2022年12月8日 星期四清晨5:17:59 [UTC+8] 的信中寫道:
On 07/12/2022 03:23, Jach Feng wrote:
s0 = r'\x0a'
At this moment it was done by
def to1byte(matchobj):
return chr(int('0x' + matchobj.group(1), 16))
s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
mine
10
From: Python-list on behalf of
Jach Feng
Date: Wednesday, December 7, 2022 at 9:27 PM
To: python-list@python.org
Subject: Re: How to convert a raw string r'xdd' to 'xdd' more gracefully?
*** Attention: This is an external email. Use caution responding, opening
a
chobj):
return chr(int('0x' + matchobj.group(1), 16))
s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
exam(s0)
exam(s1)
---
examine \x0a
92 \
120 x
48 0
97 a
examine
10
From: Python-list on
behalf of Jach Feng
Date: Wednesday, December 7, 2022 at 9:27 PM
To: python-list@python.o
Peter Otten 在 2022年12月8日 星期四清晨5:17:59 [UTC+8] 的信中寫道:
> On 07/12/2022 03:23, Jach Feng wrote:
> > s0 = r'\x0a'
> > At this moment it was done by
> >
> > def to1byte(matchobj):
> > return chr(int('0x' + matchobj.group(1), 16))
> > s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
> >
> > B
Roel Schroeven 在 2022年12月7日 星期三下午4:42:48 [UTC+8] 的信中寫道:
> Op 7/12/2022 om 4:37 schreef Jach Feng:
> > MRAB 在 2022年12月7日 星期三上午11:04:43 [UTC+8] 的信中寫道:
> > > On 2022-12-07 02:23, Jach Feng wrote:
> > > > s0 = r'\x0a'
> > > > At this moment it was done by
> > > >
> > > > def to1byte(matchobj):
>
On 07/12/2022 03:23, Jach Feng wrote:
s0 = r'\x0a'
At this moment it was done by
def to1byte(matchobj):
return chr(int('0x' + matchobj.group(1), 16))
s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
But, is it that difficult on doing this simple thing?
>>> import codecs
>>>
Thomas Passin 在 2022年12月7日 星期三中午12:51:32 [UTC+8] 的信中寫道:
> On 12/6/2022 9:23 PM, Jach Feng wrote:
> > s0 = r'\x0a'
> > At this moment it was done by
> >
> > def to1byte(matchobj):
> > return chr(int('0x' + matchobj.group(1), 16))
> > s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
> >
>
Op 7/12/2022 om 4:37 schreef Jach Feng:
MRAB 在 2022年12月7日 星期三上午11:04:43 [UTC+8] 的信中寫道:
> On 2022-12-07 02:23, Jach Feng wrote:
> > s0 = r'\x0a'
> > At this moment it was done by
> >
> > def to1byte(matchobj):
> > return chr(int('0x' + matchobj.group(1), 16))
> > s1 = re.sub(r'\\x([0-9
On 12/6/2022 9:23 PM, Jach Feng wrote:
s0 = r'\x0a'
At this moment it was done by
def to1byte(matchobj):
return chr(int('0x' + matchobj.group(1), 16))
s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
But, is it that difficult on doing this simple thing?
--Jach
I'm not tota
MRAB 在 2022年12月7日 星期三上午11:04:43 [UTC+8] 的信中寫道:
> On 2022-12-07 02:23, Jach Feng wrote:
> > s0 = r'\x0a'
> > At this moment it was done by
> >
> > def to1byte(matchobj):
> > return chr(int('0x' + matchobj.group(1), 16))
> > s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
> >
> > But, is
On 2022-12-07 02:23, Jach Feng wrote:
s0 = r'\x0a'
At this moment it was done by
def to1byte(matchobj):
return chr(int('0x' + matchobj.group(1), 16))
s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
But, is it that difficult on doing this simple thing?
You could try this:
On 2019-11-28 15:35, Dennis Lee Bieber wrote:
On Thu, 28 Nov 2019 12:45:27 +, Ben Bacarisse
declaimed the following:
Madhavan Bomidi writes:
print,'Column ',J,' of product matrix A*AINV:',format='(1X,A7,I3,A27)'
I don't know what the 1X format does. The A7 and A27 formats just see
> On Nov 28, 2019, at 9:35 AM, Dennis Lee Bieber wrote:
>
> Channeling ancient FORTRAN, I'd interpret it as
>
> 1XSkip one space
> A7Seven character alpha
> I3Three digit integer
> A2727 character alpha
>
> and it is rather painful when the arguments are litera
Madhavan Bomidi writes:
> I have the following IDL program lines. I want to write equivalent
> Python program lines. Can anyone suggest me equivalent Pythons program
> lines?
>
> # --- 1 --- #
> How to handle the format in IDL to Python?
>
> IDL program line:
>
> On Apr 26, 2019, at 4:18 AM, Arup Rakshit wrote:
>
> I have modelled which starts running once drivers and stations are assigned
> to it. Otherwise, it doesn’t run, really don’t care if passengers are boarded
> or not at this moment. :) I think this program can help me to introduce to
> the
On Fri, Sep 14, 2018 at 2:37 PM, Noel P. CUA wrote:
> compose your own octave script to calculate the machine
> epsilon. Analyze the code.
>
> epsilon = 1
> DO
> IF (epsilon+1<=1) EXIT
> epsilon = epsilon/2
> END DO
> epsilon = 2 x epsilon
>
epsilon = 1
while epsilon + 1 > 1:
epsilon = epsi
Ho Yeung Lee wrote:
> after edit the file,
>
> Traceback (most recent call last):
> File "json2csv.py", line 148, in
> loader.load(args.json_file)
> File "json2csv.py", line 53, in load
> self.process_each(json.load(json_file))
> File "C:\Python27\lib\json\__init__.py", line 291, i
after edit the file,
Traceback (most recent call last):
File "json2csv.py", line 148, in
loader.load(args.json_file)
File "json2csv.py", line 53, in load
self.process_each(json.load(json_file))
File "C:\Python27\lib\json\__init__.py", line 291, in load
**kw)
File "C:\Python27
On 3 June 2017 at 13:00, Ho Yeung Lee wrote:
> i use
> https://github.com/evidens/json2csv
>
> Error:
> Traceback (most recent call last):
> File "json2csv.py", line 148, in
> loader.load(args.json_file)
> File "json2csv.py", line 53, in load
> self.process_each(json.load(json_file))
On Sun, 25 Sep 2016 09:08 am, Thomas 'PointedEars' Lahn wrote:
> Christian Gollwitzer wrote:
>
>> Am 17.09.16 um 23:19 schrieb Thomas 'PointedEars' Lahn:
>>> Peng Yu wrote:
Hi, I want to convert strings in which the characters with accents
should be converted to the ones without accents
Am 25.09.16 um 01:08 schrieb Thomas 'PointedEars' Lahn:
Christian Gollwitzer wrote:
Am 17.09.16 um 23:19 schrieb Thomas 'PointedEars' Lahn:
Peng Yu wrote:
Hi, I want to convert strings in which the characters with accents
should be converted to the ones without accents.
[…]
[…]
./main.py Fö
Den 2016-09-25 skrev wxjmfa...@gmail.com :
>
> As an European guy, I recommend to use the characters
> set used in the "official" font families used in Germany:
> BundesSerif / BundesSans.
>
> See
> https://styleguide.bundesregierung.de/Webs/SG/DE/PrintMedien/Basiselemente/Schriften/schriften_node.
On Sunday 18 September 2016 17:51, Terry Reedy wrote:
> On 9/18/2016 2:45 AM, Steven D'Aprano wrote:
>
>> It doesn't matter whether you call them "accent" like most people do, or
>> "diacritics" as linguists do.
>
> I am a native born American and I have never before heard or seen
> non-accent d
Il 18/09/2016 08:45, Steven D'Aprano ha scritto:
integral part of the letter, like the horizonal stroke in English t or the
vertical bar in English p and b, and in some languages they are modifiers,
well... that is the Latin alphabet
English has no T, P or B (or any other character) but is jus
Thorsten Kampe :
> * Terry Reedy (Sun, 18 Sep 2016 03:51:40 -0400)
>> On 9/18/2016 2:45 AM, Steven D'Aprano wrote:
>> > It doesn't matter whether you call them "accent" like most people do, or
>> > "diacritics" as linguists do.
>>
>> I am a native born American and I have never before heard or se
* Terry Reedy (Sun, 18 Sep 2016 03:51:40 -0400)
>
> On 9/18/2016 2:45 AM, Steven D'Aprano wrote:
>
> > It doesn't matter whether you call them "accent" like most people do, or
> > "diacritics" as linguists do.
>
> I am a native born American and I have never before heard or seen
> non-accent di
Den 2016-09-17 skrev Marko Rauhamaa :
> Martin Schöön :
>> Related anecdote from Phoenix AZ. By now you have noticed my family
>> name: Schöön. On airline tickets and boarding passes in the U.S. it
>> gets spelled Schoeoen.
>
> Do Swedes do that German thing, too? If you have to write Finnish
> wit
Am 17.09.16 um 23:19 schrieb Thomas 'PointedEars' Lahn:
Peng Yu wrote:
Hi, I want to convert strings in which the characters with accents
should be converted to the ones without accents.
Why?
[…]
./main.py Förstemann
AFAIK, “ä”, “ö”, and “ü” are not accented characters in any natural
lang
On 9/18/2016 2:45 AM, Steven D'Aprano wrote:
It doesn't matter whether you call them "accent" like most people do, or
"diacritics" as linguists do.
I am a native born American and I have never before heard or seen
non-accent diacritic marks called 'accents'. Accents indicate stress.
Other d
On Sunday 18 September 2016 15:59, Thorsten Kampe wrote:
> * Martin Schöön (17 Sep 2016 20:20:12 GMT)
>>
>> Den 2016-09-17 skrev Kouli :
>> > Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode.
>> >
>> > Kouli
>> >
>> > On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu wrote:
>> >>
On Sunday 18 September 2016 13:30, Peng Yu wrote:
> On Sat, Sep 17, 2016 at 3:20 PM, Martin Schöön
> wrote:
>> Den 2016-09-17 skrev Kouli :
>>> Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode.
>
> I don't find a way to make it print oe for ö. Could anybody please
> advis
* Martin Schöön (17 Sep 2016 20:20:12 GMT)
>
> Den 2016-09-17 skrev Kouli :
> > Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode.
> >
> > Kouli
> >
> > On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu wrote:
> >> Hi, I want to convert strings in which the characters with accents
>
On Sun, 18 Sep 2016 07:19 am, Thomas 'PointedEars' Lahn wrote:
> AFAIK, “ä”, “ö”, and “ü” are not accented characters in any natural
> language, but characters of their own (umlauts).
Are you saying that English is not a natural language?
--
Steve
“Cheer up,” they said, “things could be wo
On Sat, Sep 17, 2016 at 3:20 PM, Martin Schöön wrote:
> Den 2016-09-17 skrev Kouli :
>> Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode.
I don't find a way to make it print oe for ö. Could anybody please
advise what is the correct way to do it?
==> main.py <==
#!/usr/bin
Martin Schöön :
> Related anecdote from Phoenix AZ. By now you have noticed my family
> name: Schöön. On airline tickets and boarding passes in the U.S. it
> gets spelled Schoeoen.
Do Swedes do that German thing, too? If you have to write Finnish
without ä and ö, you simply leave out the dots. (On
Den 2016-09-17 skrev Kouli :
> Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode.
>
> Kouli
>
> On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu wrote:
>> Hi, I want to convert strings in which the characters with accents
>> should be converted to the ones without accents. Here is m
Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode.
Kouli
On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu wrote:
> Hi, I want to convert strings in which the characters with accents
> should be converted to the ones without accents. Here is my current
> code.
>
> =
Ben Finney writes:
> The ‘cmp’ implementation must decide *at least* between three
> conditions... The implementation of ‘__lt__’ and the implementation
> of ‘__eq__’ each only need to decide two conditions (true, false).
> If you're saying the latter implementation is somehow *more* expensive
>
Antoon Pardon :
> And when I need some personal object as a key, I can avoid the
> duplication by using some kind of cmp cache when I implement __lt__
> and family.
Yes, that's what you can do in rare, extreme cases where key comparison
takes a long time. For caching, you will simply need to requ
Op 09-04-16 om 17:31 schreef Chris Angelico:
> On Sun, Apr 10, 2016 at 1:24 AM, Antoon Pardon
> wrote:
>>
>> So? I need a structure that can easily give me an answer to the
>> following: Given key1 and key2 what are the the keys between them
>> with their corresponding values. As long as a dict ca
On Sat, Apr 9, 2016, at 07:49, Ben Finney wrote:
> I find that a dubious claim.
>
> The ‘cmp’ implementation must decide *at least* between three
> conditions: less-than, equal-to, greater-than. That is *at least* two
> inflection points.
Yes, but in a sequence it can decide that at each element,
On Sun, Apr 10, 2016 at 1:24 AM, Antoon Pardon
wrote:
> Op 09-04-16 om 16:41 schreef Chris Angelico:
>
>>
>> In this case, you're likely to end up with large branches of your tree
>> that have the same prefix. (And if you don't, your iterations are all
>> going to end early anyway, so the comparis
Op 09-04-16 om 16:41 schreef Chris Angelico:
>
> In this case, you're likely to end up with large branches of your tree
> that have the same prefix. (And if you don't, your iterations are all
> going to end early anyway, so the comparison is cheap.) A data
> structure that takes this into account
Antoon Pardon :
> Now this probably is not a problem most of the times, but when you
> work with tree's this kind of comparison to make a three way decision
> happens often and the lower you descend in the tree, the close your
> argument will be with the keys of the nodes you visit, making it more
On Sun, Apr 10, 2016 at 12:25 AM, Antoon Pardon
wrote:
> Let me give you an artifical example to show what can happen. The keys are all
> iterables of equal lengths with integers as elements.
>
> Then this could be the cmp function:
>
> def cmp(ob1, ob2):
> itr1 = iter(ob1)
> itr2 = iter(o
Op 09-04-16 om 13:49 schreef Ben Finney:
> Antoon Pardon writes:
>
>> You don't seem to understand. I only do two comparisons and no the
>> equality is not necesarrily cheaper.
>>
>> I am talking about the difference between the following two:
>>
>> if arg.key < node.key: # possible expensi
Antoon Pardon writes:
> You don't seem to understand. I only do two comparisons and no the
> equality is not necesarrily cheaper.
>
> I am talking about the difference between the following two:
>
> if arg.key < node.key: # possible expensive computation
> go_left()
> elif arg.k
Op 08-04-16 om 16:25 schreef Chris Angelico:
> On Sat, Apr 9, 2016 at 12:20 AM, Antoon Pardon
> wrote:
>>> You only need ONE comparison, and the other is presumed to be its
>>> opposite. When, in the Python 3 version, would you need to compare
>>> twice?
>>
>> About 50% of the time. When I travers
Ian Kelly :
> On Fri, Apr 8, 2016 at 10:33 AM, Marko Rauhamaa wrote:
>> Ian Kelly :
>>
>>> That's fine for those operations and probably insert, but how do you
>>> search an AVL tree for a specific key without also using __eq__?
>>
>> Not needed:
>>
>>
On Fri, Apr 8, 2016 at 10:33 AM, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> That's fine for those operations and probably insert, but how do you
>> search an AVL tree for a specific key without also using __eq__?
>
> Not needed:
>
> ===
Ian Kelly :
> That's fine for those operations and probably insert, but how do you
> search an AVL tree for a specific key without also using __eq__?
Not needed:
if key < node.key:
look_right()
elif node.key < key:
On Sat, Apr 9, 2016 at 12:22 AM, Ian Kelly wrote:
>> seq1 == seq2
>> seq1 < seq2
>>
>> You only need ONE comparison, and the other is presumed to be its
>> opposite. When, in the Python 3 version, would you need to compare
>> twice?
>
> When there are three possible code paths depending on the res
On Fri, Apr 8, 2016, at 10:08, Chris Angelico wrote:
> seq1 == seq2
> seq1 < seq2
>
> You only need ONE comparison, and the other is presumed to be its
> opposite. When, in the Python 3 version, would you need to compare
> twice?
== might be just as expensive as the others, particularly if the
se
On Sat, Apr 9, 2016 at 12:20 AM, Antoon Pardon
wrote:
>> You only need ONE comparison, and the other is presumed to be its
>> opposite. When, in the Python 3 version, would you need to compare
>> twice?
>
> About 50% of the time. When I traverse the tree I go left when the
> argument key is smalle
On Fri, Apr 8, 2016 at 8:08 AM, Chris Angelico wrote:
> On Fri, Apr 8, 2016 at 11:31 PM, Antoon Pardon
> wrote:
>> Doing it as follows:
>> seq1 < seq2
>> seq2 < seq1
>>
>> takes about 110 seconds.
>>
>>
>> Doing it like this:
>> delta = cmp(seq1, seq2)
>> delta < 0
>> delta >
Op 08-04-16 om 15:52 schreef Marko Rauhamaa:
> Antoon Pardon :
>
>> Well having a list of 1000 Sequence like object. Each sequence
>> containing between 1 and 100 numbers. Comparing each sequence
>> to each other a 100 times. I get the following results.
>>
>> Doing it as follows:
>> seq1 < seq
Op 08-04-16 om 16:08 schreef Chris Angelico:
> On Fri, Apr 8, 2016 at 11:31 PM, Antoon Pardon
> wrote:
>> Doing it as follows:
>> seq1 < seq2
>> seq2 < seq1
>>
>> takes about 110 seconds.
>>
>>
>> Doing it like this:
>> delta = cmp(seq1, seq2)
>> delta < 0
>> delta > 0
>>
>> ta
On Fri, Apr 8, 2016 at 3:23 AM, Steven D'Aprano wrote:
> On Fri, 8 Apr 2016 06:34 pm, Marko Rauhamaa wrote:
>
>> Antoon Pardon :
>>
>>> In python2 descending the tree would only involve at most one
>>> expensive comparison, because using cmp would codify that comparison
>>> into an integer which w
On Fri, Apr 8, 2016 at 11:31 PM, Antoon Pardon
wrote:
> Doing it as follows:
> seq1 < seq2
> seq2 < seq1
>
> takes about 110 seconds.
>
>
> Doing it like this:
> delta = cmp(seq1, seq2)
> delta < 0
> delta > 0
>
> takes about 50 seconds.
Why are you comparing in both direction
Antoon Pardon :
> Well having a list of 1000 Sequence like object. Each sequence
> containing between 1 and 100 numbers. Comparing each sequence
> to each other a 100 times. I get the following results.
>
> Doing it as follows:
> seq1 < seq2
> seq2 < seq1
>
> takes about 110 seconds.
>
> D
Op 08-04-16 om 09:47 schreef Ben Finney:
> Antoon Pardon writes:
>
>> But it was already working and optimized. The python3 approach forces
>> me to make changes to working code and make the performance worse.
> Yes, changing from Python 2 to Python 3 entails changing working code,
> and entails d
Steven D'Aprano :
> I would be stunned if tuple comparisons with only a handful of values
> were slow enough that its worth caching their results with an
> lru_cache. But try it, and see how you go.
There are two ways your Python program can be slow:
* You are doing something stupid like an O(e
On Fri, 8 Apr 2016 05:45 pm, Antoon Pardon wrote:
> Op 07-04-16 om 23:08 schreef Ben Finney:
>> Antoon Pardon writes:
>>
>>> With this method I have to traverse the two tuples almost always
>>> twice. Once to find out if they are equal and if not a second time to
>>> find out which is greater.
>>
On Fri, 8 Apr 2016 05:35 pm, Antoon Pardon wrote:
> Op 08-04-16 om 00:21 schreef Chris Angelico:
>> On Fri, Apr 8, 2016 at 6:56 AM, Antoon Pardon
>> wrote:
>>> That solution will mean I will have to do about 100% more comparisons
>>> than previously.
>> Try it regardless. You'll probably find tha
On Fri, 8 Apr 2016 06:34 pm, Marko Rauhamaa wrote:
> Antoon Pardon :
>
>> In python2 descending the tree would only involve at most one
>> expensive comparison, because using cmp would codify that comparison
>> into an integer which would then be cheap to compare with 0. Now in
>> python3, I may
Marko Rauhamaa writes:
> With AVL trees, it's easier to be convinced about worst-case
> performance.
I'd have thought the main reason to use AVL trees was persistence, so
you could have multiple slightly different trees sharing most of their
structures.
> It is more difficult to see the potentia
Antoon Pardon :
> In python2 descending the tree would only involve at most one
> expensive comparison, because using cmp would codify that comparison
> into an integer which would then be cheap to compare with 0. Now in
> python3, I may need to do two expensive comparisons, because there is
> no
Antoon Pardon writes:
> Op 07-04-16 om 23:08 schreef Ben Finney:
> > You are essentially describing the new internal API of comparison
> > operators. That's pretty much unavoidable.
>
> And nobody thought about this kind of cases
I'm quite confident the API changes were thought about by many peo
Antoon Pardon writes:
> But it was already working and optimized. The python3 approach forces
> me to make changes to working code and make the performance worse.
Yes, changing from Python 2 to Python 3 entails changing working code,
and entails different implementations for some things.
As for
Op 07-04-16 om 23:08 schreef Ben Finney:
> Antoon Pardon writes:
>
>> With this method I have to traverse the two tuples almost always
>> twice. Once to find out if they are equal and if not a second time to
>> find out which is greater.
> You are essentially describing the new internal API of com
Paul Rubin :
> Marko Rauhamaa writes:
>> On the surface, the garbage collection scheme looks dubious, but
>> maybe it works perfect in practice.
>
> It looked suspicious at first glance but I think it is ok. Basically
> on at most every timeout event (scheduling, expiration, or
> cancellation), i
On Fri, Apr 8, 2016 at 5:35 PM, Antoon Pardon
wrote:
> Op 08-04-16 om 00:21 schreef Chris Angelico:
>> On Fri, Apr 8, 2016 at 6:56 AM, Antoon Pardon
>> wrote:
>>> That solution will mean I will have to do about 100% more comparisons
>>> than previously.
>> Try it regardless. You'll probably find
Op 08-04-16 om 00:21 schreef Chris Angelico:
> On Fri, Apr 8, 2016 at 6:56 AM, Antoon Pardon
> wrote:
>> That solution will mean I will have to do about 100% more comparisons
>> than previously.
> Try it regardless. You'll probably find that performance is fine.
> Don't prematurely optimize!
>
> C
Marko Rauhamaa writes:
> On the surface, the garbage collection scheme looks dubious, but maybe
> it works perfect in practice.
It looked suspicious at first glance but I think it is ok. Basically on
at most every timeout event (scheduling, expiration, or cancellation),
it does an O(n) operation
Terry Reedy :
> On 4/8/2016 12:22 AM, Marko Rauhamaa wrote:
>> The issue is known. It has been tackled with a kind of a "garbage
>> collection" scheme:
>>
>> https://bugs.python.org/issue22448>
>
> and fixed 1 1/2 years ago.
On the surface, the garbage collection scheme looks dubious, but may
On 4/8/2016 12:22 AM, Marko Rauhamaa wrote:
Paul Rubin :
Marko Rauhamaa writes:
Guido chose a different method to implement timers for asyncio. He
decided to never remove canceled timers.
Only initially. He approved a change immediately when presented with a
concrete problem.
Oh my, th
On 4/7/2016 3:32 PM, Marko Rauhamaa wrote:
I use AVL trees to implement timers. You need to be able to insert
elements in a sorted order and remove them quickly.
Guido chose a different method to implement timers for asyncio. He
decided to never remove canceled timers.
In 3.5.1, asyncio.base_
Ian Kelly :
> On Apr 7, 2016 10:22 PM, "Marko Rauhamaa" wrote:
>> The keys are expiry times. You could use numbers or you could use
>> datetime objects.
>
> Yes, but why would you want to use both?
I was never talking about mixing key types. I was simply reacting (out
of context) to a suggestion
On Apr 7, 2016 10:22 PM, "Marko Rauhamaa" wrote:
>
> Ian Kelly :
>
> > On Thu, Apr 7, 2016 at 1:32 PM, Marko Rauhamaa wrote:
> >> I use AVL trees to implement timers. You need to be able to insert
> >> elements in a sorted order and remove them quickly.
> >
> > Why would AVL trees implementing ti
Paul Rubin :
> Marko Rauhamaa writes:
>> Guido chose a different method to implement timers for asyncio. He
>> decided to never remove canceled timers.
>
> Oh my, that might not end well. There are other approaches that don't
> need AVL trees and can remove cancelled timers, e.g. "timer wheels" a
Ian Kelly :
> On Thu, Apr 7, 2016 at 1:32 PM, Marko Rauhamaa wrote:
>> I use AVL trees to implement timers. You need to be able to insert
>> elements in a sorted order and remove them quickly.
>
> Why would AVL trees implementing timers ever need non-numeric keys
> though?
>
> It seems to me that
On 07/04/2016 21:56, Antoon Pardon wrote:
Op 07-04-16 om 14:22 schreef Chris Angelico:
...
There's no __cmp__ method, but you could easily craft your own
compare() function:
def compare(x, y):
"""Return a number < 0 if x < y, or > 0 if x > y"""
if x == y: return 0
return -1 if
On Thu, Apr 7, 2016 at 2:56 PM, Antoon Pardon
wrote:
> Op 07-04-16 om 14:22 schreef Chris Angelico:
>
> ...
>
>> There's no __cmp__ method, but you could easily craft your own
>> compare() function:
>>
>> def compare(x, y):
>> """Return a number < 0 if x < y, or > 0 if x > y"""
>> if x ==
On Thu, Apr 7, 2016 at 1:32 PM, Marko Rauhamaa wrote:
> Paul Rubin :
>
>> Chris Angelico writes:
>>> First off, what does it actually *mean* to have a tree with numbers
>>> and keys as strings? Are they ever equal? Are all integers deemed
>>> lower than all strings? Something else?
>>
>> If the A
On Fri, Apr 8, 2016 at 6:56 AM, Antoon Pardon
wrote:
>
> That solution will mean I will have to do about 100% more comparisons
> than previously.
Try it regardless. You'll probably find that performance is fine.
Don't prematurely optimize!
ChrisA
--
https://mail.python.org/mailman/listinfo/pyth
Marko Rauhamaa writes:
> Guido chose a different method to implement timers for asyncio. He
> decided to never remove canceled timers.
Oh my, that might not end well. There are other approaches that don't
need AVL trees and can remove cancelled timers, e.g. "timer wheels" as
used in Erlang and f
Antoon Pardon writes:
> With this method I have to traverse the two tuples almost always
> twice. Once to find out if they are equal and if not a second time to
> find out which is greater.
You are essentially describing the new internal API of comparison
operators. That's pretty much unavoidabl
Op 07-04-16 om 14:22 schreef Chris Angelico:
...
> There's no __cmp__ method, but you could easily craft your own
> compare() function:
>
> def compare(x, y):
> """Return a number < 0 if x < y, or > 0 if x > y"""
> if x == y: return 0
> return -1 if keyify(x) < keyify(y) else 1
>
>
On Fri, Apr 8, 2016 at 5:26 AM, Paul Rubin wrote:
> Chris Angelico writes:
>> First off, what does it actually *mean* to have a tree with numbers
>> and keys as strings? Are they ever equal? Are all integers deemed
>> lower than all strings? Something else?
>
> If the AVL tree's purpose is to be
Paul Rubin :
> Chris Angelico writes:
>> First off, what does it actually *mean* to have a tree with numbers
>> and keys as strings? Are they ever equal? Are all integers deemed
>> lower than all strings? Something else?
>
> If the AVL tree's purpose is to be an alternative lookup structure to
>
Chris Angelico writes:
> First off, what does it actually *mean* to have a tree with numbers
> and keys as strings? Are they ever equal? Are all integers deemed
> lower than all strings? Something else?
If the AVL tree's purpose is to be an alternative lookup structure to
Python's hash-based dict
On 07/04/2016 13:05, Antoon Pardon wrote:
I am looking at my avltree module for converting it to
python3.
One of the things that trouble me here is how python3 no
longer has cmp and how things have to be of "compatible"
type in order to be comparable.
So in python2 it wasn't a problem to have a
On Thu, Apr 7, 2016 at 10:05 PM, Antoon Pardon
wrote:
> I am looking at my avltree module for converting it to
> python3.
>
> One of the things that trouble me here is how python3 no
> longer has cmp and how things have to be of "compatible"
> type in order to be comparable.
>
> So in python2 it w
On Tuesday 14 April 2015 07:54:58 David H. Lipman wrote:
> From: "traciscrouch"
>
> > A lot will be helped by an effective solution to change PDF to
> > workplace
>
> Once again this project was spammed.
>
> All users are encouraged to file a complaint with SourceForge.
> ab...@sourceforge.net
>
G
1 - 100 of 430 matches
Mail list logo