Re: Enumerating all 3-tuples

2018-03-09 Thread Ben Bacarisse
Steven D'Aprano writes: > I am trying to enumerate all the three-tuples (x, y, z) where each of x, > y, z can range from 1 to ∞ (infinity). > > This is clearly unhelpful: > > for x in itertools.count(1): > for y in itertools.count(1): > for z in itertools.count(1): > prin

Re: LXML: can't register namespace

2018-03-09 Thread Andrew Z
Stefan, thank you for the link. That explains the line of thinking of the package designer(s). I also looked@ beautifulsoup and found it to work better with my old brains. On Fri, Mar 9, 2018 at 9:46 AM, Stefan Behnel wrote: > Peter Otten schrieb am 09.03.2018 um 14:11: > > Stefan Behnel wrote:

Re: Enumerating all 3-tuples

2018-03-09 Thread MRAB
On 2018-03-10 01:13, Steven D'Aprano wrote: I am trying to enumerate all the three-tuples (x, y, z) where each of x, y, z can range from 1 to ∞ (infinity). This is clearly unhelpful: for x in itertools.count(1): for y in itertools.count(1): for z in itertools.count(1):

Re: Enumerating all 3-tuples

2018-03-09 Thread Chris Angelico
On Sat, Mar 10, 2018 at 12:13 PM, Steven D'Aprano wrote: > The Russian mathematician Cantor came up with a *pairing function* that > encodes a pair of integers into a single one. For example, he maps the > coordinate pairs to integers as follows: > > 1,1 -> 1 > 2,1 -> 2 > 1,2 -> 3 > 3,1 ->

Re: Enumerating all 3-tuples

2018-03-09 Thread bartc
On 10/03/2018 01:13, Steven D'Aprano wrote: I am trying to enumerate all the three-tuples (x, y, z) where each of x, y, z can range from 1 to ∞ (infinity). This is clearly unhelpful: for x in itertools.count(1): for y in itertools.count(1): for z in itertools.count(1):

Enumerating all 3-tuples

2018-03-09 Thread Steven D'Aprano
I am trying to enumerate all the three-tuples (x, y, z) where each of x, y, z can range from 1 to ∞ (infinity). This is clearly unhelpful: for x in itertools.count(1): for y in itertools.count(1): for z in itertools.count(1): print(x, y, z) as it never advances beyond x=

Re: I am a student studying Python in Korea. I found strange thing while studying through idle

2018-03-09 Thread Terry Reedy
On 3/8/2018 7:07 PM, 노연수 wrote: If you type print (" hello\ rpython ") into the python 3.7.0.b2, only the python is printed and i learned it's a crystal. '\r' is a control character than means 'return to the beginning of the line'. When you execute "print('hello\rpython')" in Python running

Re: I am a student studying Python in Korea. I found strange thing while studying through idle

2018-03-09 Thread Chris Warrick
On 9 March 2018 at 01:07, 노연수 wrote: > If you type print (" hello\ rpython ") into the python 3.7.0.b2, only the > python is printed and i learned it's a crystal. However, if you type print (" > hello\ rpython ") in the python 3.7.0.b2 idle, it is output as hellopython. I > wonder why it prints

Re: I found strange thing while studying through idle

2018-03-09 Thread Chris Angelico
On Sat, Mar 10, 2018 at 5:10 AM, Paul Moore wrote: > On 9 March 2018 at 17:46, Rob Gaddi wrote: >> On 03/08/2018 07:57 PM, Steven D'Aprano wrote: >>> >>> [snip] >>> >>> But it is possible that due to differences between platforms, the >>> OP's version of IDLE doesn't display a carriage return as

Re: I found strange thing while studying through idle

2018-03-09 Thread Paul Moore
On 9 March 2018 at 17:46, Rob Gaddi wrote: > On 03/08/2018 07:57 PM, Steven D'Aprano wrote: >> >> [snip] >> >> But it is possible that due to differences between platforms, the >> OP's version of IDLE doesn't display a carriage return as \r but >> rather as an invisible zero-width space. >> > > Ju

Re: I found strange thing while studying through idle

2018-03-09 Thread Rob Gaddi
On 03/08/2018 07:57 PM, Steven D'Aprano wrote: [snip] But it is possible that due to differences between platforms, the OP's version of IDLE doesn't display a carriage return as \r but rather as an invisible zero-width space. Just to derail this conversation a bit, does anyone have a use case

Re: LXML: can't register namespace

2018-03-09 Thread Stefan Behnel
Peter Otten schrieb am 09.03.2018 um 14:11: > Stefan Behnel wrote: > >> Andrew Z schrieb am 07.03.2018 um 05:03: >>> Hello, >>> with 3.6 and latest greatest lxml: >>> >>> from lxml import etree >>> >>> tree = etree.parse('Sample.xml') >>> etree.register_namespace('','http://www.example.com') >> >

Re: LXML: can't register namespace

2018-03-09 Thread Peter Otten
Stefan Behnel wrote: > Andrew Z schrieb am 07.03.2018 um 05:03: >> Hello, >> with 3.6 and latest greatest lxml: >> >> from lxml import etree >> >> tree = etree.parse('Sample.xml') >> etree.register_namespace('','http://www.example.com') > > The default namespace prefix is spelled None (because

Re: LXML: can't register namespace

2018-03-09 Thread Steven D'Aprano
On Fri, 09 Mar 2018 13:08:10 +0100, Stefan Behnel wrote: >> Is there a good reason not to support "" as the empty prefix? > > Well, the "empty prefix" is not an "empty" prefix, it's *no* prefix. The > result is not ":tag" instead of "prefix:tag", the result is "tag". That makes sense, thanks.

Re: LXML: can't register namespace

2018-03-09 Thread Stefan Behnel
Steven D'Aprano schrieb am 09.03.2018 um 12:41: > On Fri, 09 Mar 2018 10:22:23 +0100, Stefan Behnel wrote: > >> Andrew Z schrieb am 07.03.2018 um 05:03: >>> Hello, >>> with 3.6 and latest greatest lxml: >>> >>> from lxml import etree >>> >>> tree = etree.parse('Sample.xml') >>> etree.register_nam

Re: LXML: can't register namespace

2018-03-09 Thread Steven D'Aprano
On Fri, 09 Mar 2018 10:22:23 +0100, Stefan Behnel wrote: > Andrew Z schrieb am 07.03.2018 um 05:03: >> Hello, >> with 3.6 and latest greatest lxml: >> >> from lxml import etree >> >> tree = etree.parse('Sample.xml') >> etree.register_namespace('','http://www.example.com') > > The default names

Re: LXML: can't register namespace

2018-03-09 Thread Stefan Behnel
Andrew Z schrieb am 07.03.2018 um 05:03: > Hello, > with 3.6 and latest greatest lxml: > > from lxml import etree > > tree = etree.parse('Sample.xml') > etree.register_namespace('','http://www.example.com') The default namespace prefix is spelled None (because there is no prefix for it) and not

Re: Which part of the loop is it going through in this class frame?

2018-03-09 Thread Cameron Simpson
On 08Mar2018 20:25, C W wrote: Thank you guys, lots of great answers, very helpful. I got it! A follow-up question: How did the value of "object" get passed to "time"? Obviously, they have different names. How did Python make that connection? Code is below for convenience. class Clock(object