Re: PEP 526 - var annotations and the spirit of python

2018-07-16 Thread Peter J. Holzer
rn on a few additional ones). I remember a time when many compilers had "warning levels". That was really annoying, because level n always was missing a few warnings I found very useful while level n + 1 was burying me in a deluge of useless warnings. hp -- _ | Peter J. Holzer| we build

Re: Cookies not showing up in environ

2018-07-20 Thread Peter J. Holzer
): > if not 'HTTP_COOKIE' in environ: The first argument to a Django view function is the request object, not anything one could plausibly name "environ". See the django docs on how to access the fields of a request. hp -- _ | Peter J. Holzer| we build m

Re: Getting installed version

2018-07-21 Thread Peter J. Holzer
t psycopg2 >>> psycopg2.__version__ '2.5.4 (dt dec pq3 ext)' >>> import numpy >>> numpy.__version__ '1.8.2' But there are exceptions: >>> import xlrd >>> xlrd.__VERSION__ '0.9.2' or even: >&g

Re: [OT] Bit twiddling homework

2018-07-21 Thread Peter J. Holzer
. Might be just an accident, although the difference is remarkably reproducible. Anybody have a CPU emulator handy to trace this clock by clock? ;-) hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophis

Re: coding style - where to declare variables

2018-07-22 Thread Peter J. Holzer
s good practice. C++ introduced the possibility to declare variables at any point in a block, not just the beginning. C copied this in C99. Again I would argue that Stroustrup introduced the feature because he considered declaring variables for the smallest possible scope as good practice, an

Re: Good reason not to obfuscate URLs (was: Fishing from PyPI ?)

2018-08-14 Thread Peter J. Holzer
spammers. I hate to defend Outlook (which I think is a really bad MUA), but it gets this one right: Properly configured[1] it does NOT load inline images from web-pages, so you can't be tracked simply by opening a mail. hp [1] Not sure whether this is the default or whether our admins

Re: fsxNet Usenet gateway problem again

2018-09-08 Thread Peter J. Holzer
t; at the end instead of the username to prevent people from (ab)using the path as a mail address. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tool

Re: How to change '\\' to '\'

2018-10-01 Thread Peter J. Holzer
hp [1] And even there not always, as I've learned from the resident Windows expert on this list. -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | managem

Re: Python indentation (correct behaviour) (was: Python indentation (3 spaces))

2018-10-08 Thread Peter J. Holzer
indent-guides>. Nice. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/&g

Re: Python indentation (3 spaces)

2018-10-08 Thread Peter J. Holzer
r 57 pixels or whatever. In practice it doesn't work in my experience. There is always someone in a team who was "just testing that new editor" and replaced all tabs with spaces (or vice versa) or - worse - just some of them. It is safer to disallow tabs completely and mandate a cert

Re: Observations on the List - "Be More Kind"

2018-10-09 Thread Peter J. Holzer
planation (at the time). This makes it a bit hard to know what is and is not acceptable on this list. [explanations snipped] hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | |

Re: ESR "Waning of Python" post

2018-10-12 Thread Peter J. Holzer
types in your Go programs. Go isn't object-oriented, but that doesn't make its type system useless (I've certainly created lots of useful data types in C). hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because w

Re: how to replace line on particular line in file[no need to write it back whole file again]

2018-10-12 Thread Peter J. Holzer
to do anything you can't do with normal file I/O. It's just sometimes more convenient and/or performant. > -- and even if you manage to do that, > you'd have to write back anything after the changed line if the length > of that line changed by as little as a byte. This is co

Re: how to replace line on particular line in file[no need to write it back whole file again]

2018-10-12 Thread Peter J. Holzer
t;. > Xerox CP-V offered "consecutive", "keyed", and "random" file > organizations. I don't know if there was a C implementation for CP-V, but there is certainly nothing in the C standard which would prevent a standard conforming imp

Re: how to replace line on particular line in file[no need to write it back whole file again]

2018-10-12 Thread Peter J. Holzer
On 2018-10-12 22:28:44 -0400, Dennis Lee Bieber wrote: > On Fri, 12 Oct 2018 21:00:45 +0200, "Peter J. Holzer" > declaimed the following: > >I don't know if there was a C implementation for CP-V, but there is > >certainly nothing in the C standard which would

Re: ESR "Waning of Python" post

2018-10-13 Thread Peter J. Holzer
ch can run mostly without locks. But this is of course a lot of work with no guarantee of success. (JPython and IronPython did something similar, although they didn't design new VMs, but reused VMs designed for other languages). hp -- _ | Peter J. Holzer| we build much bi

Re: Python indentation (3 spaces)

2018-10-13 Thread Peter J. Holzer
On 2018-10-08 20:13:38 +, Grant Edwards wrote: > On 2018-10-08, Peter J. Holzer wrote: > > Theoretically I would agree with you: Just use a single tab per > > indentation level and let the user decide whether that's displayed > > as 2, 3, 4, or 8 spaces or 57 pixe

Re: Python indentation (3 spaces)

2018-10-13 Thread Peter J. Holzer
On 2018-10-09 09:55:34 +0200, Antoon Pardon wrote: > On 08-10-18 19:43, Peter J. Holzer wrote: > > On 2018-10-08 10:36:21 +1100, Chris Angelico wrote: > >> How wide my indents are on my screen shouldn't influence your screen > >> or your choices. > > Theoreti

Re: Is this mailbox manipulation working by luck, or can't I understand my own code?

2018-10-13 Thread Peter J. Holzer
the get method: https://docs.python.org/3/library/email.compat32-message.html#email.message.Message.get hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | man

Re: Python indentation (3 spaces)

2018-10-14 Thread Peter J. Holzer
On 2018-10-14 00:45:49 +, Grant Edwards wrote: > On 2018-10-13, Peter J. Holzer wrote: > > > >> For "just use tabs" to work, all of those tools would have to > >> magically recognize that they're looking at Python source and adjust > >> th

Re: Python indentation (3 spaces)

2018-10-14 Thread Peter J. Holzer
ad to stop that in Django projects because it messes up the stack traces. > Not sure what you mean by US, RS, and GS, Unit separator, record separator, group separator (and FS is file separator). I think they were intended for a CSV-like file format, but I have never seen them in use (

Re: Python indentation (3 spaces)

2018-10-15 Thread Peter J. Holzer
On 2018-10-15 09:49:12 +1100, Cameron Simpson wrote: > On 15Oct2018 00:33, Peter J. Holzer wrote: > > On 2018-10-15 09:06:11 +1100, Chris Angelico wrote: > > > On Mon, Oct 15, 2018 at 8:56 AM Marko Rauhamaa wrote: > > > > Chris Angelico : > > > > > Ta

Re: Python indentation (3 spaces)

2018-10-15 Thread Peter J. Holzer
On 2018-10-15 12:06:06 +0100, Rhodri James wrote: > On 14/10/18 09:06, Peter J. Holzer wrote: > > If everybody used tabs, why would anyone care about your tab width? > > Unless they look over your shoulder while you are typing, they won't > > even know how wide your tabs

Re: Python indentation (3 spaces)

2018-10-15 Thread Peter J. Holzer
On 2018-10-15 14:12:54 +0200, Antoon Pardon wrote: > On 13-10-18 09:37, Peter J. Holzer wrote: > > On 2018-10-09 09:55:34 +0200, Antoon Pardon wrote: > >> On 08-10-18 19:43, Peter J. Holzer wrote: > >>> In practice it doesn't work in my experience. There is alw

Re: Python indentation (3 spaces)

2018-10-20 Thread Peter J. Holzer
On 2018-10-16 06:37:56 +1100, Chris Angelico wrote: > On Tue, Oct 16, 2018 at 6:34 AM Peter J. Holzer wrote: > > On 2018-10-15 14:12:54 +0200, Antoon Pardon wrote: > > > On 13-10-18 09:37, Peter J. Holzer wrote: > > > > On 2018-10-09 09:55:34 +0200, Antoon Pardon wro

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-10-20 Thread Peter J. Holzer
s the right fix or previous or > both wrong?? 0xB0 isn't a valid ASCII character, so you'll get a decoding error for open(..., encoding="ascii"), too. You will have to find out the correct encoding for your file and use that. hp -- _ | Peter J. Ho

Re: Python indentation (3 spaces)

2018-11-11 Thread Peter J. Holzer
On 2018-10-25 12:59:18 +0200, Antoon Pardon wrote: > On 20-10-18 14:38, Peter J. Holzer wrote: > > On 2018-10-16 06:37:56 +1100, Chris Angelico wrote: > >> On Tue, Oct 16, 2018 at 6:34 AM Peter J. Holzer wrote: > >>> On 2018-10-15 14:12:54 +0200, Antoon Pardon w

Re: Why do data descriptors (e.g. properties) take priority over instance attributes?

2018-12-27 Thread Peter J. Holzer
On 2018-12-27 14:17:34 +0100, Peter J. Holzer wrote: > On 2018-12-17 21:57:22 +1100, Paul Baker wrote: > > class C: > > def __init__(self): > > self.__dict__['a'] = 1 > > > > @property > > def a(s

Re: Why do data descriptors (e.g. properties) take priority over instance attributes?

2018-12-27 Thread Peter J. Holzer
__(self): ... self.__dict__['a'] = 1 ... @property ... def a(self): ... return 2 ... >>> o = C() >>> o.a 1 hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because

Re: the python name

2019-01-04 Thread Peter J. Holzer
orks the same when I'm ssh'd into a server as when I work locally) and not having to replicate the environment is a plus for me. If my tools worked only locally, I could do all development locally. > as of yet the develop option doesn't seem to work how i > would expect. What is &

Re: the python name

2019-01-04 Thread Peter J. Holzer
ve any of these > enhanced objects back when created, or even now? Certainly not then. Probably not now. Fortran isn't about symbolic manipulation. It's about number crunching. And in the beginning it was mostly about not having to write assembler. hp -- _ | Pete

Re: the python name

2019-01-06 Thread Peter J. Holzer
On 2019-01-04 12:56:56 -0500, songbird wrote: > Peter J. Holzer wrote: > > Almost all of these points don't seem to be related to the language, but > > to your environment. > > an application isn't useful unless it actually can > be deployed and used in an en

Re: the python name

2019-01-06 Thread Peter J. Holzer
can be parallelized while the C compiler can't be sure. (Both languages have constructs (some native, some as extensions) to specify that explicitely, but the programmer has to use them (and use them correctly)) hp -- _ | Peter J. Holzer| we build much bigger, better d

Python packaging (was: the python name)

2019-01-06 Thread Peter J. Holzer
On 2019-01-06 13:26:15 +0100, Peter J. Holzer wrote: > I haven't packaged anything yet. I have looked at the documentation > several times and I agree that it looks somewhat daunting (I am not > unfamiliar with packaging systems: I have built rpm and deb packages, > and used bot

Re: the python name

2019-01-06 Thread Peter J. Holzer
On 2019-01-06 13:43:02 -0500, Dennis Lee Bieber wrote: > On Sun, 6 Jan 2019 13:26:15 +0100, "Peter J. Holzer" > declaimed the following: > > >For example, about 10 years ago I built a continuous integration > >pipeline for a project I was working on [...] > &g

Compilation (was: the python name)

2019-01-06 Thread Peter J. Holzer
, as the authors think that programmers are more likely to look at the output of the tool they have to use than to invoke a separate, optional tool. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more

Re: Im trying to replicate the youtube video Creating my own customized celebrities with AI.

2019-02-11 Thread Peter J. Holzer
sor. Tension, apprehension, And dissention have begun. SCNR, hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.a

Re: The slash "/" as used in the documentation

2019-02-12 Thread Peter J. Holzer
On 2019-02-12 07:31:54 +1100, Chris Angelico wrote: > Positional arguments with defaults is a concept known in MANY > languages, True. > including C. Nope. At least not until C99, and I can't find anything in C11 either. Maybe they'll add it in C2x. hp -- _

Re: Quirk difference between classes and functions

2019-02-27 Thread Peter J. Holzer
al variables and arrange for it to be executed before any other code in the function. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools.

Re: Block Ctrl+S while running Python script at Windows console?

2019-03-19 Thread Peter J. Holzer
does a lot more than just control flow control, so it may not be appropriate for the OP's problem. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools

Re: Might be doing this wrong? (Turtle graphics)

2019-03-22 Thread Peter J. Holzer
he beginning of lines (the "indentation"). This can be a problem when you copy and paste fragments of code. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.a

Re: Jinja and non-ASCII characters (was Re: Prepare accented characters for HTML)

2019-03-29 Thread Peter J. Holzer
{"french": "ann\xe9e"})) UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 11: ordinal not in range(128) This was fixed(?) in Python 3.7. hp -- _ | Peter J. Holzer| we build much bigger, better disaster

Re: Library for parsing binary structures

2019-03-29 Thread Peter J. Holzer
don't remember the names and I'm not sure if the generators got beyond the proof of concept stage. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at

Re: Library for parsing binary structures

2019-03-29 Thread Peter J. Holzer
On 2019-03-29 16:34:35 +, Paul Moore wrote: > On Fri, 29 Mar 2019 at 16:16, Peter J. Holzer wrote: > > > Obviously you need some way to describe the specific binary format you > > want to parse - in other words, a grammar. The library could then use > > the gr

Re: Why do I need to use pip3 but not pip

2019-03-30 Thread Peter J. Holzer
ersion (or range of versions). Normally getting the newest version is fine. Finally, here is my venv function: venv() { for d in venv/"$1" ve/"$1" ~/venv/"$1" "$1" do if [ -f "$d"/bin/activate ] then . "$d&quo

Re: Generating generations of files

2019-04-29 Thread Peter J. Holzer
with open11("foo", "w") as f: f.write("test2") with open11("foo", "w") as f: f.write("test3") :-) (WARNING: I haven't really tested this) hp PS: I like Chris' suggestion to just use git. But it

EmailMessage and RFC 2047

2019-04-30 Thread Peter J. Holzer
'[luga] =?utf-8?Q?=C3=84ndern_des_Passwortes_mittels_We?=\n\t=?utf-8?Q?bformular?=' >>> m["From"] 'Martin =?iso-8859-15?Q?W=FCrtele?= ' >>> Am I using it wrong or did I misunderstand what is meant by "handled transp

Re: Dynamic selection for network service ports?

2019-04-30 Thread Peter J. Holzer
server which allows updates (if you use AD, you already have one, if you use bind, it's not too hard). Container orchestration systems like Kubernetes also include such registration services. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) |

Re: EmailMessage and RFC 2047

2019-04-30 Thread Peter J. Holzer
On 2019-04-30 17:45:52 +0200, Thomas Jollans wrote: > On 30/04/2019 13.11, Peter J. Holzer wrote: > > https://docs.python.org/3.7/library/email.header.html states: > > > > | This module is part of the legacy (Compat32) email API. In the current > > | API encoding

Re: Django Potential Fork Bomb

2019-05-10 Thread Peter J. Holzer
call the django.contrib.admin app "the Django GUI", but that doesn't seem to fit your description that it executes code in *your* app. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated

Re: Help? How do i solve this problem with Python List Concept

2019-05-14 Thread Peter J. Holzer
e youngest children, we get nice round numbers: The youngest child is 5, the oldest 32, and the divisor is 1250. So the youngest inherits 6250 NGN, the oldest 4 NGN, and the rest are trivial to compute. You owe the Oracle a first print of "Rechnung auff der Linihen und Federn" and th

Re: Import module from a different subdirectory

2019-05-18 Thread Peter J. Holzer
s' >>> This doesn't work, since there is no classes/model.py in "", only in "..". But if I add a PYTHONPATH, it works again: hrunkner:~/tmp/bustrac/scripts 18:15 :-) 1151% export PYTHONPATH=~/tmp/bustrac hrun

Re: Import module from a different subdirectory

2019-05-18 Thread Peter J. Holzer
your directory named "business-tracker" (see above). hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ |

Re: Import module from a different subdirectory

2019-05-19 Thread Peter J. Holzer
y while waiting for the coffee machine to boot - too much time to form weird associations. -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. _

Re: Checking refusal of a network connection

2019-06-01 Thread Peter J. Holzer
:1 and 127.0.0.1 are distinct addresses. If you want to accept connections on both, you have to listen on both (or on ::, which does accept connections on all IP addresees - IPv6 and IPv4). hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) |

Re: PEP 594 cgi & cgitb removal

2019-06-01 Thread Peter J. Holzer
close to 10 requests to dynamic content per second. Much less 10 requests per second per core. I don't use CGI very much these days (and when I do, I use Perl - old habits die hard), but performance isn't the reason. hp -- _ | Peter J. Holzer| we build muc

Re: Handling an connection error with Twython

2019-06-01 Thread Peter J. Holzer
an exception) > time.sleep(60) > raise RuntimeError('Should not get here') ^^^^^^^^^ So if you can't get a status update you will reach this point. hp -- _ | Peter J. Holzer| we build much

Re: Checking refusal of a network connection

2019-06-01 Thread Peter J. Holzer
need to bind to two addresses. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ross Anderson <https://www

Re: Checking refusal of a network connection

2019-06-01 Thread Peter J. Holzer
ure about this conclusion. Well, we don't study theology here. We don't have to theorize (no pun intended), we can experiment. Why don't you just try it out? > Under which circumstances will the Python programming interfaces > support the direct usage of the identification

Re: Checking refusal of a network connection

2019-06-04 Thread Peter J. Holzer
on since I'm not sure what your question is) > If my software test client would pass the IPv6 address family for a > connection, both processes would use the same network protocol > version. Yes. hp -- _ | Peter J. Holzer| we build much bigger, better disasters n

Re: FDs will be closed after exception automatically in python2.7?

2019-06-10 Thread Peter J. Holzer
d (in the case of a with block immediately, otherwise when the garbage collector gets around to it). hp [1] Don't know if those exist in Python 2.x. You should upgrade to 3.x anyway. -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) |

Re: Why Python has no equivalent of JDBC of Java?

2019-06-16 Thread Peter J. Holzer
of python db drivers uses Cython, > Python C API or external C libraries. Which I would take as an indication that Python is "further from the metal". Python isn't really suited for the job so you have to switch to a lower-level (closer to the metal) language to implement it. &g

Re: Multiprocessing and memory management

2019-07-03 Thread Peter J. Holzer
ocess terminates or maybe only until you get a better estimate). hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp

Re: Handle foreign character web input

2019-07-04 Thread Peter J. Holzer
en (or even printed) Chinese name on any keyboard (I managed to do that recently, but that was a lot of work and way into "a fun challenge to do once, not something I want to repeat" territory). hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) |

Re: OT: Is there a name for this transformation?

2019-07-10 Thread Peter J. Holzer
each row (e.g. order of appearance, or a count), so you'll use a second dict for that. For output you get a list of columns in the right order and then iterate over the 1st level keys of your dict and the list of columns to access each cell. hp -- _ | Peter J. Holzer| we bui

Re: How to execute shell command in Python program?

2019-07-20 Thread Peter J. Holzer
cks. In this case you should set shell=False. Either invoke the command directly with an argument vector (almost always preferrable), or invoke the shell with a shell command. Don't mix them. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) |

Re: Proper shebang for python3

2019-07-20 Thread Peter J. Holzer
e differently because of a different path, #!/usr/bin/env is a total no-no. There is a nice way to achieve this: Just use the interpreter of the virtual environment in the shebang. (That requires rewriting the shebang during installation, but that's a minor inconvenience) hp -- _ | Pet

Re: Proper shebang for python3

2019-07-21 Thread Peter J. Holzer
On 2019-07-20 15:26:46 -0500, Tim Daneliuk wrote: > On 7/20/19 2:56 PM, Peter J. Holzer wrote: > > On 2019-07-20 14:11:44 -0500, Tim Daneliuk wrote: > >> So, no, do NOT encode the hard location - ever. Always use env to > >> discover the one that the user has specif

Re: Proper shebang for python3

2019-07-21 Thread Peter J. Holzer
still invoke /usr/bin/groff even if that isn't in the PATH. (I expected that there is also an environment variable to control that but the manpage doesn't mention one). > For Peter J. Holzer, if we must play the "I've been doing this forever" > game: I've been sysa

Re: Namespaces: memory vs 'pollution'

2019-07-21 Thread Peter J. Holzer
ugh the problem is in general not solvable, most uses of symbols fall into a few common categories which can be discovered by static analysis. So an IDE (or even a syntax-highlighting editor) could flag all symbols where it can't find the definition. hp -- _ | Peter J. Holzer

Re: Proper shebang for python3

2019-07-21 Thread Peter J. Holzer
On 2019-07-21 10:26:17 -0500, Tim Daneliuk wrote: > On 7/21/19 8:47 AM, Peter J. Holzer wrote: > > That's fine. Unlike Tim I don't claim that anybody who disagrees with me > > must be a newbie. > > Peter, that's ad hominem and unfair. No, it isn't.

Re: Counting Python threads vs C/C++ threads

2019-07-21 Thread Peter J. Holzer
se more then 100 % because of the GIL and 100 / 32 = 3.125). hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ros

Re: help with tkinter

2019-08-09 Thread Peter J. Holzer
.colorchooser.askcolor()) > the only time it worked is when I typed > from tkinter import colorchooser > colorchooser.askcolor() Here you imported 'colorchooser' from tkinter. So you can call colorchooser.askcolor(). Same as above, except that you have only imported colorchoos

Re: help with tkinter

2019-08-09 Thread Peter J. Holzer
On 2019-08-09 12:43:45 -0600, Michael Torrie wrote: > On 8/9/19 4:52 AM, Peter J. Holzer wrote: > > You didn't import 'tkinter', you imported all symbols ('*') from > > tkinter. So, since you imported colorchooser, you can call > > colorchooser

Re: String slices

2019-08-10 Thread Peter J. Holzer
nce Python 3.6) this: outstream.write(f"X: {thing[0]:7.2f}\n") There are of course many variants to all three methods. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more soph

Re: issue in handling CSV data

2019-09-08 Thread Peter J. Holzer
" 17 "address," "length," "6a," 6c ... Note that the commas are within the quotes. I'd say Andrea is correct: This is a tab-separated file, not a comma-separated file. But for some reason all fields except the last end with a comma. I would

Re: TechRepublicDEVELOPERCXO JPMorgan's Athena has 35 million lines of Python code, and won't be updated to Python 3 in time

2019-09-15 Thread Peter J. Holzer
than ex-ante mitiga-tion. | (Alternatively, they can more easily translate the costs associated | with ex-post responses into manageable claims.) hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophistic

Re: keying by identity in dict and set

2019-10-28 Thread Peter J. Holzer
aybe yourself in two years). hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/

Re: fileinput

2019-10-28 Thread Peter J. Holzer
able. If is supposed to be something else, determine what that "something else" actually is, and use that. hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp

Re: (New to Python) Shopping List Code

2019-10-28 Thread Peter J. Holzer
it is up to you increment the variable count for each item. Does that help? hp -- _ | Peter J. Holzer| we build much bigger, better disasters now |_|_) || because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp

Re: uses both shell and python codes in one script.

2019-10-28 Thread Peter J. Holzer
ch thanks to ASCII collating sequence boasted the first page in the manual, was a big nop. It doesn't explicitely say what : was used for, but since it was associated with goto, it was very likely used to mark a label. The Bourne shell, introduced with v7, doesn't have goto, but retained

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread Peter J. Holzer
in main() File "/home/hjp/tmp/test.py", line 2, in main print(rule) NameError: name 'rule' is not defined The "rule" identifier in main() refers to a "rule" variable in the module test. If you set a variable "rule" somewhere else (in

Re: Friday finking: TDD and EAFP

2019-11-03 Thread Peter J. Holzer
et the test suite is good enough and ship the code - and hope that the customer will forgive you if you have (inevitably) forgotten an important case. There is very little emphasis in TDD on verifying that the code is correct - only that it passes the tests. hp [1] Harry J.W. Percival, Test-Dri

Re: Friday finking: TDD and EAFP

2019-11-03 Thread Peter J. Holzer
e toward sloppyness in cases where I cannot easily write a test. I might then skip the test case ("It's unlikely to happen anyway") and - since the test suite passes - forget to implement it properly. hp -- _ | Peter J. Holzer| Story must make more sense than re

Re: Friday finking: TDD and EAFP

2019-11-03 Thread Peter J. Holzer
with limited success. unittest still feels clunky, The django framework only works well if your problem fits exactly into a rather narrow niche (which none of our project really fits into). I have recently started to use pytest. That feels a bit more comfortable. We'll see. hp --

Re: What's the difference between running a script under command box and interpreter?

2019-11-04 Thread Peter J. Holzer
ame object (as Cameron pointed out). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signat

Re: Friday finking: TDD and EAFP

2019-11-04 Thread Peter J. Holzer
On 2019-11-03 18:51:25 -0500, Terry Reedy wrote: > On 11/3/2019 3:44 PM, Peter J. Holzer wrote: > > > On 2019-11-04 07:41:32 +1300, DL Neil via Python-list wrote: > > > Agreed: (in theory) TDD is independent of language or style. However, I'm > > > wondering if

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-04 Thread Peter J. Holzer
On 2019-11-04 14:54:23 +, Rhodri James wrote: > On 04/11/2019 14:33, Veek M wrote: > > __metaclass__ = whatever; # is python2.x syntax > > But not Python3: see PEP 3115 Doesn't "X is python2.x syntax" imply "X is not python3 syntax"? hp --

Re: OOP - how to abort an __init__ when the initialisation code fails ?

2019-11-05 Thread Peter J. Holzer
il it hits a level where dealing with it makes sense from the user's point of view (who may not care about an individual file, but about the task they instructed the program to perform). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: Launching a Script on the Linux Platform

2019-11-18 Thread Peter J. Holzer
use. You don't want to use some other random program called "python" (which may or may not be an interpreter for some version of the Python language) which just happens to be in the user's path. hp -- _ | Peter J. Holzer| Story must make more sense than realit

Re: Friday finking: TDD and EAFP

2019-11-18 Thread Peter J. Holzer
On 2019-11-13 15:16:55 +1300, DL Neil via Python-list wrote: > On 4/11/19 9:44 AM, Peter J. Holzer wrote: > > TDD does in my opinion encourage EAFP thinking. > > > > The TDD is usually: > > > > 1 Write a test > > 2 Write the minimal amount of code

Re: How to delay until a next increment of time occurs ?

2019-11-18 Thread Peter J. Holzer
tended time, the time used to compute the sleep time would be a little later. But of course sleep is never that punctual, but that doesn't matter since that just adds to that "a little later". hp -- _ | Peter J. Holzer| Story must make more sense tha

Re: Friday finking: TDD and EAFP

2019-11-19 Thread Peter J. Holzer
ctly. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature -- https://mail.

Re: How to delay until a next increment of time occurs ?

2019-11-21 Thread Peter J. Holzer
w well the previous sleeps and code between them behaved. Correct. That's the intention of this code. From your previous postings it wasn't apparent that you had understood this. In fact you seemed to be arguing that this either wasn't necessary or couldn't possibly be working.

Re: nonlocal fails ?

2019-11-23 Thread Peter J. Holzer
on (on a conceptual level - actual implementations might be somewhat different, as long as they behave the same). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/

Re: nonlocal fails ?

2019-11-24 Thread Peter J. Holzer
On 2019-11-23 18:18:16 -0500, Richard Damon wrote: > On 11/23/19 4:18 PM, Peter J. Holzer wrote: > > On 2019-11-14 20:29:01 -0500, Dennis Lee Bieber wrote: > >>Instead, at a simple level (a common description invokes "Post-It" > >> notes) > >> &g

Re: Python Resources related with web security

2019-11-27 Thread Peter J. Holzer
instead.) Gmane isn't part of usenet proper. It's more like a mailinglist to nntp gateway. I'm not sure how functional it currently is. It has been down and up again over the last few years. The website is currently down, which doesn't bode well. hp -- _ | Peter

Vim settings for Python (was: tab replace to space 4)

2019-12-07 Thread Peter J. Holzer
e at a certain width.) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signatu

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-07 Thread Peter J. Holzer
iles which "can be used with certainty across OS and versions" you need to use one of the prefixes "<", ">" or "!" anyway because you also want to control the byte order, not just the size (although big-endian architectures may be history in a few y

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-07 Thread Peter J. Holzer
t out of range And when you use the "standard size", 8 bytes are also too much: >>> struct.pack('=L', 0x0807060504030201) Traceback (most recent call last): File "", line 1, in struct.error: 'L' format requires 0 <= number <=

<    1   2   3   4   5   6   7   >