Re: Best search algorithm to find condition within a range

2015-04-08 Thread Chris Angelico
On Thu, Apr 9, 2015 at 12:32 PM, Steven D'Aprano wrote: > - Realistically, who is going to use this? Nobody. I was never suggesting it as a serious option; just threw it out there as another dumb alternative :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Steven D'Aprano
On Wed, 8 Apr 2015 11:49 am, Chris Angelico wrote: > You could use base 1,114,112 fairly readily in any decent modern > programming language. That'll happily represent base one-million. Well, not really... Here is the breakdown of Unicode code points by category, as of Python 3.3: # Other Cc:

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Chris Kaynor
On Wed, Apr 8, 2015 at 3:06 PM, Marko Rauhamaa wrote: > BartC : > >> So the the number 3,012,345, in base 100, could represented in >> text form as the two 'digit': >> >> (3, 12345) >> >> ie. 3*100 + 12345*1. In internal binary, each digit can just be >> stored in the normal form, probabl

Re: Proposal for new minor syntax

2015-04-08 Thread Giorgos Tzampanakis
On 2015-03-28, Rustom Mody wrote: > Dunno if related... > One thing that is a bit laborious in python are object initializers: > > self.attr1 = field1 > self.attr2 = field2 Vim's "visual block" feature is your friend in such cases... Pretty sure that other editors have something equivalent, t

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Marko Rauhamaa
BartC : > So the the number 3,012,345, in base 100, could represented in > text form as the two 'digit': > > (3, 12345) > > ie. 3*100 + 12345*1. In internal binary, each digit can just be > stored in the normal form, probably as one digit per 32-bit integer. > > (I have a big integer libr

Re: Get nesting of regex groups

2015-04-08 Thread Cameron Simpson
On 08Apr2015 21:30, Denis McMahon wrote: On Wed, 08 Apr 2015 22:54:57 +0200, Mattias Ugelvik wrote: Example: re.compile('(?P(?Pa))') How can I detect that 'inner' is a nested group of 'outer'? I know that 'inner' comes later, because I can use the `regex.groupindex` (thanks to your help earli

Re: Get nesting of regex groups

2015-04-08 Thread Denis McMahon
On Wed, 08 Apr 2015 22:54:57 +0200, Mattias Ugelvik wrote: > Example: re.compile('(?P(?Pa))') > > How can I detect that 'inner' is a nested group of 'outer'? I know that > 'inner' comes later, because I can use the `regex.groupindex` (thanks to > your help earlier: > https://mail.python.org/piper

Re: Best search algorithm to find condition within a range

2015-04-08 Thread BartC
On 07/04/2015 23:57, Steven D'Aprano wrote: On Tue, 7 Apr 2015 07:44 pm, jonas.thornv...@gmail.com wrote: I want todo faster baseconversion for very big bases like base 1 000 000, so instead of adding up digits i search it. What digits would you use for base one-million? Base 2 uses 0 1. Ba

Get nesting of regex groups

2015-04-08 Thread Mattias Ugelvik
Example: re.compile('(?P(?Pa))') How can I detect that 'inner' is a nested group of 'outer'? I know that 'inner' comes later, because I can use the `regex.groupindex` (thanks to your help earlier: https://mail.python.org/pipermail/python-list/2015-April/701594.html). After looking a bit around, I

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Mark Lawrence
On 08/04/2015 20:28, jonas.thornv...@gmail.com wrote: Den onsdag 8 april 2015 kl. 19:34:39 UTC+2 skrev Mel Wilson: On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote: There is no need for inventing a new set of characters representing 32-bit numbers. You will not be able to learn them b

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Mark Lawrence
On 08/04/2015 20:36, jonas.thornv...@gmail.com wrote: Den onsdag 8 april 2015 kl. 21:28:34 UTC+2 skrev jonas.t...@gmail.com: Den onsdag 8 april 2015 kl. 19:34:39 UTC+2 skrev Mel Wilson: On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote: There is no need for inventing a new set of char

Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 21:28:34 UTC+2 skrev jonas.t...@gmail.com: > Den onsdag 8 april 2015 kl. 19:34:39 UTC+2 skrev Mel Wilson: > > On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote: > > > > > There is no need for inventing a new set of characters representing > > > 32-bit numbers. Y

Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 19:34:39 UTC+2 skrev Mel Wilson: > On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote: > > > There is no need for inventing a new set of characters representing > > 32-bit numbers. You will not be able to learn them by heart anyway, > > unless they build on a int

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Mel Wilson
On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote: > There is no need for inventing a new set of characters representing > 32-bit numbers. You will not be able to learn them by heart anyway, > unless they build on a interpretation system binaries, decimals. See Jorge Luis Borges, _Funes t

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Denis McMahon
On Tue, 07 Apr 2015 23:18:14 -0700, wxjmfauth wrote: > Le mercredi 8 avril 2015 08:08:04 UTC+2, wxjm...@gmail.com a écrit : >> Le mercredi 8 avril 2015 00:57:27 UTC+2, Steven D'Aprano a écrit : >> > On Tue, 7 Apr 2015 07:44 pm, jonas.thornv...@gmail.com wrote: >> > >> > >> > > I want todo faster

Re: Get the numbering of named regex groups

2015-04-08 Thread MRAB
On 2015-04-08 15:28, Peter Otten wrote: Mattias Ugelvik wrote: Example: re.match('(?Pa?)(?Pb?)', '') How can I find out that the group 'first' correlates to the positional regex group 1? I need to know this to resolve crucial ambiguities in a string manipulation tool I'm making. Looking at spa

Re: Code critique please

2015-04-08 Thread Jean-Michel Pichavant
- Original Message - > From: "kai peters" > To: python-list@python.org > Sent: Wednesday, 8 April, 2015 12:43:23 AM > Subject: Code critique please > > I just wrote this bit (coming from Pascal) and am wondering how > seasoned Python programmers would have done the same? Anything > terrib

Re: Why PyINCREF on _PyFalseStruct and _PyTrueStruct?

2015-04-08 Thread Shiyao Ma
On Wed, Apr 8, 2015 at 11:24 AM, Ian Kelly wrote: > The ref count is incremented because the caller will decrement it when > it's done with the reference. That makes sense. To be generic, the caller won't check what the returned result is. It just takes it as a normal PyObject. Traditionally, fo

Re: Why PyINCREF on _PyFalseStruct and _PyTrueStruct?

2015-04-08 Thread Ian Kelly
On Wed, Apr 8, 2015 at 9:07 AM, Shiyao Ma wrote: > Hi. > > While reading the rich_compare of PyLongObject, I noticed this line: > > https://hg.python.org/cpython/file/a49737bd6086/Objects/longobject.c#l2785 > > It increments the ob_ref of the builtin True/False object. > > Initializing the ob_ref

Why PyINCREF on _PyFalseStruct and _PyTrueStruct?

2015-04-08 Thread Shiyao Ma
Hi. While reading the rich_compare of PyLongObject, I noticed this line: https://hg.python.org/cpython/file/a49737bd6086/Objects/longobject.c#l2785 It increments the ob_ref of the builtin True/False object. Initializing the ob_ref of True/False to one so that they won't be garbage collected if

Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 15:40:46 UTC+2 skrev Mel Wilson: > On Tue, 07 Apr 2015 23:19:49 -0700, jonas.thornvall wrote: > > > And you have just created 429496729 unique symbols ;), in a pencil > > stroke. > > No. You did that, when you said base 429496729. Representing the > symbols in a com

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Ian Kelly
On Tue, Apr 7, 2015 at 7:18 PM, Steven D'Aprano wrote: > On Wed, 8 Apr 2015 10:38 am, Steven D'Aprano wrote: > >> On Wed, 8 Apr 2015 03:44 am, Ian Kelly wrote: >> >> >> > to_base(2932903594368438384328325832983294832483258958495845849584958458435439543858588435856958650865490, >> 429496729

Re: Get the numbering of named regex groups

2015-04-08 Thread Mattias Ugelvik
Thank god it's that easy! Err, I mean, thank you! I should have read the docs more carefully :) On 08/04/2015, Peter Otten <__pete...@web.de> wrote: > Mattias Ugelvik wrote: > >> Example: re.match('(?Pa?)(?Pb?)', '') >> >> How can I find out that the group 'first' correlates to the positional >> r

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Ian Kelly
On Wed, Apr 8, 2015 at 1:28 AM, wrote: > Den onsdag 8 april 2015 kl. 09:16:24 UTC+2 skrev Ian: >> On Tue, Apr 7, 2015 at 4:35 PM, wrote: >> > I am not sure you guys realised, that althoug the size of the factors to >> > muliply expands according to base^(exp+1) for each digitplace the number

Re: Get the numbering of named regex groups

2015-04-08 Thread Peter Otten
Mattias Ugelvik wrote: > Example: re.match('(?Pa?)(?Pb?)', '') > > How can I find out that the group 'first' correlates to the positional > regex group 1? I need to know this to resolve crucial ambiguities in a > string manipulation tool I'm making. Looking at spans, as the example > above illust

Get the numbering of named regex groups

2015-04-08 Thread Mattias Ugelvik
Example: re.match('(?Pa?)(?Pb?)', '') How can I find out that the group 'first' correlates to the positional regex group 1? I need to know this to resolve crucial ambiguities in a string manipulation tool I'm making. Looking at spans, as the example above illustrates, won't do the job. I can't se

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Mel Wilson
On Tue, 07 Apr 2015 23:19:49 -0700, jonas.thornvall wrote: > And you have just created 429496729 unique symbols ;), in a pencil > stroke. No. You did that, when you said base 429496729. Representing the symbols in a computer is no problem, any Python long int can do that. To display the symb

Re: How to find out which named regular expression group corresponds to which positional regex group

2015-04-08 Thread Damien Wyart
* Mattias Ugelvik in comp.lang.python: > I'm making a string manipulation tool in which I need to know this > correlation. > Take this example: re.match('(?Pa?)(?Pb?)', '') > I need to know that 'first' is group #1, and 'second' is group #2. > I need this to resolve certain ambiguities. Building

How to find out which named regular expression group corresponds to which positional regex group

2015-04-08 Thread Mattias Ugelvik
I'm making a string manipulation tool in which I need to know this correlation. Take this example: re.match('(?Pa?)(?Pb?)', '') I need to know that 'first' is group #1, and 'second' is group #2. I need this to resolve certain ambiguities. I was hopin -- https://mail.python.org/mailman/listinfo/p

Re: Automate deployment of Python application from multiple VCS repositories

2015-04-08 Thread Michael Herman
Hi Ben, I would start with Fabric. -> http://www.fabfile.org/. It's "low-level", but super straightforward. Here's a blog post on how to setup deployment -> https://realpython.com/blog/python/kickstarting-flask-on-ubuntu-setup-and-deployment/ On Tue, Apr 7, 2015 at 7:24 PM, Ben Finney wrote: >

Automate deployment of Python application from multiple VCS repositories

2015-04-08 Thread Matt
This seems highly do-able with Ansible. They have a git module, if that's your VCS, that fits in here perfectly. I would make two lists of variables, the first for repo URL/branch info and the second for their destinations. Then Ansible uses simple YAML to write the commands. Here's an overly

Re: Code critique please

2015-04-08 Thread Robert Kern
On 2015-04-08 01:54, Mark Lawrence wrote: On 07/04/2015 23:43, kai.pet...@gmail.com wrote: I just wrote this bit (coming from Pascal) and am wondering how seasoned Python programmers would have done the same? Anything terribly non-python? As always, thanks for all input. import os, sys from PI

Re: Automate deployment of Python application from multiple VCS repositories

2015-04-08 Thread Damien Wyart
> Fabric might help but is more "low-level" than what you seem to look > for. > http://docs.fabfile.org/en/latest/tutorial.html Elsewhere in the spectrum is Saltstack, but application deployment usecases are not that well documented. https://groups.google.com/forum/#!msg/salt-users/w9hxKpXVL04/5NI

Re: Automate deployment of Python application from multiple VCS repositories

2015-04-08 Thread Damien Wyart
* Ben Finney in comp.lang.python: > What tools are available to automate deployment of a Python > application comprising many discrete modules, spread across different > code bases in different VCS repositories? Fabric might help but is more "low-level" than what you seem to look for. http://docs

Re: Could not find any downloads that satisfy the requirement novaclient

2015-04-08 Thread marco . nawijn
On Tuesday, April 7, 2015 at 9:55:58 PM UTC+2, kurt_...@symantec40.com wrote: > Hi- > > While trying to install an OpenStack client on Mac OSX, I get the following: > > SymMacToolkit-C02N4H9DG3QD:/ kurt_heiss$ sudo pip install novaclient > Password: > The directory '/Users/kurt_heiss/Library/Logs

Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 09:16:24 UTC+2 skrev Ian: > On Tue, Apr 7, 2015 at 4:35 PM, wrote: > > I am not sure you guys realised, that althoug the size of the factors to > > muliply expands according to base^(exp+1) for each digitplace the number of > > comparissons needed to reach the digit

Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 09:16:24 UTC+2 skrev Ian: > On Tue, Apr 7, 2015 at 4:35 PM, wrote: > > I am not sure you guys realised, that althoug the size of the factors to > > muliply expands according to base^(exp+1) for each digitplace the number of > > comparissons needed to reach the digit

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Ian Kelly
On Tue, Apr 7, 2015 at 4:35 PM, wrote: > I am not sure you guys realised, that althoug the size of the factors to > muliply expands according to base^(exp+1) for each digitplace the number of > comparissons needed to reach the digit place (multiple of base^exp+1) is > constant with my approach