Re: Connection refused when tryign to run bottle/flask web framweworks

2018-08-19 Thread Miki Tebeka
If you're trying to access the machine from another machine, you need to change the host to '0.0.0.0'. 'localhost' is the internal interface. On Sunday, August 19, 2018 at 10:36:25 PM UTC+3, Νίκος wrote: > Hello, > > i just installed bottle and flask web frameworks in my CentOS environment but

Re: Connection refused when tryign to run bottle/flask web framweworks

2018-08-19 Thread dieter
Νίκος writes: > i just installed bottle and flask web frameworks in my CentOS environment but > i canno get it working even with the simpleste xample. The coonection is > refused always. "connection refused" is an indication that there is no (running) server at the connection port. Unlike simp

Re: Python Information Form

2018-08-19 Thread dieter
Suman Mupparapu writes: > Working on a creating a small information form ..and encountering issues > when trying to edit the details using Python Flask and MYSQL DB. > > Placed the code below for your reference. Please help to fix this issue. > Let me know if you need any other details from my end

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 12:01 PM, Grant Edwards wrote: > On 2018-08-20, Ben Bacarisse wrote: >> Grant Edwards writes: >> >>> On 2018-08-20, Steven D'Aprano wrote: On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed?

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Grant Edwards
On 2018-08-20, Ben Bacarisse wrote: > Grant Edwards writes: > >> On 2018-08-20, Steven D'Aprano wrote: >>> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: >>> When I write bytes to stdout, why are they reversed? >>> >>> Answer: they aren't, use hexdump -C. >> >> One might think t

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 11:31 AM, Grant Edwards wrote: > On 2018-08-20, Chris Angelico wrote: >> On Mon, Aug 20, 2018 at 11:12 AM, Grant Edwards >> wrote: >>> On 2018-08-20, Steven D'Aprano wrote: On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > When I write bytes to st

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Ben Bacarisse
Grant Edwards writes: > On 2018-08-20, Steven D'Aprano wrote: >> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: >> >>> When I write bytes to stdout, why are they reversed? >> >> Answer: they aren't, use hexdump -C. > > One might think that dumping out bytes in the correct order ought

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Grant Edwards
On 2018-08-20, Chris Angelico wrote: > On Mon, Aug 20, 2018 at 11:12 AM, Grant Edwards > wrote: >> On 2018-08-20, Steven D'Aprano wrote: >>> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: >>> When I write bytes to stdout, why are they reversed? >>> >>> Answer: they aren't, use he

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 11:12 AM, Grant Edwards wrote: > On 2018-08-20, Steven D'Aprano wrote: >> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: >> >>> When I write bytes to stdout, why are they reversed? >> >> Answer: they aren't, use hexdump -C. > > One might think that dumping out

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Grant Edwards
On 2018-08-20, Steven D'Aprano wrote: > On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > >> When I write bytes to stdout, why are they reversed? > > Answer: they aren't, use hexdump -C. One might think that dumping out bytes in the correct order ought to be the default format for hexd

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Steven D'Aprano
On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed? Answer: they aren't, use hexdump -C. Thanks to all replies! -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- h

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Cameron Simpson
On 20Aug2018 00:31, Steven D'Aprano wrote: When I write bytes to stdout, why are they reversed? [steve@ando ~]$ python2.7 -c "print('\xfd\x84\x04\x08')" | hexdump 000 84fd 0804 000a 005 [steve@ando ~]$ python3.5 -c "import sys; sys.stdout.buffer.write(b'\xfd \x84\x04\x08\n')" | hexdum

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 10:31 AM, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed? > > [steve@ando ~]$ python2.7 -c "print('\xfd\x84\x04\x08')" | hexdump > 000 84fd 0804 000a > 005 > > [steve@ando ~]$ python3.5 -c "import sys; sys.stdout.buffer.write(b'\xfd > \

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Grant Edwards
On 2018-08-20, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed? > > [steve@ando ~]$ python2.7 -c "print('\xfd\x84\x04\x08')" | hexdump > 000 84fd 0804 000a > 005 They aren't. You're being fooled by the default output format of hexdump. By default, it displa

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread Steven D'Aprano
On Sun, 19 Aug 2018 05:29:46 -0700, giannis.dafnomilis wrote: > With your help I have arrived at this point: I have the dictionary > varsdict (size 5) as below > > KeyTypeSize Value > FEq_(0,_0,_0,_0) float11.0 > FEq_(0,_0,_1,_1)

Writing bytes to stdout reverses the bytes

2018-08-19 Thread Steven D'Aprano
When I write bytes to stdout, why are they reversed? [steve@ando ~]$ python2.7 -c "print('\xfd\x84\x04\x08')" | hexdump 000 84fd 0804 000a 005 [steve@ando ~]$ python3.5 -c "import sys; sys.stdout.buffer.write(b'\xfd \x84\x04\x08\n')" | hexdump 000 84fd 0804 000a 005 -- Steven

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Aug 19, 2018 at 11:54 PM, Marko Rauhamaa wrote: >>> 3) Every invocation of method() has to execute the class body, which >>> takes time. >> >> That's what happens with every method invocation in Python regardless. > > No. You have to execute the *class body*. Every meth

Re: Connection refused when tryign to run bottle/flask web framweworks

2018-08-19 Thread Ian Kelly
On Sun, Aug 19, 2018, 1:47 PM Νίκος wrote: > Hello, > > i just installed bottle and flask web frameworks in my CentOS environment > but i canno get it working even with the simpleste xample. The coonection > is refused always. > > from bottle import route, run, template > > @route('/hello/') > de

Re: printing to stdout

2018-08-19 Thread Cameron Simpson
On 19Aug2018 15:09, richard lucassen wrote: On Sun, 19 Aug 2018 19:53:04 +1000 Cameron Simpson wrote: Although I do not understand what zip is doing exactly here (I presume I switch to use pointers instead of the values), Someone else has descibed zip tersely: it pairs it the elements of 2 li

Re: printing to stdout

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 7:55 AM, Cameron Simpson wrote: > Draw little boxes with arrows. It helps. - Michael J. Eager Draw good boxes. - DeviCat ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: printing to stdout

2018-08-19 Thread Cameron Simpson
On 19Aug2018 18:10, richard lucassen wrote: On Sun, 19 Aug 2018 10:11:08 -0400 Joel Goldstick wrote: Your allusion to pointers is misguided. Python is not like C or assembler. You don't, and don't need to know where objects are stored. Names are assigned to reference data objects I'll hav

Connection refused when tryign to run bottle/flask web framweworks

2018-08-19 Thread Νίκος
Hello, i just installed bottle and flask web frameworks in my CentOS environment but i canno get it working even with the simpleste xample. The coonection is refused always. from bottle import route, run, template @route('/hello/') def index(name): return template('Hello {{name}}!', name=n

Re: printing to stdout

2018-08-19 Thread Richard Lucassen
On Sun, 19 Aug 2018 12:37:18 -0400 Joel Goldstick wrote: > > I'll have another look at it, I was just searching for a clear > > explanation, but the page I found was not clear enough for me. I'll > > have to take some time for it... > > try python.org tutorial, and search for terms like names, o

Re: printing to stdout

2018-08-19 Thread Joel Goldstick
On Sun, Aug 19, 2018 at 12:16 PM Richard Lucassen wrote: > > On Sun, 19 Aug 2018 10:11:08 -0400 > Joel Goldstick wrote: > > > > Well, apparently there were quite a lot of things that makes the > > > code more readable I'd say. And even better. But it was indeed not > > > very unPythony. OTOH, I'm

Re: Python Information Form

2018-08-19 Thread MRAB
On 2018-08-19 15:41, Suman Mupparapu wrote: Hi Team, I am newbie to Python and glad to be part of the team. Sorry for starting with a help. Working on a creating a small information form ..and encountering issues when trying to edit the details using Python Flask and MYSQL DB. Placed the code

Re: printing to stdout

2018-08-19 Thread Richard Lucassen
On Sun, 19 Aug 2018 10:11:08 -0400 Joel Goldstick wrote: > > Well, apparently there were quite a lot of things that makes the > > code more readable I'd say. And even better. But it was indeed not > > very unPythony. OTOH, I'm not a programmer, otherwise I would have > > written this in C ;-) >

Python Information Form

2018-08-19 Thread Suman Mupparapu
Hi Team, I am newbie to Python and glad to be part of the team. Sorry for starting with a help. Working on a creating a small information form ..and encountering issues when trying to edit the details using Python Flask and MYSQL DB. Placed the code below for your reference. Please help to fix t

Re: printing to stdout

2018-08-19 Thread richard lucassen
On Sun, 19 Aug 2018 19:53:04 +1000 Cameron Simpson wrote: > There are always unPythonic bits. Even after you've cleaned them all > up, since people will disagree about the finer points of Pythonicism > there will be bits both over and under cleaned. Although I do not understand what zip is doing

Re: New books by O’Reilly

2018-08-19 Thread Gene Heskett
On Saturday 18 August 2018 21:40:25 Larry Martell wrote: > https://imgur.com/gallery/tW1lwEl Larry; Here, it loaded very slow and the central window is empty. Was there supposed to be content? Or is my firefox busted? -- Cheers, Gene Heskett -- "There are four boxes to be used in defense of l

Re: Pylint false positives

2018-08-19 Thread Chris Angelico
On Sun, Aug 19, 2018 at 11:54 PM, Marko Rauhamaa wrote: > Chris Angelico : >> 2) You can't identify these objects as being of the same type (since >> they're not). > > That's a feature, not a bug. Type membership checking goes against > duck-typing. Oh, so it would be better for Python if every i

Re: printing to stdout

2018-08-19 Thread Joel Goldstick
On Sun, Aug 19, 2018 at 9:56 AM richard lucassen wrote: > > On Sun, 19 Aug 2018 12:02:51 +0300 > Marko Rauhamaa wrote: > > > richard lucassen : > > > As I'm new to Python, just this question: are there any unPythony > > > things in this code? > > > > Your code looks neat. > > Well, apparently the

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Aug 19, 2018 at 10:28 PM, Marko Rauhamaa wrote: >> The most useful use of inner classes is something like this: >> >> class Outer: >> def method(self): >> outer = self >> >> class Inner: >> def spam(self, a, b): >>

Re: printing to stdout

2018-08-19 Thread richard lucassen
On Sun, 19 Aug 2018 12:02:51 +0300 Marko Rauhamaa wrote: > richard lucassen : > > As I'm new to Python, just this question: are there any unPythony > > things in this code? > > Your code looks neat. Well, apparently there were quite a lot of things that makes the code more readable I'd say. And

Re: printing to stdout

2018-08-19 Thread richard lucassen
On Sun, 19 Aug 2018 19:53:04 +1000 Cameron Simpson wrote: [Oops, apparently you set the Reply-To to python-list@python.org, normally that's no problem, but I did something wrong somewhere] > There are always unPythonic bits. Even after you've cleaned them all > up, since people will disagree abo

Re: Pylint false positives

2018-08-19 Thread Chris Angelico
On Sun, Aug 19, 2018 at 10:28 PM, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Sun, 19 Aug 2018 11:43:44 +0300, Marko Rauhamaa wrote: >>> At least some of the methods of inner classes are closures (or there >>> would be no point to an inner class). >> >> [...] >> >> (2) Whether or not the met

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Steven D'Aprano : > On Sun, 19 Aug 2018 11:43:44 +0300, Marko Rauhamaa wrote: >> At least some of the methods of inner classes are closures (or there >> would be no point to an inner class). > > [...] > > (2) Whether or not the methods of an inner class are closures depends on > the methods, not

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread giannis . dafnomilis
On Sunday, August 19, 2018 at 1:42:29 PM UTC+2, Steven D'Aprano wrote: > On Sun, 19 Aug 2018 03:15:32 -0700, giannis.dafnomilis wrote: > > > Thank you MRAB! > > > > Now I can get the corresponding dictionary value A[i,j,k,l] for each key > > in the varsdict dictionary. > > > > However how would

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread giannis . dafnomilis
> Do you want to modify the varsdict values in place? > > varsdict['Feq_(i,_j,_k,_l)'] *= A[i,j,k,l] > > which is a short-cut for this slightly longer version: > > temp = varsdict['Feq_(i,_j,_k,_l)'] * A[i,j,k,l] > varsdict['Feq_(i,_j,_k,_l)'] = temp > > > > If you want to leave the origina

Re: New books by O’Reilly

2018-08-19 Thread D'Arcy Cain
On 2018-08-18 09:40 PM, Larry Martell wrote: > https://imgur.com/gallery/tW1lwEl I think I have met the people who studied those books. -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...@vex.net VoIP: sip:da...@vybenetworks.com -- https://mail.python.org/mailman/listin

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread Steven D'Aprano
On Sun, 19 Aug 2018 03:35:24 -0700, giannis.dafnomilis wrote: > On Sunday, August 19, 2018 at 3:53:39 AM UTC+2, Steven D'Aprano wrote: [...] >> If you know absolutely for sure that the key format is ALWAYS going to >> be 'FEq_()' then you can extract the fields using slicing, like >> this: >> >>

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread Steven D'Aprano
On Sun, 19 Aug 2018 03:15:32 -0700, giannis.dafnomilis wrote: > Thank you MRAB! > > Now I can get the corresponding dictionary value A[i,j,k,l] for each key > in the varsdict dictionary. > > However how would I go about multiplying the value of each > FEq_(i,_j,_k,_l) key with the A[i,j,k,l] one

Re: Pylint false positives

2018-08-19 Thread Steven D'Aprano
On Sun, 19 Aug 2018 11:43:44 +0300, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Sun, 19 Aug 2018 00:11:30 +0300, Marko Rauhamaa wrote: >> >>> In Python programming, I mostly run into closures through inner >>> classes (as in Java). >> >> Inner classes aren't closures. > > At least some of

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread giannis . dafnomilis
On Sunday, August 19, 2018 at 3:53:39 AM UTC+2, Steven D'Aprano wrote: > > Unless you edit your code with Photoshop, why do you think a JPEG is a > good idea? > > That discriminates against the blind and visually impaired, who can use > screen-readers with text but can't easily read text insid

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread giannis . dafnomilis
Thank you MRAB! Now I can get the corresponding dictionary value A[i,j,k,l] for each key in the varsdict dictionary. However how would I go about multiplying the value of each FEq_(i,_j,_k,_l) key with the A[i,j,k,l] one? Do you have any insight in that? -- https://mail.python.org/mailman/list

Re: printing to stdout

2018-08-19 Thread Cameron Simpson
On 19Aug2018 09:32, richard lucassen wrote: This is a working script I made. It initializes the I/O expanders, then it waits for an INT from these I/O expanders on GPIO23, reads the contents and sends which bit on which chip went up or down to a fifo (and stdout for logging) As I'm new to Pytho

Re: printing to stdout

2018-08-19 Thread Marko Rauhamaa
richard lucassen : > As I'm new to Python, just this question: are there any unPythony > things in this code? Your code looks neat. > except IOError: > print ("[ALERT] I/O problem device 0x%x" % list_pcf[i]) Just double check that simply printing the alert is the correct recovery f

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Aug 19, 2018 at 9:03 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> *headscratch* >>> >>> So this is okay: >>> >>> def f(): >>> for i in range(5): >>> def g(): ... >>> >>> But this isn't: >>> >>> class C: >>> for i in range(5): >>> def m(sel

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Steven D'Aprano : > On Sun, 19 Aug 2018 00:11:30 +0300, Marko Rauhamaa wrote: > >> In Python programming, I mostly run into closures through inner classes >> (as in Java). > > Inner classes aren't closures. At least some of the methods of inner classes are closures (or there would be no point to

Re: printing to stdout

2018-08-19 Thread richard lucassen
On Fri, 17 Aug 2018 08:31:22 +1000 Cameron Simpson wrote: > Just looking at your loop I would be inclined to just call flush once > at the bottom, _before_ the sleep() call: > > sys.stdout.flush() > > Your call; the performance difference will be small, so it tends to > come down to keeping y