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: 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

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: 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

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: 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

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 #

ctypes And The WACAH Principle

2016-08-09 Thread Lawrence D’Oliveiro
GvR has said “we’re all consenting adults here”. He was referring to the “public/private/protected” access-control business that most object-oriented languages require you to go through. But there is another area where I think this principle applies to Python, at least in part: low-level access

Re: How do I make a video animation with transparent background?

2016-08-09 Thread Lawrence D’Oliveiro
On Wednesday, August 10, 2016 at 12:44:30 AM UTC+12, Martin Schöön wrote: > What I have failed to achieve is a graph with a transparent > background. While it is possible to render image frames with alpha transparency channels, as far as I know none of the motion-video image formats supports tra

Re: How do I make a video animation with transparent background?

2016-08-09 Thread Lawrence D’Oliveiro
On Wednesday, August 10, 2016 at 2:04:39 PM UTC+12, Chris Angelico wrote: > Animated GIFs support transparency. But they don’t do full colour. -- https://mail.python.org/mailman/listinfo/python-list

Re: Make sure you removed all debugging print statements error

2016-08-09 Thread Lawrence D’Oliveiro
On Tuesday, August 9, 2016 at 4:20:37 AM UTC+12, Chris Angelico wrote: > Firstly, the bare "except:" clause should basically never be used; > instead, catch a very specific exception and figure out what you want to > do here Yes. > - but secondly, don't force people's names to be subdivided. I l

Round-Trip Object Correspondence, Weakrefs And __new__

2016-08-09 Thread Lawrence D’Oliveiro
Qahirah is a Pythonic API binding for the Cairo 2D graphics library. When designing it, I tried to imagine how the graphics API would look if had been created for Python in the first place, rather than for C. One of the important decisions I made was to implemen

Re: Python slang

2016-08-09 Thread Lawrence D’Oliveiro
On Monday, August 8, 2016 at 9:02:15 PM UTC+12, Anders J. Munch wrote: > It was only later that language designers fell into the notion that it > was crucial for a new language's success to look as much like C++ as > possible. Nevertheless, Python copied the C misfeature of using “=” for assignme

Re: Subprocess Startup Error

2016-08-09 Thread Lawrence D’Oliveiro
On Wednesday, August 10, 2016 at 8:12:10 AM UTC+12, xlarged...@aol.com wrote: > "Either IDLE can't start a subprocess or personal firewall software is > blocking the connection." Q: Why does Windows print such explanatory error messages? A: To give you a hint as to the cause of the problem. -- h

Re: ctypes And The WACAH Principle

2016-08-10 Thread Lawrence D’Oliveiro
On Wednesday, August 10, 2016 at 6:35:57 PM UTC+12, Gregory Ewing wrote: > It's talking about accessing the internals of an object from C or C++ code, > *not* from Python. It’s saying that’s “the only way to effectively make use of this information”, which it is not. > If you're using ctypes an

Re: ctypes And The WACAH Principle

2016-08-10 Thread Lawrence D’Oliveiro
On Wednesday, August 10, 2016 at 10:13:53 PM UTC+12, eryk sun wrote: > ctypes classes have from_buffer and from_buffer_copy methods that use > the buffer protocol. For example, for a read-only buffer you can use > from_buffer_copy: > > >>> b = bytes(b'1234') > >>> a = (ctypes.c_char * 3).

Re: Python slang

2016-08-10 Thread Lawrence D’Oliveiro
On Thursday, August 11, 2016 at 5:35:03 AM UTC+12, Rustom Mody wrote: > On Wednesday, August 10, 2016 at 9:31:40 PM UTC+5:30, Anders J. Munch wrote: > Python’s inspiration and origin is ABC > Whose assignment looked like > PUT expr INTO var HyperTalk did that in 1987. Is that where GvR got the id

Re: Python slang

2016-08-10 Thread Lawrence D’Oliveiro
On Thursday, August 11, 2016 at 4:01:40 AM UTC+12, Anders J. Munch wrote: > Lawrence D’Oliveiro: >> >>> [...] as much like C++ as possible. >> >> Nevertheless, Python copied the C misfeature [...] > > You segued a little too easily from C++ to C. Becau

Re: cmd prompt does not recognizes python command on Windows 7

2016-08-10 Thread Lawrence D’Oliveiro
On Wednesday, August 10, 2016 at 4:47:33 PM UTC+12, sh.a...@gmail.com wrote: > i have installed python 3.5 , but the python command is not recognized Windows does not make it easy to install things, does it... -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I make a video animation with transparent background?

2016-08-10 Thread Lawrence D’Oliveiro
On Thursday, August 11, 2016 at 9:34:33 AM UTC+12, Martin Schöön wrote: > Next on my TODO list is to look into the color composition idea. I > have already looked this tutorial: > https://youtu.be/sZzmksnzrX0 If the images you generate have an alpha channel, Blender can composite them directly, w

Re: ctypes And The WACAH Principle

2016-08-10 Thread Lawrence D’Oliveiro
On Thursday, August 11, 2016 at 10:31:36 AM UTC+12, Gregory Ewing wrote: > > Lawrence D’Oliveiro wrote: > >>>It will let you create non-leaky wrappers ... >> >> Why would I want to do that? > > You mentioned that ctypes wrappers are leaky, which I > a

Re: Python slang

2016-08-10 Thread Lawrence D’Oliveiro
On Thursday, August 11, 2016 at 7:18:28 AM UTC+12, Marko Rauhamaa wrote: > Oh, there's of course COBOL: > >ADD X TO Y GIVING RESULT I think COBOL has the same usage of “=” as BASIC, as assignment or equality comparison, depending on context. -- https://mail.python.org/mailman/listinfo/pyth

Re: ctypes And The WACAH Principle

2016-08-10 Thread Lawrence D’Oliveiro
On Thursday, August 11, 2016 at 3:23:58 PM UTC+12, eryk sun wrote: > > ...you can cast() bytes to c_void_p to get the address. > > ... > > For bytearray, use the buffer interface to create a ctypes array. The > array is not a copy. Cool! Those pointers* are much appreciated. *So to speak. :) --

Re: Generate reports in Python

2016-08-11 Thread Lawrence D’Oliveiro
On Thursday, August 11, 2016 at 8:30:42 PM UTC+12, wxjm...@gmail.com wrote: > I do not see to much how a library can beat that approach, unless it > duplicates what TeX does. TEX may be fine for more free-form text, but often reports take a more structured layout than that--fixed columns etc. Fo

Re: Is it ‘allowed’ to get parameters like this

2016-08-11 Thread Lawrence D’Oliveiro
On Friday, August 12, 2016 at 1:28:04 AM UTC+12, Cecil Westerhof wrote: > As I understood it getopt is the way to get the parameters for your > script. But at the moment it looks a bit like overkill, my script does > not have much parameters as parameter_error shows: That’s fine. But your command

Re: Asynchronous programming

2016-08-11 Thread Lawrence D’Oliveiro
On Friday, August 12, 2016 at 2:25:05 AM UTC+12, Terry Reedy wrote: > When I read something like "Python finally acquired an event loop in > 3.4" I wonder where people have been. The tk event loop has been in > Python perhaps for 2 decades... As was pointed out to me just a few days ago, that’

Re: python 3.5.2 lounch: api-ms-win-crt-runtime-l1-1-0.dll is missing ?

2016-08-11 Thread Lawrence D’Oliveiro
On Tuesday, August 9, 2016 at 6:46:52 AM UTC+12, Joaquin Alzola wrote: > This email is confidential and may be subject to privilege. If you are not > the intended recipient, please do not copy or disclose its content but > contact the sender immediately upon receipt. Consider yourself contacted!

Re: Call for Assistance

2016-08-11 Thread Lawrence D’Oliveiro
On Wednesday, August 10, 2016 at 3:42:39 AM UTC+12, Reto Brunner wrote: > What on earth isn't "free" enough about > > You are free to: > Share — copy and redistribute the material in any medium or format No you are not. A court has ruled

Re: Call for Assistance

2016-08-11 Thread Lawrence D’Oliveiro
On Wednesday, August 10, 2016 at 1:09:31 PM UTC+12, Charles Ross wrote: > Well, I’ve been convinced. The license for the book is now Creative > Commons Attribution-ShareAlike. Great. :) That’s the one to use if you are worried about companies who want something for nothing coming in and ripping

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread Lawrence D’Oliveiro
On Thursday, August 11, 2016 at 8:33:41 AM UTC+12, Juan Pablo Romero Méndez wrote: > I've been trying to find (without success so far) an example of a situation > where the dynamic features of a language like Python provides a clear > advantage over languages with more than one type. I have used

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread Lawrence D’Oliveiro
On Friday, August 12, 2016 at 9:39:11 PM UTC+12, BartC wrote: > 'year' has been spelled wrongly That’s why Python has __slots__. -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread Lawrence D’Oliveiro
On Saturday, August 13, 2016 at 2:33:55 PM UTC+12, bream...@gmail.com wrote: >> Surely this application was built using a build system, even back then, >> that would allow compilation to resume and not rebuild object files that >> were already built. > > Are you one of those extremely lucky people

Re: Win32 API in pywin32

2016-08-12 Thread Lawrence D’Oliveiro
On Friday, August 5, 2016 at 11:58:05 AM UTC+12, I wrote: > > Are people still using Win32? I thought Windows went 64-bit years ago. Here is a little titbit I was looking for: Win32 has a function for getting the size o

Re: Win32 API in pywin32

2016-08-13 Thread Lawrence D’Oliveiro
On Saturday, August 13, 2016 at 10:49:11 PM UTC+12, eryk sun wrote: > You can call GetFileSizeEx [1]. Or call GetFileInformationByHandleEx > [2] to get the FileStandardInfo. These APIs use the LARGE_INTEGER > union type, which has a long long "QuadPart" member. > ... > FILETIME is a legacy of the W

Multi-Line Strings: A Modest Proposal

2016-08-13 Thread Lawrence D’Oliveiro
Python allows a single string literal to cross multiple lines, provided it begins and ends with three quote characters, e.g. s = """this string continues on the next line.""" There is a drawback with this: any whitespace at the start of the continuation line is included as part of the s

Re: Creating dictionary of items from Excel with mutliple keys

2016-08-13 Thread Lawrence D’Oliveiro
On Sunday, August 14, 2016 at 6:43:54 AM UTC+12, Michael Selik wrote: > Rather than using xlrd or other tools to read from excel, can you save the > file as CSV (comma-separated values)? I think you'll find Python's csv > module is very pleasant to use. Trying to use Python as a substitute for VBA

Re: Asynchronous programming

2016-08-13 Thread Lawrence D’Oliveiro
On Saturday, August 13, 2016 at 8:26:05 PM UTC+12, Marko Rauhamaa wrote: > ... (unless Python takes Linux's AIO API into use, which > would be groundbreaking). Last I looked, asynchronous I/O on Linux was still a work in progress. The whole POSIX API has been grounded in the assumption that all

Re: Multi-Line Strings: A Modest Proposal

2016-08-13 Thread Lawrence D’Oliveiro
On Sunday, August 14, 2016 at 1:53:42 PM UTC+12, John Wong wrote: > s = ("this string continues " + >"substring continues") Now there’s a Java way of doing it. :) I prefer implicit string concatenation myself. Isn’t it peculiar that, while this feature was introduced in C and faithfully

Re: Anyone here running Python on a PowerPC?

2016-08-13 Thread Lawrence D’Oliveiro
On Sunday, August 14, 2016 at 3:11:56 PM UTC+12, Michael Torrie wrote: > I also suggested QEMU, but I'm not sure it's 64-bit PPC, and I'm pretty > sure PowerMacs wouldn't be 64-bit either. Though I see some references > to PPC64 and QEMU in google searches. A little table here

Re: What's the best way to minimize the need of run time checks?

2016-08-13 Thread Lawrence D’Oliveiro
On Sunday, August 14, 2016 at 4:21:16 PM UTC+12, Chris Angelico wrote: > You have a working class factory, which is downright *impossible* in > many languages. If good old, plain old C can do this: /*prints itself*/void main(void){int c=34;char*s="/*prints itself*/void main(void){int c=34;ch

Re: compile a python3 project with autotools

2016-08-14 Thread Lawrence D’Oliveiro
On Monday, August 15, 2016 at 9:24:04 AM UTC+12, Rudra Banerjee wrote: > but while running the application, I am getting error: > (mkbib:14843): Gtk-CRITICAL **: New application windows must be added after > the GApplication::startup signal has been emitted. Does the application actually fail? Be

Re: What's the best way to minimize the need of run time checks?

2016-08-14 Thread Lawrence D’Oliveiro
On Monday, August 15, 2016 at 4:31:44 AM UTC+12, BartC wrote: > But it can't create a new record or struct type at runtime which can > then be accessed using normal syntax, in compiled code that already > existed before the record was created. That’s an awful lot of “which ... that” qualificati

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 6:36:41 AM UTC+12, sohca...@gmail.com wrote: > What helped me understand Lambdas is figuring out that they're really just > a $1,000 term for a $5 concept. The excuse for the “$1,000 term” is that it came from Alonzo Church’s λ-calculus, which was an alternative for

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 6:26:01 PM UTC+12, Paul Rudin wrote: > sohcahtoa82 writes: >> squared_plus_one_list = map(lambda x: x**2 + 1, some_list) > > I realise that this is about understanding lambda, but it's worth noting > in passing that we tend to write this sort of thing as: > > square

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 6:34:53 PM UTC+12, Ian wrote: > On Aug 15, 2016 6:57 PM, "Lawrence D’Oliveiro" wrote: > > Python, on the other hand, introduces the special word “lambda” for this > purpose, eschewing its usual “def”. > > Why? Something to do wit

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 7:22:42 PM UTC+12, Ian wrote: > On Aug 16, 2016 12:57 AM, "Lawrence D’Oliveiro" wrote: > > But perhaps this limitation wasn’t intentional, just an inherent > consequence of the fact that Python’s significant-whitespace rules only >

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 6:53:24 PM UTC+12, Jussi Piitulainen wrote: > Lawrence D’Oliveiro writes: > >> Why could this difference be important? > > Different comprehensions (pun!) and performance characteristics. A potential difference in memory usage. When could

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 7:19:01 PM UTC+12, Ian wrote: > On Aug 16, 2016 12:36 AM, "Lawrence D’Oliveiro" wrote: > > The difference being that the “map” function takes an iterable and returns > an iterator. > > In Python 3, yes. However, assi

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Lawrence D’Oliveiro
On Wednesday, August 17, 2016 at 6:46:22 AM UTC+12, alister wrote: > I don't think I am missing anything by not bothering with them YMMV Here are some examples of that varying mileage. -- https://mail.python.org/mailma

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 6:28:06 AM UTC+12, Terry Reedy wrote: > >> Why couldn’t they have adopted the standard C >> syntax, as used in a whole bunch of other C-derivative languages? >> cond ? trueval : falseval > > That particular syntax was not really considered. At least 10

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 5:53:14 AM UTC+12, MRAB wrote: > C uses "->" for dereferencing a pointer to the member of a struct. The only reason why “s->f” was added was because “(*s).f” was considered an unwieldy thing to have to write all the time. And the only thing that made that unwield

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 6:28:06 AM UTC+12, Terry Reedy wrote: >> https://www.python.org/dev/peps/pep-0308/ > > What the *current* version removed from an earlier version is that there > was a clear community consensus against the condition-in-the-middle > syntax Guido proposed and for so

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 8:25:37 AM UTC+12, Terry Reedy wrote: > > for section_name, line_number in text.parser.toc: > def goto(line=line_number): > text.yview(line) > drop.add_command(label=section_name, command=goto) You don’t think of t

The Joys Of Data-Driven Programming

2016-08-17 Thread Lawrence D’Oliveiro
Problem: let the user specify certain parameters for a screen display (width, height, diagonal, pixel density, pixels across, pixels down, optimum viewing distance) and from the ones specified, work out the parameters which were not specified. Solution: set up a table of rules

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 12:55:33 PM UTC+12, Terry Reedy wrote: > > On 8/17/2016 7:13 PM, Lawrence D’Oliveiro wrote: > >> On Thursday, August 18, 2016 at 8:25:37 AM UTC+12, Terry Reedy wrote: >>> >>> for section_name, line_number in text.parser.to

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 7:22:50 PM UTC+12, Jussi Piitulainen wrote: > But please consider calling them conditional expressions. And don’t forget switch-expressions, or case-expressions, as some other advanced languages have had. Which my article showed how to do in Python. -- https://mai

Re: --> Running shell script with python

2016-08-18 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 8:00:51 PM UTC+12, gm wrote: > os.system("python /home/pi/test/testserver.sh") command > > How to run shell ( not python ) script, from python code ? Take out the “python” from the command. -- https://mail.python.org/mailman/listinfo/python-list

Re: type lookuperror

2016-08-18 Thread Lawrence D’Oliveiro
On Friday, August 19, 2016 at 3:10:26 AM UTC+12, Chris Angelico wrote: > What the OP was looking for was "I want my program to be able to debug > itself". That means the program has to be smart enough to figure out > its own problems. Maybe it is, it just doesn’t agree with you on what those probl

Re: integer's methods

2016-08-18 Thread Lawrence D’Oliveiro
On Friday, August 19, 2016 at 12:59:09 AM UTC+12, ast wrote: > I wonder why calling a method on an integer > doesn't work ? Sure it does. >>> 2 + 5 7 >>> (2).__add__(5) 7 -- https://mail.python.org/mailman/listinfo/python-list

Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
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 make their structure clearer? As a bonus, spacing out parentheses

Re: saving octet-stream png file

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 6:03:53 AM UTC+12, Terry Reedy wrote: > > An 'octet' is a byte of 8 bits. Is there any other size of byte? -- https://mail.python.org/mailman/listinfo/python-list

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 7:52:09 AM UTC+12, codew...@gmail.com wrote: > if any([ > not isinstance(src, Image), > mask != None and not isinstance(mask, Image), > not isinstance(dest, Image), > ]): > raise TypeError("image args must be Image objects") >

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 5:53:22 AM UTC+12, Terry Reedy wrote: > > To me, putting parens and '+' and 'or' on separate lines emphasizes them > too much and makes the layout more, not less, cluttered. So having whitespace around these symbols makes things look *more* cluttered, while packin

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 9:56:05 AM UTC+12, codew...@gmail.com wrote: > > On Friday, August 19, 2016 at 5:30:22 PM UTC-4, Lawrence D’Oliveiro wrote: > >> On Saturday, August 20, 2016 at 7:52:09 AM UTC+12, codew...@gmail.com >> wrote: >>> if any([ >>

Re: Python Run Error

2016-08-19 Thread Lawrence D’Oliveiro
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 > missing from your computer. Try reinstalling the program to fix this > problem.” Why not do what it says? -- https://mail.python.org/mailman/listinfo/

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 10:38:34 AM UTC+12, Chris Angelico wrote: > > On Sat, Aug 20, 2016 at 8:31 AM, Lawrence D’Oliveiro wrote: >> >> There is no short-cut evaluation when constructing tuples and lists. > > I'm not sure how that would make difference in thes

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

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: 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

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: 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: 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: 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 Sunday, August 21, 2016 at 10:35:08 AM UTC+12, c...@zip.com.au 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: 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-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: 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: 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 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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: [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: [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: 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

  1   2   3   4   >