Re: Mr. Conway in 50 lines of code (Posting On Python-List Prohibited)

2017-12-31 Thread Lawrence D’Oliveiro
On Sunday, December 31, 2017 at 11:13:41 PM UTC+13, Wu Xi wrote: > yield x + 1 , y > yield x - 1 , y > yield x , y + 1 > yield x , y - 1 #this is proof that life can emerge > inside of computers and cellular automatons, > > yield x + 1 , y + 1 #

Re: SystemError: error return without exception set

2017-12-07 Thread Lawrence D’Oliveiro
On Friday, December 8, 2017 at 5:15:35 AM UTC+13, Natalie Leung wrote: > I have emailed the provider but their technical support staff has stated > that they have exhausted of all ideas. If they can’t supply you with a product fit for purpose, time to send it back for a refund. -- https://mail

Constants In Python (Posting On Python-List Prohibited)

2017-11-18 Thread Lawrence D’Oliveiro
Every (unqualified) name in Python is a variable. Which means its value can be changed. If you want something that has a value that cannot be changed, you have to make it an attribute of an object. For example, enums work this way. You could define an enum for constants, but enums are nominally

Re: MySQLdb and conn.select_db() (Posting On Python-List Prohibited)

2017-11-15 Thread Lawrence D’Oliveiro
On Thursday, November 16, 2017 at 5:32:23 AM UTC+13, Tobiah wrote: > AttributeError: 'Connection' object has no attribute 'select_db' You could always execute a “use «db_name»” MySQL command. -- https://mail.python.org/mailman/listinfo/python-list

To ASCII Or Not To ASCII? (Posting On Python-List Prohibited)

2017-11-15 Thread Lawrence D’Oliveiro
From : def raıse(self) : "raises this exception." libm.feraiseexcept(self.mask) #end raıse raiise = raıse # if you prefer -- https://mail.python.org/mailman/listinfo/python-list

Re: Windows10 keyboard interupt

2017-11-14 Thread Lawrence D’Oliveiro
On Wednesday, November 15, 2017 at 3:01:37 AM UTC+13, Kasper Jepsen wrote: > Forgot.. python 2.7 -- https://mail.python.org/mailman/listinfo/python-list

Re: from xx import yy (Posting On Python-List Prohibited)

2017-11-14 Thread Lawrence D’Oliveiro
On Monday, November 13, 2017 at 3:18:04 PM UTC+13, bvdp wrote: > I'm having a conceptual mind-fart today. I just modified a bunch > of code to use "from xx import variable" when variable is a global > in xx.py. But, when I change/read 'variable' it doesn't appear to change. 1) Every name in Python

Re: how to automate java application in window using python

2016-09-29 Thread Lawrence D’Oliveiro
On Thursday, September 29, 2016 at 11:46:59 PM UTC+13, Ned Batchelder wrote: > This is just getting rude. Let's please drop it. Do you have anything substantive to contribute? (... crickets ...) -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-29 Thread Lawrence D’Oliveiro
On Thursday, September 29, 2016 at 7:48:41 PM UTC+13, Rustom Mody wrote: > - And then uses a value of that type in a non-trivial bool-consuming position > such as the condition of an if/while etc > > There's a very good chance that bool-usage is buggy 👍 -- https://mail.python.org/mailman/listinf

Re: Is there a way to change the closure of a python function?

2016-09-29 Thread Lawrence D’Oliveiro
On Thursday, September 29, 2016 at 7:13:15 PM UTC+13, Gregory Ewing wrote: > Philosophical question: Is a function that never > returns actually a function? Denotational semantics calls that value “bottom”. -- https://mail.python.org/mailman/listinfo/python-list

Re: how to automate java application in window using python

2016-09-28 Thread Lawrence D’Oliveiro
On Thursday, September 29, 2016 at 11:54:46 AM UTC+13, Emile van Sebille wrote: > Which worked for me! You should try it. Sloppy programming has always > been unreliable. So it is clear you don’t have an answer to the OP’s question after all. Just some vague, meaningless generalities. -- https:

Re: how to automate java application in window using python

2016-09-28 Thread Lawrence D’Oliveiro
On Thursday, September 29, 2016 at 4:57:10 AM UTC+13, Emile van Sebille wrote: > My point was that it is possible to automate windows reliably as long as the > programming is robust. Sounds like circular reasoning. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to change the closure of a python function?

2016-09-28 Thread Lawrence D’Oliveiro
On Wednesday, September 28, 2016 at 9:53:05 PM UTC+13, Gregory Ewing wrote: > Essentially you write the whole program in continuation- > passing style, with a state object being passed down an > infinite chain of function calls. Procedural programming under another name... -- https://mail.python.

Re: Why searching in a set is much faster than in a list ?

2016-09-28 Thread Lawrence D’Oliveiro
On Wednesday, September 28, 2016 at 6:51:17 PM UTC+13, ast wrote: > I noticed that searching in a set is faster than searching in a list. That’s why we have sets. -- https://mail.python.org/mailman/listinfo/python-list

Re: what's the difference of Template.append(...) and Template.prepend(...) in pipes module

2016-09-28 Thread Lawrence D’Oliveiro
On Wednesday, September 28, 2016 at 7:47:46 PM UTC+13, Cpcp Cp wrote: > My os is windows 7.But this module is used for POSIX. Windows 10 has a Linux layer, I believe. Why not try that? -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to change the closure of a python function?

2016-09-27 Thread Lawrence D’Oliveiro
On Wednesday, September 28, 2016 at 4:01:36 AM UTC+13, Chris Angelico wrote: > You can also have multiple closures in the same context, and changes made by > one of them will affect the others. This is the point where it’s probably easier to wrap them all together into methods of a common class.

Re: Is there a way to change the closure of a python function?

2016-09-27 Thread Lawrence D’Oliveiro
On Wednesday, September 28, 2016 at 3:35:58 AM UTC+13, Peter Otten wrote: > is Python actually a "functional language"? Yes . -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make a copy of chained dicts effectively and nicely?

2016-09-27 Thread Lawrence D’Oliveiro
On Wednesday, September 28, 2016 at 2:27:36 AM UTC+13, Jussi Piitulainen wrote: > Lawrence D’Oliveiro writes: >> dict(dict(d1, **d2), **d3) > > Nice expression. But that's not available if the keys are not strings: > > dict({}, **{ 1:3 }) > ==> > Tracebac

Re: it looks strange

2016-09-27 Thread Lawrence D’Oliveiro
On Tuesday, September 27, 2016 at 9:09:55 PM UTC+13, Cpcp Cp wrote: > >>> li=[lambda :x for x in range(10)] Try li = [(lambda x : lambda : x)(x) for x in range(10)] print(li[0]()) print(li[9]()) 0 9 -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make a copy of chained dicts effectively and nicely?

2016-09-27 Thread Lawrence D’Oliveiro
On Tuesday, September 27, 2016 at 8:08:46 PM UTC+13, Nagy László Zsolt wrote: > d1 = {'a':1, 'b':2} > d2 = {'c':3, 'd':4} > d3 = {'e':5, 'f':6} > > Is there a version that is as effective as #3, but as clean and nice as #4? dict(dict(d1, **d2), **d3) -- https://mail.python.org/mailman/listinfo/p

Re: Is 'learning python 5th edition' a good book to beginner?

2016-09-25 Thread Lawrence D’Oliveiro
Judging from the table of contents , it spends too much time (i.e. > 0) talking about Python 2. -- https://mail.python.org/mailman/listinfo/python-list

Re: how to automate java application in window using python

2016-09-24 Thread Lawrence D’Oliveiro
On Monday, September 19, 2016 at 6:47:27 PM UTC+12, Christian Gollwitzer wrote: > Still, sometimes you just need to get the job done and it doesn't matter how. That is why the situation continues; because you keep showing a willingness to put up with it. -- https://mail.python.org/mailman/listin

Re: How to import all things defined the files in a module directory in __init__.py?

2016-09-24 Thread Lawrence D’Oliveiro
On Saturday, September 24, 2016 at 2:11:09 PM UTC+12, Chris Angelico wrote: > It's a large and complex module, and about at the boundary of being > broken up a bit. Splitting it up would make it slower to load. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to import all things defined the files in a module directory in __init__.py?

2016-09-23 Thread Lawrence D’Oliveiro
On Friday, September 23, 2016 at 4:25:21 AM UTC+12, Chris Angelico wrote: > For reference, the Decimal module (ignoring the C accelerator) is over six > thousand lines of code, as a single module. Now, that might be pushing the > boundaries a bit ... What “boundaries” do you think that might be pu

Re: how to automate java application in window using python

2016-09-23 Thread Lawrence D’Oliveiro
On Thursday, September 22, 2016 at 8:34:20 AM UTC+12, Emile wrote: > Hmm, then I'll have to wait longer to experience the unreliability as > the handful of automated gui tools I'm running has only been up 10 to 12 > years or so. You sound like you have a solution for the OP, then. -- https://ma

Re: Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-23 Thread Lawrence D’Oliveiro
On Friday, September 23, 2016 at 3:38:21 AM UTC+12, Chris Angelico wrote: > This is why, despite the confusion it sometimes causes, we all prefer > duck typing to static typing. The csv.DictReader wants a "file-like > object", not necessarily a file - and in this case, all it asks is an > iterable

Re: Where is import defined in the source code?

2016-09-22 Thread Lawrence D’Oliveiro
On Thursday, September 22, 2016 at 4:14:16 PM UTC+12, Peng Yu wrote: > > ... I want know where import is defined in the source code. This looks like the code, and this

Re: Pasting code into the cmdline interpreter

2016-09-22 Thread Lawrence D’Oliveiro
On Thursday, September 22, 2016 at 5:12:13 PM UTC+12, Veek M wrote: > How do i deal with this - what's the best way to achieve what I'm trying > to do. If you want a scratchpad for trying out Python code, I can recommend Jupyter/IPython . -- https://mail.python.org/mailman/

Re: strings and ints consistency - isinstance

2016-09-22 Thread Lawrence D’Oliveiro
On Thursday, September 22, 2016 at 3:41:42 PM UTC+12, Sayth Renshaw wrote: > if isinstance(int(answer), int) is True: Not sure what the point of this is... -- https://mail.python.org/mailman/listinfo/python-list

Re: Data Types

2016-09-22 Thread Lawrence D’Oliveiro
On Thursday, September 22, 2016 at 3:47:27 PM UTC+12, Sayth Renshaw wrote: > What about 0 or 1 they are true and false like no other numbers? >>> isinstance(1, bool) False >>> isinstance(True, int) True -- https://mail.python.org/mailman/listinfo/python-list

Re: Cython taking more time than regular Python

2016-09-21 Thread Lawrence D’Oliveiro
On Wednesday, September 21, 2016 at 6:05:07 PM UTC+12, Gregory Ewing wrote: > > Christian Gollwitzer wrote: > >> It may take a microsecond to call a functino from Python. > > Obviously the compiler used was a "dump" compiler. :-) Don’t forget “functino”. :) For some reason it awakens half-rememb

Re: automated comparison tool

2016-09-20 Thread Lawrence D’Oliveiro
On Wednesday, September 21, 2016 at 12:14:54 PM UTC+12, Bill Deegan wrote: > Use Git... at least you get can back what used to work.. That has become such a matter of programming habit, taken so much for granted that, to me, it’s like saying “don’t forget to breathe”. :) -- https://mail.python.o

Re: list or dictionary

2016-09-20 Thread Lawrence D’Oliveiro
On Wednesday, September 21, 2016 at 6:05:41 AM UTC+12, Ganesh Pal wrote: > I am on python 2.7 ... Why? -- https://mail.python.org/mailman/listinfo/python-list

Re: automated comparison tool

2016-09-20 Thread Lawrence D’Oliveiro
On Wednesday, September 21, 2016 at 7:44:22 AM UTC+12, Andrew Clark wrote: > If anyone can help me out with sudo code or set me in the right direction > would be nice. You know What Aesop said: “the gods* help those who help themselves”. Start by posting an initial stab at your code for solving,

Re: how to automate java application in window using python

2016-09-20 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 10:42:16 PM UTC+12, Paul Rubin wrote: > > Lawrence D’Oliveiro writes: >> > I'm quite sure there are Java bindings for all those protocols. Are any of these supported by the Java app in question? Doesn’t seem like it. >> Like I said, try

Re: how to automate java application in window using python

2016-09-20 Thread Lawrence D’Oliveiro
On Tuesday, September 20, 2016 at 1:11:20 PM UTC+12, Ned Batchelder wrote: > We get it, you don't like GUIs. Who says I don’t like GUIs ? I just assume we’ve moved on from the 1990s, when they were considered to be the pinnacl

Re: Another å, ä, ö question

2016-09-19 Thread Lawrence D’Oliveiro
On Tuesday, September 20, 2016 at 8:21:25 AM UTC+12, Martin Schöön wrote: > But -- now I tested using emacs instead using C-c C-c to execute. > Noting happens so I try to run the program from command line and > find that now Python can't stand my å, ä and ö. What version of Python? Python 3 accept

Re: Functions Of Functions Returning Functions

2016-09-19 Thread Lawrence D’Oliveiro
On Monday, September 19, 2016 at 6:54:31 PM UTC+12, dieter wrote: > Some time ago, we had a (quite heated) discussion here ... I have noticed that people get very defensive about things they don’t understand. > Often, functions returning functions are more difficult to understand > than "first o

Re: how to automate java application in window using python

2016-09-19 Thread Lawrence D’Oliveiro
On Monday, September 19, 2016 at 11:29:24 AM UTC+12, Ned Batchelder wrote: > > On Sunday, September 18, 2016 at 6:45:32 PM UTC-4, Lawrence D’Oliveiro wrote: >> >> A CLI gives the user power over the computer. While a GUI is a great way to >> give the computer, and propri

Re: how to automate java application in window using python

2016-09-18 Thread Lawrence D’Oliveiro
On Monday, September 19, 2016 at 11:32:25 AM UTC+12, Michael Torrie wrote: > One I've used is AutoIt. Like I said, this kind of thing can never work reliably... -- https://mail.python.org/mailman/list

Re: how to automate java application in window using python

2016-09-18 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 11:02:57 PM UTC+12, Christian Gollwitzer wrote: > > Am 18.09.16 um 12:26 schrieb Lawrence D’Oliveiro: > >> Considering the power available in Free Software toolkits like >> ImageMagick, G’MIC and so on, not to mention libraries accessible >&

Re: how to automate java application in window using python

2016-09-18 Thread Lawrence D’Oliveiro
On Monday, September 19, 2016 at 8:00:43 AM UTC+12, Michael Torrie wrote: > > On 09/18/2016 04:03 AM, Lawrence D’Oliveiro wrote: > >> Like I said, trying to automate a GUI is a waste of time. GUIs are >> designed for humans, not computers, to use. > > Well then we have

Re: how to automate java application in window using python

2016-09-18 Thread Lawrence D’Oliveiro
On Monday, September 19, 2016 at 2:12:14 AM UTC+12, Chris Angelico wrote: > > On Sun, Sep 18, 2016 at 8:03 PM, Lawrence D’Oliveiro wrote: > >> Like I said, trying to automate a GUI is a waste of time. GUIs are designed >> for humans, not computers, to use. > > Okay,

Functions Of Functions Returning Functions

2016-09-18 Thread Lawrence D’Oliveiro
The less code you have to write, the better. Less code means less maintenance, and fewer opportunities for bugs. Here is an example of how I was able to knock a few hundred lines off the size of a Python module. When I was writing my Python wrapper for HarfBuzz , the

Re: how to automate java application in window using python

2016-09-18 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 10:13:41 PM UTC+12, Christian Gollwitzer wrote: > > Am 18.09.16 um 12:03 schrieb Lawrence D’Oliveiro: > >> Like I said, trying to automate a GUI is a waste of time. GUIs are >> designed for humans, not computers, to use. > > You

Re: how to automate java application in window using python

2016-09-18 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 9:25:53 PM UTC+12, Paul Rubin wrote: > > Lawrence D’Oliveiro writes: > >>> The term "automation" is frequently used in the Windows world to mean >>> programming something that you would otherwise do manually through a GUI... &

Re: how to automate java application in window using python

2016-09-17 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 4:11:49 PM UTC+12, Gregory Ewing wrote: > The term "automation" is frequently used in the Windows world to mean > programming something that you would otherwise do manually through a GUI... Which is not something that GUIs are designed for. Therefore it is at best

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 2:34:46 PM UTC+12, eryk sun wrote: > However, I see that MicroPython [1] has been ported to 16-bit > PIC microcontrollers. An int should be 16-bit in that case. > > [1]: https://github.com/micropython/micropython From the readme: “MicroPython implements the entire

Re: Is the content available in the html doc available in help()?

2016-09-17 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 12:51:11 PM UTC+12, Peng Yu wrote: > I want to get the same content as the html doc from help(). ldo@theon:~> pydoc3 inspect Help on module inspect: NAME inspect - Get useful information from live Python objects. MODULE REFERENCE h

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Lawrence D’Oliveiro
On Saturday, September 17, 2016 at 3:47:15 PM UTC+12, I wrote: > >>> a = array.array("I", (0,)) > >>> a.itemsize > 4 > >>> a = array.array("L", (0,)) > >>> a.itemsize > 8 Let me rephrase the question. It seems clear that “l” a

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Lawrence D’Oliveiro
On Saturday, September 17, 2016 at 11:54:10 PM UTC+12, Christian Heimes wrote: > > ... on Windows (32 and 64bit), a long is always 32bit and an array with > datatype "L" has itemsize 4. Ah, I forgot the LLP64 nonsense... -- https://mail.python.org/mailman/listinfo/python-list

array.itemsize: Documentation Versus Reality

2016-09-16 Thread Lawrence D’Oliveiro
>>> a = array.array("I", (0,)) >>> a.itemsize 4 >>> a = array.array("L", (0,)) >>> a.itemsize 8 According to , the “minimum size” should be 2 and 4 respectively. It further says: The actual representation of values is dete

Re: Where is the documentation for ','?

2016-09-16 Thread Lawrence D’Oliveiro
On Saturday, September 17, 2016 at 2:05:49 PM UTC+12, Peng Yu wrote: > x, y = y, x It’s just syntactic sugar for (x, y) = (y, x) -- https://mail.python.org/mailman/listinfo/python-list

Re: how to automate java application in window using python

2016-09-16 Thread Lawrence D’Oliveiro
On Friday, September 16, 2016 at 10:22:34 PM UTC+12, Christian Gollwitzer wrote: > "How do I automate a Java application using Python?" Which is really a meaningless question. “Automation” is what computer programs do. (Assuming “application” is just another word for “program”.) If the program d

Re: how to automate java application in window using python

2016-09-16 Thread Lawrence D’Oliveiro
On Friday, September 16, 2016 at 6:55:07 PM UTC+12, meInvent bbird wrote: > On Thursday, September 15, 2016 at 3:52:41 PM UTC+8, Lawrence D’Oliveiro > wrote: >> On Thursday, September 15, 2016 at 7:13:05 PM UTC+12, meInvent bbird >> wrote: >>> how to automate java

Re: how to automate java application in window using python

2016-09-15 Thread Lawrence D’Oliveiro
On Thursday, September 15, 2016 at 7:13:05 PM UTC+12, meInvent bbird wrote: > how to automate java application in window using python > > 1. scroll up or down of scroll bar > 2. click button > 3. type text in textbox Well, don’t leave us in suspense! Give us the link to your blog post! -- https:

Re: Oh gods can we get any more off-topic *wink* [was Re: [Python-ideas] Inconsistencies]

2016-09-14 Thread Lawrence D’Oliveiro
On Thursday, September 15, 2016 at 1:26:49 PM UTC+12, Chris Kaynor wrote: > If you find somebody determined to not trust evidence such as the blue > marble photos, it can be quite hard to prove that the world is not flat. A flat world doesn’t have a horizon. -- https://mail.python.org/mailman/lis

Creating A Pythonic ctypes Binding

2016-09-14 Thread Lawrence D’Oliveiro
ctypes is a wonderful library. If you need to create a Python binding for some library that doesn’t already have one, you should look at ctypes, rather than writing an extension module in C or C++. The odds are, a pure Python implementation using ctyp

Re: How could I implement a virtual method and override it in python?

2016-09-14 Thread Lawrence D’Oliveiro
On Thursday, September 15, 2016 at 10:18:09 AM UTC+12, [email protected] wrote: > Helper.py: > > def Foo( *args ): > print ("This is a callback") > > def Run: > Foo() > > > MyModule.py: > > import Helper > > def Foo( *args ): > print ("I want to be the new callback") Ove

Re: Expression can be simplified on list

2016-09-14 Thread Lawrence D’Oliveiro
On Thursday, September 15, 2016 at 9:12:25 AM UTC+12, Ned Batchelder wrote: > > On Wednesday, September 14, 2016 at 5:00:02 PM UTC-4, Lawrence D’Oliveiro > wrote: >> >> On Thursday, September 15, 2016 at 8:13:05 AM UTC+12, Terry Reedy wrote: >>> >>> Because T

Re: Expression can be simplified on list

2016-09-14 Thread Lawrence D’Oliveiro
On Thursday, September 15, 2016 at 8:13:05 AM UTC+12, Terry Reedy wrote: > Because True is the default, object need not and at least in CPython > does not have a __bool__ (or __len__) method. If they had to (in the absence of which a bool() cast would not work), then that would help prevent prob

Re: Oh gods can we get any more off-topic *wink* [was Re: [Python-ideas] Inconsistencies]

2016-09-14 Thread Lawrence D’Oliveiro
On Wednesday, September 14, 2016 at 6:54:39 PM UTC+12, Rustom Mody wrote: > Yet we remain cocksure of our assumtions inspite of the repeated data > that everything we know will be negated in 5-50-500 years Let’s see, 500 years ago, people knew * That the world is round, and how to measure its radi

Re: [Python-ideas] Inconsistencies

2016-09-13 Thread Lawrence D’Oliveiro
On Monday, September 12, 2016 at 2:26:21 PM UTC+12, Chris Angelico wrote: > On Mon, Sep 12, 2016 at 12:04 PM, Lawrence D’Oliveiro wrote: >> On Monday, September 12, 2016 at 1:11:39 PM UTC+12, Chris Angelico wrote: >>> I have some _extremely_ strong views about absolutes (

Re: Expression can be simplified on list

2016-09-13 Thread Lawrence D’Oliveiro
On Wednesday, September 14, 2016 at 2:25:48 PM UTC+12, Ben Finney wrote: > Lawrence D’Oliveiro writes: > > > It would be better if all such conversions were explicit > > Why? It's entirely unambiguous ... <http://lwn.net/Articles/590299/> -- https://mail.python.org/mailman/listinfo/python-list

Re: Python inner function parameter shadowed

2016-09-13 Thread Lawrence D’Oliveiro
On Wednesday, September 14, 2016 at 4:34:34 AM UTC+12, Daiyue Weng wrote: > PyCharm warns about "Shadows name 'func' from outer scope" Typical piece of software trying to be too helpful and just getting in the way. Can you turn off such warnings? -- https://mail.python.org/mailman/listinfo/pytho

Re: Expression can be simplified on list

2016-09-13 Thread Lawrence D’Oliveiro
On Tuesday, September 13, 2016 at 2:33:40 PM UTC+12, Ned Batchelder wrote: > Why do you object to the type conversion to bool? It would be better if all such conversions were explicit, e.g. if bool(«non-bool expr») : if not bool(«non-bool expr») : instead of if «non-bool expr» :

Re: more python3 regex?

2016-09-11 Thread Lawrence D’Oliveiro
On Monday, September 12, 2016 at 6:21:57 AM UTC+12, Peter Otten wrote: > By the way, many simple text-processing problems can be solved without > regular expressions. The old JWZ quote instantly comes to mind... -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-ideas] Inconsistencies

2016-09-11 Thread Lawrence D’Oliveiro
On Monday, September 12, 2016 at 1:11:39 PM UTC+12, Chris Angelico wrote: > I have some _extremely_ strong views about absolutes (they come from the > Creator of the Universe) ... By “Universe” do you mean “everything that exists”? So if the Creator exists, then the Creator, too, must be part of

Re: [Python-ideas] Inconsistencies (was: Shuffled)

2016-09-10 Thread Lawrence D’Oliveiro
On Sunday, September 11, 2016 at 1:00:47 AM UTC+12, Chris Angelico wrote: > > On Sat, Sep 10, 2016 at 10:09 PM, Sven R. Kunze wrote: >> You might have heard of: "There are no such things as facts, just opinions. > > Yes, I've heard that. It is false. It’s very easy to see why: start by asking wh

Re: how to set paramiko to use ssh version 1?

2016-09-09 Thread Lawrence D’Oliveiro
On Thursday, September 1, 2016 at 3:26:26 PM UTC+12, meInvent bbird wrote: > how to set paramiko to use ssh version 1? Be polite, but firm. Tell it “paramiko, this is ssh version 1, use it”. Then, when it responds “but SSHv1 is an obsolete stinking pile of crap that nobody in their right mind sh

Re: How to extend a tuple of tuples?

2016-09-09 Thread Lawrence D’Oliveiro
On Saturday, September 10, 2016 at 12:21:48 AM UTC+12, Frank Millman wrote: > The short answer is that I am using it as a dictionary key. Another option is, if it takes several steps to construct the tuple, to build it incrementally as a list and then cast it to a tuple. -- https://mail.python.o

Re: python3 regex?

2016-09-09 Thread Lawrence D’Oliveiro
On Saturday, September 10, 2016 at 3:12:17 PM UTC+12, Doug OLeary wrote: > $ perl -ne 'print if (m{^("?)[1-9]*\.})' tables Perl has this feature of being able to use alternate delimiter symbols for the pattern; Python does not. > >>> regex = r'^("?)[1-9]*\.' Try putting a backslash in front of

Re: PEP suggestion: Uniform way to indicate Python language version

2016-09-09 Thread Lawrence D’Oliveiro
On Tuesday, August 23, 2016 at 2:30:10 AM UTC+12, Random832 wrote: > Receiving a SyntaxError or whatever other exception, which provides no > suggestion about how to actually fix the issue (install a later version > of python / run with "python3" instead of "python"), is a bad user > experience. W

Re: PEP 492: isn't the "await" redundant?

2016-09-09 Thread Lawrence D’Oliveiro
On Saturday, September 10, 2016 at 12:39:04 AM UTC+12, Chris Angelico wrote: > In contrast, you want to use threads if you need the ability to > quickly and easily share mutable data, or if you want all resource > usage to be lumped together - eg if you're not really doing several > separate jobs,

Re: Is it possible to process dist files before they are build via a setuptools hook?

2016-09-09 Thread Lawrence D’Oliveiro
On Friday, September 9, 2016 at 7:52:32 PM UTC+12, Mark Summerfield wrote: > So, I need to have some hook that lets me run a python script after the build > dir has been populated but before the distributable is made -- is this > possible? You can subclass distutils.command.build with your own cus

Re: libdivecomputer

2016-09-09 Thread Lawrence D’Oliveiro
On Wednesday, August 24, 2016 at 1:29:55 AM UTC+12, alister wrote: > I already have an application that works fine (sub-surface) so this is > more of a curiosity, delving into ctypes is not something I want to try > just yet. Why not? It would be a great way to learn ctypes. :) -- https://mail.

Re: PEP 492: isn't the "await" redundant?

2016-09-09 Thread Lawrence D’Oliveiro
On Friday, August 26, 2016 at 10:08:25 PM UTC+12, Marko Rauhamaa wrote: > Ultimately, asyncio and multithreading might well merge. It will be > difficult for a programmer to decide in the beginning of the design > which way to go as the programming models are almost identical. The two will never m

Re: Suggestions to improve a code

2016-09-09 Thread Lawrence D’Oliveiro
On Wednesday, September 7, 2016 at 2:55:37 AM UTC+12, GP wrote: > MaxLengthOfItem_Index =f_LMax(shelves2,MaxLengthOfItem) MaxLengthOfItem_Index = max(range(len(shelves2)), key = lambda i : shelves2[i]["Length"]) -- https://mail.python.org/mailman/listinfo/python-list

Re: pymssql

2016-09-08 Thread Lawrence D’Oliveiro
On Friday, September 9, 2016 at 12:48:50 PM UTC+12, sum abiut wrote: > cus.execute("SELECT * FROM glbud ") Never use “select *”, except for testing. > for row in cus: >print(row) > this works perfect, but when i try to iterate through and only print out > specific fields i got

Re: C Python extension to export an Function

2016-09-08 Thread Lawrence D’Oliveiro
On Friday, September 2, 2016 at 3:59:21 AM UTC+12, Stefan Behnel wrote: > Manually written C-API code is simply too difficult to maintain, and also > too difficult to get right in the first place. There are just too many ways > to introduce reference leaks, crashes and long standing unnoticed bugs

Re: degrees and radians.

2016-09-08 Thread Lawrence D’Oliveiro
On Tuesday, May 7, 2002 at 9:15:50 AM UTC+12, Fernando Pérez wrote: > Plus, if you really need those conversions, it's less typing and more > efficient (no function call) to simply use a multiplicative constant... This I have found to be the best idea. In Qahirah

Re: Helloworld with Python C extension

2016-09-07 Thread Lawrence D’Oliveiro
On Tuesday, August 30, 2016 at 6:07:15 PM UTC+12, Ganesh Pal wrote: > I was just wondering how could the C extension be debugged ? My usual way of debugging C code is to stick printf statements close to where I think the problem areas might be. Write to stderr, not stdout, so you can redirec

Re: How to run a .py file in IPython?

2016-09-07 Thread Lawrence D’Oliveiro
On Wednesday, August 31, 2016 at 3:22:40 AM UTC+12, umair durrani wrote: > It seems that the script can't 'see' any files in the Data directory. Have you tried adding debug statements to the script to 1) print out its default directory, and 2) what items it can see in that directory? -- https://m

Re: The Joys Of Data-Driven Programming

2016-09-07 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 2:36:31 PM UTC+12, I wrote: > Solution: set up a table of rules ... Here is another example. The problem is to list all external file dependencies of a Blender document, to ensure that they exist etc. Cu

Re: Does This Scare You?

2016-09-07 Thread Lawrence D’Oliveiro
On Monday, August 22, 2016 at 4:18:39 PM UTC+12, eryk sun wrote: > It would help to consult a reverse-engineered implementation of > RtlGetFullPathName_Ustr and RtlIsDosDeviceName_Ustr. I'll check the > ReactOS source code. This

Re: Two-Dimensional Expression Layout

2016-08-21 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 7:19:49 PM UTC+12, Michael Selik wrote: > > On Sun, Aug 21, 2016, 3:06 AM Lawrence D’Oliveiro wrote: > >> On Sunday, August 21, 2016 at 6:49:19 PM UTC+12, Michael Selik wrote: >> >>> Indeed it is, not sure why. >> >> Mor

Re: The Joys Of Data-Driven Programming

2016-08-21 Thread Lawrence D’Oliveiro
On Monday, August 22, 2016 at 2:20:39 AM UTC+12, Marko Rauhamaa wrote: > ... can heartily recommend SCons. It’s Python 2 only, not Python 3. -- https://mail.python.org/mailman/listinfo/python-list

Re: The Joys Of Data-Driven Programming

2016-08-21 Thread Lawrence D’Oliveiro
On Monday, August 22, 2016 at 2:20:39 AM UTC+12, Marko Rauhamaa wrote: > Lisp's "data is code and code is data" is a good principle. I have > successfully used it with Python as well. You think self-modifying code is a good idea? -- https://mail.python.org/mailman/listinfo/python-list

Re: The Joys Of Data-Driven Programming

2016-08-21 Thread Lawrence D’Oliveiro
On Monday, August 22, 2016 at 12:21:36 AM UTC+12, Chris Angelico wrote: > The issues with makefiles are mainly to do with metaprogramming (plus > a few specific issues with the format itself, which don't apply to the > more general concept). There's a ton of magic to cope with makefiles > that try

Re: The Joys Of Data-Driven Programming

2016-08-21 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 11:53:52 PM UTC+12, Rustom Mody wrote: > However seeing that list together like that I cant help wondering: > Is the philosophy of data-driven-ness itself somehow ill-conceived? I don’t understand why. They are all examples of the success of the technique, and I can

Re: Two-Dimensional Expression Layout

2016-08-21 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 6:49:19 PM UTC+12, Michael Selik wrote: > Indeed it is, not sure why. Moral: It helps to understand the code you’re criticizing, before you start criticizing, not after. -- https://mail.python.org/mailman/listinfo/python-list

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 12:44:21 PM UTC+12, Michael Selik wrote: > > On Sat, Aug 20, 2016 at 6:21 PM Lawrence D’Oliveiro wrote: > >>> if any(not isinstance(obj, Image) for obj in [src, mask, dest]): >>> ... >> >> Spot the bug in you

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 10:35:08 AM UTC+12, [email protected] wrote: > Aye, but beware that the expression is actually correct for the > indentation. > Compare: > >assert \ >( >len(self.points) == 0 >and >not self.points[0].off >or

Re: The Joys Of Data-Driven Programming

2016-08-20 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 8:08:24 PM UTC+12, Marko Rauhamaa wrote: > > Lawrence D’Oliveiro: > >> On Thursday, August 18, 2016 at 4:47:28 PM UTC+12, Marko Rauhamaa wrote: >>> >>> ... as a rule, I dislike rules. Rule languages tend to >>> grow out

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Lawrence D’Oliveiro
On Friday, August 19, 2016 at 8:56:31 PM UTC+12, I wrote: > It is handy to be able to keep complex expressions together sometimes, when > breaking them up would simply obscure their structure. To avoid lines > getting long, why not take advantage of the two available screen/page > dimensions to mak

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 12:48:46 AM UTC+12, Michael Selik wrote: > > On Fri, Aug 19, 2016 at 5:01 AM Lawrence D’Oliveiro wrote: > >> It is handy to be able to keep complex expressions together sometimes, >> when breaking them up would simply obscure their structure

Re: Python Run Error

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 11:57:16 AM UTC+12, MRAB wrote: > > On 2016-08-19 23:31, Lawrence D’Oliveiro wrote: > >> On Saturday, August 20, 2016 at 10:01:08 AM UTC+12, Suzanna McGee wrote: >>> “The program can’t start because api-ms-win-crt-runtime-l1-1-0.dll is >&g

Re: The Joys Of Data-Driven Programming

2016-08-19 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 4:47:28 PM UTC+12, Marko Rauhamaa wrote: > ... as a rule, I dislike rules. Rule languages tend to > grow out of all bounds, always remain deficient and have impenetrable, > ad-hoc semantics. That’s a very peculiar thing to say, considering that data-driven programmi

Does This Scare You?

2016-08-19 Thread Lawrence D’Oliveiro
Python 3.5.2+ (default, Aug 5 2016, 08:07:14) [GCC 6.1.1 20160724] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from pathlib import PureWindowsPath >>> PureWindowsPath("prn").is_reserved() True >>> PureWindowsPath("prn.doc").is_re

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Friday, August 19, 2016 at 8:56:31 PM UTC+12, I wrote: > To avoid lines getting long, why not take advantage of the two available > screen/page dimensions to make [expression] structure clearer? Another aspect of this has to do with line length. I regularly set my editor window width to around

  1   2   3   4   >