Python 3.10.0a6 is available, now with 100% more pattern matching

2021-03-02 Thread Pablo Galindo Salgado
Remember us? It's your friendly CPython release team and we have something we think you may like: The new alpha release of Python 3.10 is here, now with 100% more pattern matching. If I were you, I would download it and start playing with it. Extra points if you report us any bugs you find

[RELEASE] Python 3.10.0a6 is available, now with 100% more pattern matching

2021-03-02 Thread Pablo Galindo Salgado
Remember us? It's your friendly CPython release team and we have something we think you may like: The new alpha release of Python 3.10 is here, now with 100% more pattern matching. If I were you, I would download it and start playing with it. Extra points if you report us any bugs you find

asyncio cancellation pattern

2020-12-28 Thread Joseph L. Casale
I've started writing some asyncio code in lieu of using threads and managing concurrency and primitives manually. Having spent a lot of time using c#'s async implementation, I am struggling to see an elegant pattern for implementing cancellation. With the necessity for the loop (that

Re: Does this behavior have a better design pattern?

2018-11-08 Thread Peter Otten
Grant Edwards wrote: > On 2018-11-07, Peter Otten <__pete...@web.de> wrote: >> lampahome wrote: >> >>> Above is I thought to make code clear, and this pattern is called simple >>> factory? > > [...] > >>> *Is there better design pattern f

Re: Does this behavior have a better design pattern?

2018-11-08 Thread Grant Edwards
On 2018-11-07, Peter Otten <__pete...@web.de> wrote: > lampahome wrote: > >> Above is I thought to make code clear, and this pattern is called simple >> factory? [...] >> *Is there better design pattern for me?* > Generally speaking you get better solutions when

Re: Does this behavior have a better design pattern?

2018-11-07 Thread lampahome
> > > The rest is just cruft ;) > > > > *Is there better design pattern for me?* > > If A does B to C, is that a crime? > No > Your problem description suffers from overgeneralisation. > > Generally speaking you get better solutions when you ask yours

Re: Does this behavior have a better design pattern?

2018-11-07 Thread Peter Otten
lampahome wrote: > Above is I thought to make code clear, and this pattern is called simple > factory? This is a factory function: > def get_class(obj): > if obj == 'A1' or obj == 'A2': > return A(obj) > else: > return B(obj)

Does this behavior have a better design pattern?

2018-11-07 Thread lampahome
) # B = get_class(B2) - Above is I thought to make code clear, and this pattern is called simple factory? *Is there better design pattern for me?* thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: regex pattern to extract repeating groups

2018-08-27 Thread MRAB
On 2018-08-28 00:58, Malcolm wrote: On 28/08/2018 7:09 AM, John Pote wrote: On 26/08/2018 00:55, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do

Re: regex pattern to extract repeating groups

2018-08-27 Thread Malcolm
On 28/08/2018 7:09 AM, John Pote wrote: On 26/08/2018 00:55, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy a

Re: regex pattern to extract repeating groups

2018-08-27 Thread John Pote
On 26/08/2018 00:55, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy and possibly not future proof. Do you mean f

Re: regex pattern to extract repeating groups

2018-08-27 Thread Rob Gaddi
On 08/25/2018 04:55 PM, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy and possibly not future proof. Any insig

regex pattern to extract repeating groups

2018-08-27 Thread Malcolm
I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy and possibly not future proof. Any insight greatly appreciated. Malcolm My tes

What is the pattern?

2018-08-22 Thread no
I asked this before but my Usenet reader only saves messages for 30 days. I still can't get the pattern for this chart. I started working on the code that should print it, but I never remembered how to do it. empire={6:"Infantry",12:"Armor/Fighter",30:"Trans

Re: pattern block expression matching

2018-07-22 Thread aldi . kraja
Thank you all for thoughtful excellent updates! Aldi -- https://mail.python.org/mailman/listinfo/python-list

Re: pattern block expression matching

2018-07-21 Thread Dan Sommers
On Sat, 21 Jul 2018 17:37:00 +0100, MRAB wrote: > On 2018-07-21 15:20, aldi.kr...@gmail.com wrote: >> Hi, >> I have a long text, which tells me which files from a database were >> downloaded and which ones failed. The pattern is as follows (at the end of >> this post)

Re: pattern block expression matching

2018-07-21 Thread Peter Otten
MRAB wrote: > On 2018-07-21 15:20, aldi.kr...@gmail.com wrote: >> Hi, >> I have a long text, which tells me which files from a database were >> downloaded and which ones failed. The pattern is as follows (at the end >> of this post). Wrote a tiny program, but still is

Re: pattern block expression matching

2018-07-21 Thread MRAB
On 2018-07-21 15:20, aldi.kr...@gmail.com wrote: Hi, I have a long text, which tells me which files from a database were downloaded and which ones failed. The pattern is as follows (at the end of this post). Wrote a tiny program, but still is raw. I want to find term "ERROR" and

pattern block expression matching

2018-07-21 Thread aldi . kraja
Hi, I have a long text, which tells me which files from a database were downloaded and which ones failed. The pattern is as follows (at the end of this post). Wrote a tiny program, but still is raw. I want to find term "ERROR" and go 5 lines above and get the name with suffix XPT, in

Re: What is the pattern for this number set?

2018-07-18 Thread no
hart but I no longer can >>figure out programming or math. >>Anyone care to figure out the pattern and make a new copy of the >>chart? >> >>https://imgur.com/a/thF6U43 > > >I don't remember how I did it. >It is from the game Empire. There is a new versi

Re: What is the pattern for this number set?

2018-07-18 Thread no
figure out the pattern and make a new copy of the >chart? > >https://imgur.com/a/thF6U43 I don't remember how I did it. It is from the game Empire. There is a new version of it on Steam called Empire Deluxe Combined Edition. I played the game relentlessly from the 90s until I upgraded

Re: What is the pattern for this number set?

2018-07-18 Thread Peter Pearson
On Wed, 18 Jul 2018 17:16:21 -0400, no@none.invalid wrote: [snip] > Anyone care to figure out the pattern and make a new copy of the > chart? > > https://imgur.com/a/thF6U43 I've only looked at infantry and carrier, but those two seem to be fairly well approximated by y = a + 1

Re: What is the pattern for this number set?

2018-07-18 Thread no
hart but I no longer can >>figure out programming or math. >>Anyone care to figure out the pattern and make a new copy of the >>chart? >> >>https://imgur.com/a/thF6U43 > > >I don't remember how I did it. >It is from the game Empire. There is a new versi

Re: What is the pattern for this number set?

2018-07-18 Thread Thomas Jollans
th and programming. >>>> I would like to have a new print out of this chart but I no longer can >>>> figure out programming or math. >>>> Anyone care to figure out the pattern and make a new copy of the >>>> chart? >>>> >>>>

Re: What is the pattern for this number set?

2018-07-18 Thread Ian Kelly
AM, wrote: > >> This is a chart I made using BASIC back in the 90s when I could still > >> do math and programming. > >> I would like to have a new print out of this chart but I no longer can > >> figure out programming or math. > >> Anyone care to fig

Re: What is the pattern for this number set?

2018-07-18 Thread Thomas Jollans
ure out programming or math. >> Anyone care to figure out the pattern and make a new copy of the >> chart? >> >> https://imgur.com/a/thF6U43 > > Oh that looks like fun! Some sort of game analysis, I presume. > Unfortunately I don't see enough info there

Re: What is the pattern for this number set?

2018-07-18 Thread Chris Angelico
On Thu, Jul 19, 2018 at 7:16 AM, wrote: > This is a chart I made using BASIC back in the 90s when I could still > do math and programming. > I would like to have a new print out of this chart but I no longer can > figure out programming or math. > Anyone care to figure out the pat

What is the pattern for this number set?

2018-07-18 Thread no
This is a chart I made using BASIC back in the 90s when I could still do math and programming. I would like to have a new print out of this chart but I no longer can figure out programming or math. Anyone care to figure out the pattern and make a new copy of the chart? https://imgur.com/a/thF6U43

Re: pattern

2018-06-16 Thread Cameron Simpson
o put in print() calls at various places, eg: print("iterate over traing_data =", repr(training_data)) for pattern in training_data: # tokenize each word in the sentence print("pattern =", repr(pattern)) w = nltk.word_tokenize(pattern['sentence']

Re: pattern

2018-06-16 Thread Sharan Basappa
TC+5:30, Cameron Simpson wrote: > On 14Jun2018 20:01, Sharan Basappa wrote: > >> >Can anyone explain to me the purpose of "pattern" in the line below: > >> > > >> >documents.append((w, pattern['class'])) > >> > > >> &g

Re: pattern

2018-06-14 Thread Cameron Simpson
On 14Jun2018 20:01, Sharan Basappa wrote: >Can anyone explain to me the purpose of "pattern" in the line below: > >documents.append((w, pattern['class'])) > >documents is declared as a list as follows: >documents.append((w, pattern['class'])) No

Re: pattern

2018-06-14 Thread Sharan Basappa
> >Can anyone explain to me the purpose of "pattern" in the line below: > > > >documents.append((w, pattern['class'])) > > > >documents is declared as a list as follows: > >documents.append((w, pattern['class'])) > > Not with

Re: pattern

2018-06-14 Thread Cameron Simpson
On 13Jun2018 19:51, Sharan Basappa wrote: Can anyone explain to me the purpose of "pattern" in the line below: documents.append((w, pattern['class'])) documents is declared as a list as follows: documents.append((w, pattern['class'])) Not without a lot more co

pattern

2018-06-13 Thread Sharan Basappa
Can anyone explain to me the purpose of "pattern" in the line below: documents.append((w, pattern['class'])) documents is declared as a list as follows: documents.append((w, pattern['class'])) -- https://mail.python.org/mailman/listinfo/python-list

RE: Python regex pattern from array of hex chars

2018-04-13 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of MRAB Sent: Friday, April 13, 2018 12:05 PM To: python-list@python.org Subject: Re: Python regex pattern from array of hex chars > Use re.escape: > > regex = re.compile('[^{}]+'.format(re.escape(''.join

Re: Python regex pattern from array of hex chars

2018-04-13 Thread MRAB
On 2018-04-13 18:28, Joseph L. Casale wrote: I have an array of hex chars which designate required characters. and one happens to be \x5C or "\". What foo is required to build the pattern to exclude all but: regex = re.compile('[^{}]+'.format(''.join(c for c in c

Python regex pattern from array of hex chars

2018-04-13 Thread Joseph L. Casale
I have an array of hex chars which designate required characters. and one happens to be \x5C or "\". What foo is required to build the pattern to exclude all but: regex = re.compile('[^{}]+'.format(''.join(c for c in character_class))) I would use that in a re.sub t

Re: Pep8 for long pattern

2018-03-28 Thread Rhodri James
On 27/03/18 22:02, Dan Stromberg wrote: On Tue, Mar 27, 2018 at 8:18 AM, Michael Torrie wrote: But when it's exactly what you need, why do you need to shoehorn the expression into 79 characters? Seems pointless in a case like this. PEP8 is a guideline, not an absolute rule. It's okay to bend

Re: Pep8 for long pattern

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 9:37:14 PM UTC-5, Dan Stromberg wrote: > I can easily get 132+ columns of a font large enough for my > 52 year old eyes on a 15" laptop. Well, if you're comfortable with the long lines, fine. But be aware that long lines are poo-pooed in most professional enviroments.

Re: Pep8 for long pattern

2018-03-27 Thread Dan Stromberg
On Tue, Mar 27, 2018 at 4:37 PM, Rick Johnson wrote: > On Tuesday, March 27, 2018 at 4:02:37 PM UTC-5, Dan Stromberg wrote: >> On Tue, Mar 27, 2018 at 8:18 AM, Michael Torrie wrote: >> > But when it's exactly what you need, why do you need to >> > shoehorn the expression into 79 characters? Seem

Re: Pep8 for long pattern

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 4:02:37 PM UTC-5, Dan Stromberg wrote: > On Tue, Mar 27, 2018 at 8:18 AM, Michael Torrie wrote: > > But when it's exactly what you need, why do you need to > > shoehorn the expression into 79 characters? Seems > > pointless in a case like this. PEP8 is a guideline, n

Re: Pep8 for long pattern

2018-03-27 Thread Dan Stromberg
On Tue, Mar 27, 2018 at 8:18 AM, Michael Torrie wrote: > But when it's exactly what you need, why do > you need to shoehorn the expression into 79 characters? Seems pointless > in a case like this. PEP8 is a guideline, not an absolute rule. It's > okay to bend it a bit in cases like this. I thi

Re: Pep8 for long pattern

2018-03-27 Thread Michael Torrie
On 03/27/2018 08:17 AM, Ganesh Pal wrote: > Hello Python friends, > > How do I split the below regex , so that it fits within the character > limit of 79 words > > > pattern = [ > r'(?P([0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+::HEAD))

Re: Pep8 for long pattern

2018-03-27 Thread Serhiy Storchaka
27.03.18 17:17, Ganesh Pal пише: How do I split the below regex , so that it fits within the character limit of 79 words pattern = [ r'(?P([0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+::HEAD))', r'(?P(owner:\s+[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA

Re: Pep8 for long pattern

2018-03-27 Thread Paul Moore
Use re.X - see https://docs.python.org/3.6/library/re.html#re.X for details. On 27 March 2018 at 15:17, Ganesh Pal wrote: > Hello Python friends, > > How do I split the below regex , so that it fits within the character > limit of 79 words > > > pattern = [ > r'(?P

Pep8 for long pattern

2018-03-27 Thread Ganesh Pal
Hello Python friends, How do I split the below regex , so that it fits within the character limit of 79 words pattern = [ r'(?P([0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+::HEAD))', r'(?P(owner:\s+[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-

Re: Is there are good DRY fix for this painful design pattern?

2018-03-01 Thread Jugurtha Hadjar
On 03/01/2018 10:34 AM, Gregory Ewing wrote: After this thread, the term "docstring" is never going to mean quite the same thing to me again. I still feel that the following is quite readable: <---> import inspect def snatch(func):     def snatched(self, *arg

Re: Is there are good DRY fix for this painful design pattern?

2018-03-01 Thread Gregory Ewing
After this thread, the term "docstring" is never going to mean quite the same thing to me again. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there are good DRY fix for this painful design pattern?

2018-02-27 Thread Tim Chase
Something like the following might do the trick. As an added benefit, it's easy to set all the defaults automatically in __init__ as well without hand-adding "self.dopey = dopey". On the down side, in the non-__init__ functions, you have to use kwargs["dopey"] and the like. It also involves tackin

Re: Is there are good DRY fix for this painful design pattern?

2018-02-27 Thread Jugurtha Hadjar
On 02/26/2018 03:41 PM, Steven D'Aprano wrote: I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as the constructor/initialiser parameters. If those arguments are None,

Re: Is there are good DRY fix for this painful design pattern?

2018-02-27 Thread Kirill Balunov
Of course you can do the same without annotations, but with the introduction of private attribute while your API it is under active development: from functools import wraps def validate(func): @wraps(func) def _wrap(self, *args, **kwargs): variables = self._vars # Here kw

Re: Is there are good DRY fix for this painful design pattern?

2018-02-27 Thread Kirill Balunov
This validation can be also done with the use of annotations, while I find it super awful, I put this for one more example: from functools import wraps def validate(func): @wraps(func) def _wrap(self, *args, **kwargs): variables = func.__annotations__.keys() kwargs.update(z

Re: Is there are good DRY fix for this painful design pattern?

2018-02-27 Thread Wolfgang Maier
On 26.02.2018 15:41, Steven D'Aprano wrote: I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as the constructor/initialiser parameters. If those arguments are None, the

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Ben Finney
Steven D'Aprano writes: > Interesting, I'll certainly have a good read of that, thanks. But I > fear I mislead you: you seem to have understood that either all the > parameters are None, or none of them are, whereas what I meant was > that they can vary independently of each other. I think that

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Steven D'Aprano
On Tue, 27 Feb 2018 09:15:12 +1100, Ben Finney wrote: > Steven D'Aprano writes: > >> I have a class with a large number of parameters (about ten) assigned >> in `__init__`. The class then has a number of methods which accept >> *optional* arguments with the same names as the constructor/initiali

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Steven D'Aprano
On Mon, 26 Feb 2018 16:23:39 -0800, Rick Johnson wrote: > On Monday, February 26, 2018 at 5:44:18 PM UTC-6, MRAB wrote: [...] >> Before using or'd-logic, you need to know whether the value could be >> falsey, e.g. 0. > > True. However. Steven failed to provide any info that might help us > determ

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Steven D'Aprano
On Mon, 26 Feb 2018 17:39:43 +0100, Peter Otten wrote: [...] > I have not yet looked into dataclasses. Don't they handle the __init__() > part? Anyway, here's my attempt to make spam() less spammy: I'm not too concerned about __init__, it's only one method :-) > $ cat attrs_to_args_decorator.p

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Rick Johnson
On Monday, February 26, 2018 at 5:44:18 PM UTC-6, MRAB wrote: [...] > Before using or'd-logic, you need to know whether the value > could be falsey, e.g. 0. True. However. Steven failed to provide any info that might help us determine the types of these parameters, and as such, i was forced to tak

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread MRAB
On 2018-02-26 21:12, Rick Johnson wrote: On Monday, February 26, 2018 at 8:44:14 AM UTC-6, Steven D'Aprano wrote: I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as t

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Ben Finney
Steven D'Aprano writes: > I have a class with a large number of parameters (about ten) assigned > in `__init__`. The class then has a number of methods which accept > *optional* arguments with the same names as the > constructor/initialiser parameters. If those arguments are None, the > defaults

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 2:37 PM, Ian Kelly wrote: > On Mon, Feb 26, 2018 at 1:09 PM, wrote: >> def foo(self, *args, **kwargs): >> assert len(args) == 0 > > Better: > > def foo(self, **kwargs): > >> So, use the inspect module to detect the valid arguments >> from the class initializer

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 1:09 PM, wrote: > def foo(self, *args, **kwargs): > assert len(args) == 0 Better: def foo(self, **kwargs): > So, use the inspect module to detect the valid arguments > from the class initializer. Then use **kwargs in every > class method. It would be nice if

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Rick Johnson
On Monday, February 26, 2018 at 8:44:14 AM UTC-6, Steven D'Aprano wrote: > I have a class with a large number of parameters (about > ten) assigned in `__init__`. The class then has a number of > methods which accept *optional* arguments with the same > names as the constructor/initialiser parameter

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread marco . nawijn
On Monday, February 26, 2018 at 3:44:14 PM UTC+1, Steven D'Aprano wrote: > I have a class with a large number of parameters (about ten) assigned in > `__init__`. The class then has a number of methods which accept > *optional* arguments with the same names as the constructor/initialiser > parame

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 8:06 AM, Chris Angelico wrote: > On Tue, Feb 27, 2018 at 1:41 AM, Steven D'Aprano > wrote: >> I have a class with a large number of parameters (about ten) assigned in >> `__init__`. The class then has a number of methods which accept >> *optional* arguments with the same n

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Peter Otten
Steven D'Aprano wrote: > I have a class with a large number of parameters (about ten) assigned in > `__init__`. The class then has a number of methods which accept > *optional* arguments with the same names as the constructor/initialiser > parameters. If those arguments are None, the defaults are

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Rob Gaddi
On 02/26/2018 07:28 AM, Rhodri James wrote: On 26/02/18 14:41, Steven D'Aprano wrote: I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as the constructor/initialiser p

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Rhodri James
On 26/02/18 14:41, Steven D'Aprano wrote: I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as the constructor/initialiser parameters. If those arguments are None, the d

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Antoon Pardon
On 26-02-18 15:41, Steven D'Aprano wrote: > I have a class with a large number of parameters (about ten) assigned in > `__init__`. The class then has a number of methods which accept > *optional* arguments with the same names as the constructor/initialiser > parameters. If those arguments are No

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Vincent Vande Vyvre
Le 26/02/18 à 15:41, Steven D'Aprano a écrit : I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as the constructor/initialiser parameters. If those arguments are None,

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Chris Angelico
On Tue, Feb 27, 2018 at 1:41 AM, Steven D'Aprano wrote: > I have a class with a large number of parameters (about ten) assigned in > `__init__`. The class then has a number of methods which accept > *optional* arguments with the same names as the constructor/initialiser > parameters. If those argu

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Antoon Pardon
On 26-02-18 15:41, Steven D'Aprano wrote: > I have a class with a large number of parameters (about ten) assigned in > `__init__`. The class then has a number of methods which accept > *optional* arguments with the same names as the constructor/initialiser > parameters. If those arguments are No

Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Steven D'Aprano
I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as the constructor/initialiser parameters. If those arguments are None, the defaults are taken from the instance attr

Re: [Python-ideas] "Immutable Builder" Pattern and Operator

2017-01-23 Thread breamoreboy
On Monday, January 23, 2017 at 2:11:53 PM UTC, M.-A. Lemburg wrote: > On 23.01.2017 14:28, Soni L. wrote: > > > > > > On 23/01/17 11:18 AM, M.-A. Lemburg wrote: > >> On 23.01.2017 14:05, Soni L. wrote: > >>> Yeah but the dotequals operator has many other benefits: > >>> > >>> long_name .= __call_

Re: [Python-ideas] "Immutable Builder" Pattern and Operator

2017-01-23 Thread M.-A. Lemburg
On 23.01.2017 14:28, Soni L. wrote: > > > On 23/01/17 11:18 AM, M.-A. Lemburg wrote: >> On 23.01.2017 14:05, Soni L. wrote: >>> Yeah but the dotequals operator has many other benefits: >>> >>> long_name .= __call__ # cast to callable >>> long_name .= wrapped # unwrap >>> etc >>> >>> And it also

Python Guarded Pattern matching (when x -> do action)

2016-11-15 Thread ygutfreund
I am looking to see if there is prior work, or design ideas for implementing pattern-matched guard statements in a very natural format for python programmers. For those not familiar with pattern matching in [SCALA][1], [Erlang][2], or [F#][3] They all have constructs similiar to: When

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-10 Thread Rustom Mody
ttps://mail.python.org/pipermail//python-ideas/2014-October/029630.htm > >>> > >>> Wanted to know if the above link idea, had been implemented and if > >>> there's a module that accepts a pattern like 'cap' and give you all > &g

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-10 Thread Tim Golden
On 10/09/2016 11:26, Veek 'this_is_not_my_name' M wrote: Veek 'this_is_not_my_name' M wrote: /me claps TJG -- https://mail.python.org/mailman/listinfo/python-list

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-10 Thread Veek 'this_is_not_my_name' M
ink idea, had been implemented and if >>> there's a module that accepts a pattern like 'cap' and give you all >>> the instances of unicode 'CAP' characters. >>> ⋂ \bigcap >>> ⊓ \sqcap >>> ∩ \cap >>> ♑ \capricornus &

Re: Extend unicodedata with a name/pattern/regex search for character

2016-09-06 Thread jladasky
From: jlada...@itu.edu On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: > > Killfile him and move on... > > But but but... I couldn't do that. > > https://www.xkcd.com/386/ I strongly suspected it would be that particu

Re: Extend unicodedata with a name/pattern/regex search for character

2016-09-06 Thread jladasky
On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: > > Killfile him and move on... > > But but but... I couldn't do that. > > https://www.xkcd.com/386/ I strongly suspected it would be that particular XKCD. :^) -- http

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-06 Thread jladasky
On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: > > Killfile him and move on... > > But but but... I couldn't do that. > > https://www.xkcd.com/386/ I strongly suspected it would be that particular XKCD. :^) -- htt

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-06 Thread Veek 'this_is_not_my_name' M
Rustom Mody wrote: > On Saturday, September 3, 2016 at 5:25:48 PM UTC+5:30, Veek. M wrote: >> https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm >> >> Wanted to know if the above link idea, had been implemented and if >> there's a module that

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-05 Thread Ned Batchelder
On Monday, September 5, 2016 at 2:15:58 AM UTC-4, Thomas 'PointedEars' Lahn wrote: > How can I trust a person > who does not even have the decency and the courage to stand by their > statements with their real name? Feel free to ignore people you don't trust. We'll help them. --Ned. -- https

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-05 Thread alister
On Mon, 05 Sep 2016 08:15:42 +0200, Thomas 'PointedEars' Lahn wrote: > >> So Veek should be able to appease P.E. by calling himself 'Veek "David >> Smith" M'. > > That would not help. “Veek” might be (the transcription of) a given > name or a family name, but “Veek M” is not a real name. [Real

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-05 Thread Veek. M
Thomas 'PointedEars' Lahn wrote: > Gregory Ewing wrote: > >> Larry Hudson wrote: >>> If you continue to read this forum, you will quickly learn to ignore >>> "Pointy-Ears". He rarely has anything worth while to post, and his >>> unique fetish about Real Names shows him to be a hypocrite as well.

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Michael Torrie
On 09/04/2016 04:22 PM, Gregory Ewing wrote: > Larry Hudson wrote: >> If you continue to read this forum, you will quickly learn to ignore >> "Pointy-Ears". He rarely has anything worth while to post, and his >> unique fetish about Real Names shows him to be a hypocrite as well. > > To be fair,

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Ned Batchelder
On Sunday, September 4, 2016 at 7:52:44 PM UTC-4, Chris Angelico wrote: > FWIW, hex is much more common for displaying Unicode codepoints than > decimal is. So I'd print it like this (incorporating the 'not CAPITAL' > filter): You are right, I went too quickly, and didn't realize until after I pos

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Chris Angelico
On Mon, Sep 5, 2016 at 9:40 AM, Ned Batchelder wrote: > But, 'CAP' appears in 'CAPITAL', which gives more than 1800 matches: > > >>> for c in range(32, 0x11): > ... try: > ... name = unicodedata.name(chr(c)) > ... except ValueError: > ... continue > ... if

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Ned Batchelder
On Saturday, September 3, 2016 at 7:55:48 AM UTC-4, Veek. M wrote: > https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm > > Wanted to know if the above link idea, had been implemented and if > there's a module that accepts a pattern like 'cap

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Gregory Ewing
Larry Hudson wrote: If you continue to read this forum, you will quickly learn to ignore "Pointy-Ears". He rarely has anything worth while to post, and his unique fetish about Real Names shows him to be a hypocrite as well. To be fair, it's likely that Thomas Lahn is his real name, and he's n

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Larry Hudson via Python-list
On 09/04/2016 09:00 AM, Veek. M wrote: Steve D'Aprano wrote: On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: Regarding the name (From field), my name *is* Veek.M […] Liar. *plonk* You have crossed a line now Thomas. That is absolutely uncalled for. You have absolutely no l

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Veek. M
Steve D'Aprano wrote: > On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: > >>> Regarding the name (From field), my name *is* Veek.M […] >> >> Liar. *plonk* > > You have crossed a line now Thomas. > > That is absolutely uncalled for. You have absolutely no legitimate > reason to b

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: >> Regarding the name (From field), my name *is* Veek.M […] > > Liar. *plonk* You have crossed a line now Thomas. That is absolutely uncalled for. You have absolutely no legitimate reason to believe that Veek is not his or her real

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Rustom Mody
On Sunday, September 4, 2016 at 11:18:07 AM UTC+5:30, Rustom Mody wrote: > On Sunday, September 4, 2016 at 9:32:28 AM UTC+5:30, Veek. M wrote: > > Regarding the name (From field), my name *is* Veek.M though I tend to > > shorten it to Vek.M on Google (i think Veek was taken or some such > > thing

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Jussi Piitulainen
Chris Angelico writes: > On Sun, Sep 4, 2016 at 12:49 PM, Steve D'Aprano > wrote: >> On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: >> >> [...] Please either comply, or give up your stupid and pointless obsession with trying to be the Internet Police for something that isn't even a

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Rustom Mody
On Sunday, September 4, 2016 at 9:32:28 AM UTC+5:30, Veek. M wrote: > Regarding the name (From field), my name *is* Veek.M though I tend to > shorten it to Vek.M on Google (i think Veek was taken or some such > thing). Just to be clear, my parents call me something closely related > to Veek that

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Rustom Mody
On Saturday, September 3, 2016 at 5:25:48 PM UTC+5:30, Veek. M wrote: > https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm > > Wanted to know if the above link idea, had been implemented and if > there's a module that accepts a pattern like 'cap

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Veek. M
… > >> had been implemented > > Probably not. > >> and if there's a module that accepts a pattern like 'cap' and give >> you all the instances of unicode 'CAP' characters. > > I do not know any. > >> ⋂ \bigcap >>

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Chris Angelico
On Sun, Sep 4, 2016 at 12:49 PM, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: > > [...] >>> Please either comply, or give up your stupid and pointless obsession with >>> trying to be the Internet Police for something that isn't even a real >>> rule. >> >> His posts ar

  1   2   3   4   5   6   7   8   9   >