Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-20 Thread D';Arcy Cain
On 12-06-20 11:18 AM, elvis-85...@notatla.org.uk wrote: On 2012-06-17, Jon Clements wrote: Whatever you do - *do not* attempt to write your own algorithm. very true As "they" say, random number generation is too important to be left to chance. :-) -- D'Arcy J.M. Cain | Democrac

Re: avoid the redefinition of a function

2012-09-12 Thread D';Arcy Cain
On Wed, 12 Sep 2012 14:56:12 +0200 Jabba Laci wrote: > This will call the 2nd function. Now my functions are called step_ID > (like step_27(), step_28(), etc.). How to avoid the danger of > redefinition? Now, when I write a new function, I search for its name > to see if it's unique but there must

Re: avoid the redefinition of a function

2012-09-12 Thread D';Arcy Cain
On Wed, 12 Sep 2012 18:56:46 +0200 Jabba Laci wrote: > (5) install mc > > You can type just "5" as user input and step_5() is called > automatically. If I use descriptive names like install_java() then > selecting a menu point would be more difficult. And I don't want users > to type "java", I wa

Re: avoid the redefinition of a function

2012-09-12 Thread D';Arcy Cain
On Wed, 12 Sep 2012 16:37:11 -0400 Terry Reedy wrote: > assures one that the test is being run. (I don't always test first, but > I once discovered a test not being run when I modified it in a way that > should have made it fail, but it didn't.) 1. Write the test 2. Run the test - make sure it

Re: avoid the redefinition of a function

2012-09-12 Thread D';Arcy Cain
On Wed, 12 Sep 2012 18:04:51 GMT Alister wrote: > No No NO! > you cant just pass user input to system calls without validating it first > (google sql injection for examples of the damage unsanitised input can > cause, it is not just as SQL problem) http://xkcd.com/327/ -- D'Arcy J.M. Cain

Re: avoid the redefinition of a function

2012-09-12 Thread D';Arcy Cain
On Wed, 12 Sep 2012 17:45:52 -0500 Tim Chase wrote: > On 09/12/12 16:47, D'Arcy Cain wrote: > > And run all of your tests every day. You will sleep better at night. > > Though I usually try to do test-driven development, I confess a > fondness for Titus Brown's

Stop feeding the trolls (Was: which a is used?)

2012-09-25 Thread D';Arcy Cain
On Tue, 25 Sep 2012 08:44:18 +0100 Mark Lawrence wrote: > On 25/09/2012 06:07, Thomas Rachel wrote: > > Am 25.09.2012 04:37 schrieb Dwight Hutto: [...usual nonsense] > someone had the audacity to protect his stance. I am sure that people > have seen enough of his behaviour in the last few hours

Re: "#!/usr/bin/env python" vs. "#!/usr/bin/python"?

2012-09-28 Thread D';Arcy Cain
On Fri, 28 Sep 2012 06:57:28 -0400 Roy Smith wrote: > > I've seen both shebang lines to run a Python script on a *nix host: > > > > #!/usr/bin/env python > > #!/usr/bin/python > > > > What's the difference? > > The first one looks through your PATH to find the right python > interpreter to run

Re: No os.copy()? Why not?

2012-04-03 Thread D';Arcy Cain
On 03/28/12 16:12, John Ladasky wrote: I'm looking for a Python (2.7) equivalent to the Unix "cp" command. Since the equivalents of "rm" and "mkdir" are in the os module, I figured I look there. I haven't found anything in the documentation. I am also looking through the Python source code in os

Re: f python?

2012-04-08 Thread D';Arcy Cain
On 04/08/12 09:11, HoneyMonster wrote: Well, I certainly shall not be reading - or even seeing - any more of his drivel. Yes you will. There is always someone willing to include his entire messages for a one line reply. It's always September somewhere. -- D'Arcy J.M. Cain | Democra

Re: How do I find out what file an import is using?

2012-05-09 Thread D';Arcy Cain
On 12-05-09 01:52 PM, Rob Richardson wrote: I am trying to work with a Python script someone else wrote. The script includes the line from Level3Utils import * I need to look at the functions that are included in that import. In an effort to identify exactly which file is being used,

Re: Smallest/cheapest possible Python platform?

2012-05-26 Thread D';Arcy Cain
On 12-05-26 05:32 PM, Paul Rubin wrote: Roy Smith writes: It sounds like I can run one on 300mA @ 5V. For my application, I'll have about 10 A-h available at 12V (motorcycle battery). OK, the RPi should be fine power-wise in that case, though I wouldn't consider something with a 10AH motorcy

Re: [newbie] Equivalent to PHP?

2012-06-12 Thread D';Arcy Cain
On 12-06-12 06:36 AM, Gilles wrote: I enjoy writing scripts in Python much more than PHP, but with so many sites written in PHP, I need to know what major benefits there are in choosing Python (or Ruby, ie. not PHP). I think that you just answered your own question in the first line of that par

Re: [newbie] Equivalent to PHP?

2012-06-12 Thread D';Arcy Cain
On 12-06-12 07:57 PM, Gilles wrote: On Tue, 12 Jun 2012 07:42:56 -0400, D'Arcy Cain wrote: I guess I am in the minority then. I do plan to turn one of my larger projects into a standalone web server some day but so far writing simple Python CGI scripts has served me fine. I even do

Even Older Man Yells At Whippersnappers

2017-09-19 Thread D';Arcy Cain
On 09/19/2017 03:07 AM, Steven D'Aprano wrote: How relevant is the "people use calculators to do arithmetic" argument today? Okay, so I'm old and cynical, but I know [young] people who don't (can't?) calculate a gratuity without an app or a web page. Which is a form of calculator. People still

Re: Old Man Yells At Cloud

2017-09-19 Thread D';Arcy Cain
On 09/19/2017 06:46 AM, Larry Martell wrote: True story - the other day I was in a store and my total was $10.12. I One time I was at a cash with three or four items which were taxable. The cashier rung each one up and hit the total button. She turned to me and said something like "$23.42 pl

Re: Beginners and experts (Batchelder blog post)

2017-09-29 Thread D';Arcy Cain
On 09/29/2017 03:15 AM, Steve D'Aprano wrote: "Carefully-designed experiments" -- yeah, that is so totally how the coders I've worked with operate *wink* I think that's an awfully optimistic description of how the average programmer works :-) Better not hire average programmers then. I do "Ca

Re: why does memory consumption keep growing?

2017-10-06 Thread D';Arcy Cain
On 10/05/2017 05:42 PM, Fetchinson . via Python-list wrote: On 10/5/17, Chris Angelico wrote: On Fri, Oct 6, 2017 at 8:06 AM, Fetchinson . via Python-list wrote: import mystuff mystuff.some_more_expensive_stuff( x ) del mystuff del x You're not actually deleting anything.

Re: Python homework

2017-12-06 Thread D';Arcy Cain
On 12/05/2017 07:33 PM, nick.martinez2--- via Python-list wrote: I have a question on my homework. My homework is to write a program in which the computer simulates the rolling of a die 50 times and then prints (i). the most frequent side of the die (ii). the average die value of all rolls. I wr

Re: Goto

2017-12-29 Thread D';Arcy Cain
On 12/29/2017 02:25 PM, Chris Angelico wrote: >> PHP also added goto to a later version. > > Ahh, great choice of example. "It's okay - PHP does it." I thought that that was a reason to not do it. -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...@vex.net VoIP: sip:da.

Re: Dunder variables

2018-01-09 Thread D';Arcy Cain
On 01/09/2018 07:30 AM, Steven D'Aprano wrote: > If you have a class with only data, and you access the attributes via the > instance's __dict__, why not use an ordinary dict? Or even subclass dict. class MyClass(dict): VAR = 5 m = MyClass() m['newvar'] = "Something" I do this and wrap thing

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread D';Arcy Cain
On 01/29/2018 01:43 PM, John Ladasky wrote: > On Sunday, January 28, 2018 at 7:07:11 AM UTC-8, Steven D'Aprano wrote: >> >> (The day a programmer posts a WAV file of themselves reading their code >> out aloud, is the day I turn my modem off and leave the internet forever.) > > What's a... modem?

Re: What is more Pythonic: subclass or adding functionality to base class?

2018-02-11 Thread D';Arcy Cain
On 02/11/18 06:30, Victor Porton wrote: > What is more pythonic? > > 1. Create its subclass PredicateParserWithError and add the additional field > on_error to this class. > > 2. Add on_error field to the base class, setting it to None by default, if > the class's user does not need this field.

What F strings should have been

2018-02-14 Thread D';Arcy Cain
A recent post by Terry Jan Reedy got me thinking about formatting. I like the new(ish) format method for strings and I see some value in F strings but it only works well with locals. Anything more starts getting messier than format() and it is supposed to be cleaner. Also, I find that I tend to

Re: What F strings should have been

2018-02-15 Thread D';Arcy Cain
On 02/15/18 02:56, Peter Otten wrote: >> class FSTR(str): >> def __call__(self, *args): >> return self.format(*args) >> >> And here is how it could be used. >> >> s = FSTR("ABC {1} {0} {2[x]}") > > This can be simplified to > > s = "ABC {1} {0} {2[x]}".format Hmm. Hadn't thought of that.

Re: Information about Dying kernel

2022-08-08 Thread D';Arcy Cain
On 2022-08-07 21:38, Paul Bryan wrote: Have you tried turning it off and back on again? Thank you, Roy. -- D'Arcy J.M. Cain Vybe Networks Inc. A unit of Excelsior Solutions Corporation - Propelling Business Forward http://www.VybeNetworks.com/ IM:da...@vybenetworks.com VoIP: sip:da...@vybenetw

Re: Please don't feed the trolls

2021-03-08 Thread D';Arcy Cain
On 2021-03-06 4:24 p.m., Terry Reedy wrote: Trolling, among other things, is fishing with a moving line, especially with a revolving lure, as from a moving boat.  A troll, among other things, is that method or the lure used. You are confusing "troll" with "trawl" -- D'Arcy J.M. Cain Vybe Netw

Re: Help Please

2021-03-28 Thread D';Arcy Cain
On 2021-03-26 12:42 p.m., Igor Korot wrote: On top of that - usual stanza applies: 1. OS - Windows, Linux, Mac? 2. OS version? 3. Python version? 4. Are you able to run python interpretor? 5. Socks version you are trying to install? 6. Was install successful? 7. Use a subject that describes th

Replacement for Mailman

2021-06-08 Thread D';Arcy Cain
Given that mailman still runs under 2.7 and that's being deprecated, does anyone have a suggestion for a replacement? -- D'Arcy J.M. Cain Vybe Networks Inc. A unit of Excelsior Solutions Corporation - Propelling Business Forward http://www.VybeNetworks.com/ IM:da...@vybenetworks.com VoIP: sip:da.

Re: How to handle errors?

2016-10-20 Thread D';Arcy Cain
On 2016-10-20 08:03 PM, Wildman via Python-list wrote: Using a direct path to the Python interpreter can cause problems on some systems because it is not always installed to the same directory. On my Debian-based system Python is installed in /usr/bin. So your code as written will not run on my

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread D';Arcy Cain
On 2016-10-27 03:05 AM, Terry Reedy wrote: When I used unix in the 1980s, the full screen ran csh until one started another full screen application. MSDOS was the same. Every contemporary photo of modern Linux or Mac I have seen has a desktop with windows just like Windows. Do people on Linux s

Re: How to use two threads (GUI and backend)

2016-10-27 Thread D';Arcy Cain
On 2016-10-27 07:33 AM, jmp wrote: On 10/27/2016 12:22 PM, pozz wrote: (blocking) thread. The blocking function read returns *immediately* when all the bytes are received. And I think during blocking time, the thread isn't consuming CPU clocks. Threads do consume CPU clocks. Sometimes they

Re: Call a shell command from Python

2016-11-01 Thread D';Arcy Cain
On 2016-11-01 01:23 AM, Ben Finney wrote: Wildman via Python-list writes: So the way your script was invoked has no bearing on whether Bash will get involved in what your script does. Your script is *directly* invoking programs, and if you don't ask for a shell to be involved you won't get it.

PyGreSQL 5.0.3 released

2016-12-11 Thread D';Arcy Cain
Release 5.0.3 of PyGreSQL. It is available at: http://pygresql.org/files/PyGreSQL-5.0.3.tar.gz. If you are running NetBSD, look in the packages directory under databases. There is also a package in the FreeBSD ports collection. Please refer to the changelog.txt file for things that have changed

Re: Mapping with continguous ranges of keys

2016-12-15 Thread D';Arcy Cain
On 2016-12-15 12:06 PM, Steve D'Aprano wrote: I have about a million or two keys, with a few hundred or perhaps a few thousand distinct values. The size of each contiguous group of keys with the same value can vary from 1 to perhaps a hundred or so. There isn't enough info in your post to be su

Re: Reading python list as a newsgroup (was ...)

2016-12-16 Thread D';Arcy Cain
On 2016-12-16 10:11 AM, Grant Edwards wrote: I didn't notice much spam on c.l.p (but then again, I filter out all posts from google-groups). The problem on c.l.p that caused me to Yes, blocking GG was the biggest improvement to my reading this list (mailing list in my case). That and a few j

Re: Reading python list as a newsgroup (was ...)

2016-12-16 Thread D';Arcy Cain
On 2016-12-16 08:16 PM, Dennis Lee Bieber wrote: Unfortunately, my client can only "pre filter" on subject and author; I could kill all @gmail.*, but could not focus on just Google Groups submissions... I don't know what client you use but perhaps you can adapt this procmail recipe.

Re: Clickable hyperlinks

2017-01-04 Thread D';Arcy Cain
Deborah - please trim your quoted text. On 2017-01-04 04:32 AM, Deborah Swanson wrote: Thanks, Steven. Yes, of course if you want to print strings you must enclose them in quotes. I think you learn that in Week 1 of any introductory course on Python. Closer to minute one. When I investigated

Re: Clickable hyperlinks

2017-01-04 Thread D';Arcy Cain
On 2017-01-04 08:44 AM, Rodrigo Bistolfi wrote: 2017-01-04 7:39 GMT-03:00 Steve D'Aprano : Aside: you've actually raised a fascinating question. I wonder whether there are any programming languages that understand URLs as native data types, so that *source code* starting with http:// etc is unde

Re: Clickable hyperlinks

2017-01-04 Thread D';Arcy Cain
On 2017-01-04 05:58 PM, Deborah Swanson wrote: the user to go and authenticate, you can simply webbrowser.open("http://.../";) and it'll DTRT. Thank you, thank you! Finally, at least one person on this list knows about something (anything) in the python world that is internet aware. Lots

Re: Clickable hyperlinks

2017-01-04 Thread D';Arcy Cain
On 2017-01-04 07:07 PM, Deborah Swanson wrote: D'Arcy Cain wrote, on Wednesday, January 04, 2017 5:03 AM In all the messages in this thread I still don't understand what this "teensy advantage" is supposed to be. Do you want to be able to do this: make_web_link(htt

Re: Clickable hyperlinks

2017-01-06 Thread D';Arcy Cain
On 2017-01-04 08:44 AM, Rodrigo Bistolfi wrote: > 2017-01-04 7:39 GMT-03:00 Steve D'Aprano : >> Aside: you've actually raised a fascinating question. I wonder whether >> there >> are any programming languages that understand URLs as native data types, so >> that *source code* starting with http://

Re: Clickable hyperlinks

2017-01-06 Thread D';Arcy Cain
Deborah - please trim your quoted text. On 2017-01-04 04:32 AM, Deborah Swanson wrote: > Thanks, Steven. Yes, of course if you want to print strings you must > enclose them in quotes. I think you learn that in Week 1 of any > introductory course on Python. Closer to minute one. When I investigat

Re: Clickable hyperlinks

2017-01-06 Thread D';Arcy Cain
On 2017-01-04 05:58 PM, Deborah Swanson wrote: >> the user to go and authenticate, you can simply >> webbrowser.open("http://.../";) and it'll DTRT. > > Thank you, thank you! Finally, at least one person on this list knows > about something (anything) in the python world that is internet aware.

Re: Clickable hyperlinks

2017-01-06 Thread D';Arcy Cain
On 2017-01-04 07:07 PM, Deborah Swanson wrote: > D'Arcy Cain wrote, on Wednesday, January 04, 2017 5:03 AM >> In all the messages in this thread I still don't understand what this >> "teensy advantage" is supposed to be. Do you want to be able >>

Extended ASCII

2017-01-13 Thread D';Arcy Cain
I thought I was done with this crap once I moved to 3.x but some Winblows machines are still sending what some circles call "Extended ASCII". I have a file that I am trying to read and it is barfing on some characters. For example: due to the Qu\xe9bec government Obviously should be "due

Re: Extended ASCII [solved]

2017-01-13 Thread D';Arcy Cain
On 2017-01-13 05:44 PM, Grant Edwards wrote: On 2017-01-13, D'Arcy Cain wrote: Here is the failing code: with open(sys.argv[1], encoding="latin-1") as fp: for ln in fp: print(ln) Traceback (most recent call last): File "./load_iff", line 11, in pri

Re: Need reviews for my book on introductory python

2017-01-27 Thread D';Arcy Cain
On 2017-01-27 03:17 PM, bob gailer wrote: sudo apt-get won't work on Windows. Tell the reader that this is how to do it in Unix, and show the Windows equivalent. Actually it doesn't work on Unix either. It only works on Linux. -- D'Arcy J.M. Cain System Administrator, Vex.Net http://www.Vex.N

Re: Need reviews for my book on introductory python

2017-01-27 Thread D';Arcy Cain
On 2017-01-27 11:01 PM, Terry Reedy wrote: This is a run-on sentence, which is to say, two sentences. Change 'suntax,' to 'syntax.' and 'in' to ' In'. ^^ I can't believe how many typos and grammar errors there are in this thread by people correcting typos and grammar. And please don't

Accessing parent objects

2018-03-24 Thread D';Arcy Cain
I'm not even sure how to describe what I am trying to do which perhaps indicates that what I am trying to do is the wrong solution to my problem in the first place but let me give it a shot. Look at the following code. class C1(dict): class C2(object): def f(self): return X['field']

Re: Accessing parent objects

2018-03-25 Thread D';Arcy Cain
On 03/25/2018 04:37 AM, Jugurtha Hadjar wrote: > On 03/24/2018 07:14 PM, D'Arcy Cain wrote: >> class C1(dict): >>    class C2(object): >> def f(self): >>    return X['field'] >> >> O1 = C1() >> O1['field'] = 1 >

Re: Accessing parent objects

2018-03-25 Thread D';Arcy Cain
On 03/25/2018 05:10 AM, Jugurtha Hadjar wrote: >     print("I am {self.__class__.__name__} foo".format(self=self)) Unrelated to the original issue but why not one of the following? print("I am {0.__class__.__name__} foo".format(self)) print(f"I am {self.__class__.__name__} foo") -- D'Arcy J

Re: Accessing parent objects

2018-03-25 Thread D';Arcy Cain
On 03/24/2018 06:54 PM, Steven D'Aprano wrote: >> On Saturday, March 24, 2018 at 1:20:24 PM UTC-5, D'Arcy Cain wrote: >>> I tried various forms of super() but that didn't seem to work. > > Define "doesn't see to work". It accesses th

Re: String formatting

2018-03-25 Thread D';Arcy Cain
Was "Accessing parent objects." On 03/25/2018 12:26 PM, Jugurtha Hadjar wrote: >> print("I am {0.__class__.__name__} foo".format(self)) > > I prefer keyword arguments, but if I used it that way I'd do: > > print("I am {0} foo".format(self.__class__.__name__)) These are contrived examples. In r

Using object as a class

2018-03-26 Thread D';Arcy Cain
It's called a super class but it doesn't quite work like a normal class. >>> OBJ = object() >>> OBJ.x = 3 Traceback (most recent call last): File "", line 1, in AttributeError: 'object' object has no attribute 'x' I can fix this by creating a NULL class. >>> class NullObject(object): pass ...

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-10 Thread D';Arcy Cain
On 2018-05-10 07:39 AM, AK wrote: > Try (should work from both PY2 and PY3): > > d0 = date(2018,0o2,0o1) Bad advice. Those numbers are decimal, not octal, You should use "date(2018,2,1)" here. Works in PY2, PY3 and for my birthday, Sept 4. -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.Vy

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-10 Thread D';Arcy Cain
On 2018-05-10 07:28 AM, Skip Montanaro wrote: > https://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax Funny stuff: Python could either: 1. silently do the wrong thing... 2. immediately disabuse him... 3. let him continue to think... Some people passionately believe t

Proper email etiquette

2018-05-20 Thread D';Arcy Cain
On 2018-05-18 06:24 PM, José María Mateos wrote: > And another one I learned recently on a similar conversation on another > mailing list (that of the e-mail client I'm using right now): it is very > useful for searches. Every e-mail contains just the right amount of text > necessary to be prope

Feeding the trolls

2018-06-20 Thread D';Arcy Cain
On 2018-06-20 08:10 AM, Tim Golden wrote: > [... snip discussions about Bart's language ...] > > Wearing my moderator hat > > Can we take the "Bart's language vs Python Show" to some other forum, > please? We've already gone over this ground again and again and it isn't > helping the signal-to-no

Python 3.6 can find cairo libs but not Python 2.7

2018-07-12 Thread D';Arcy Cain
$ python2.7 -c "import ctypes.util; print(ctypes.util.find_library('cairo'))" libcairo.so.2 $ python3.6 -c "import ctypes.util; print(ctypes.util.find_library('cairo'))" None I have the 3.6 version of py-cairo installed. Any thoughts? NetBSD 7.1.2 Cheers. -- D'Arcy J.M. Cain System Administra

Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread D';Arcy Cain
On 2018-07-12 04:17 PM, Terry Reedy wrote: > On 7/12/2018 3:52 PM, D'Arcy Cain wrote: >> $ python2.7 -c "import ctypes.util; >> print(ctypes.util.find_library('cairo'))" >> libcairo.so.2 >> $ python3.6 -c "import ctypes.util; >> pri

Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread D';Arcy Cain
On 2018-07-12 07:41 PM, Peter Otten wrote: > Wild guess: one Python is 64 bit and the other is 32 bit, and you have only > one version of the library installed. Nope. Both are 64 bit. -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...@vex.net VoIP: sip:da...@vybenetwo

Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread D';Arcy Cain
On 2018-07-13 08:05 AM, Peter Otten wrote: > D'Arcy Cain wrote: >> Nope. Both are 64 bit. > > Just to be 100% sure, what does > > $ python2.7 -c 'import struct; print(struct.calcsize("l"))' > > $ python3.6 -c 'import struct; print(st

Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-13 Thread D';Arcy Cain
On 2018-07-13 10:28 AM, Peter Otten wrote: > As far as I can see -- without having access to a netbsd machine -- this Would it help if I gave you a login on one? Interestingly, I don't have this issue on my NetBSD machine built from HEAD. Maybe it is something that was fixed but not pulled up t

Re: Kindness

2018-07-13 Thread D';Arcy Cain
On 2018-07-13 05:45 PM, Marko Rauhamaa wrote: > Yeah, that is cult behavior. Here's a few boxes to tick on: > >http://www.csj.org/infoserv_cult101/checklis.htm> I couldn't find a single item that applies to this group. What's your point? -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.V

Re: Python 2.7 can find cairo libs but not Python 3.6

2018-07-16 Thread D';Arcy Cain
I just realized that my subject was backwards. It's 2.7 that can find the libs and 3.6 than cannot. Just in case that makes a difference. -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...@vex.net VoIP: sip:da...@vybenetworks.com -- https://mail.python.org/mailman/lis

Re: Python 2.7 can find cairo libs but not Python 3.6

2018-07-17 Thread D';Arcy Cain
On 2018-07-17 10:22 AM, Peter Otten wrote: > D'Arcy Cain wrote: > >> I just realized that my subject was backwards. It's 2.7 that can find >> the libs and 3.6 than cannot. Just in case that makes a difference. > > Not for me, I believed the pasted shell sessi

Re: Pylint false positives

2018-08-14 Thread D';Arcy Cain
On 2018-08-14 03:38 AM, Frank Millman wrote: > Hi all > > Pylint is flagging a lot of lines as errors that I would consider to be > acceptable. > > I have an abstract class ClassA with a number of concrete sub-classes. > ClassA has a method which invokes 'self.method_b()' which is defined > separ

Re: Pylint false positives

2018-08-16 Thread D';Arcy Cain
On 2018-08-14 04:58 AM, Frank Millman wrote: > "D'Arcy Cain"  wrote in message >> I am also getting a funny smell from your description.  Are you sure >> that you need to redefine the methods?  Perhaps you just need to define >> some class variables and use o

Re: New books by O’Reilly

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

Re: Unexpected behaviour with DeprecationWarning, Python 3.7 and escape codes

2018-08-23 Thread D';Arcy Cain
On 2018-08-23 06:08 AM, Peter via Python-list wrote: > I understand that Python 3.7 now issues DeprecationWarning for code > entered in the interactive shell and also for single-module programs. I > see this behaviour with: > > C:\wrk> python > python 3.7.0 (v3.7.0:... import imp > __main__:1

Re: Cross platform mutex to prevent script running more than instance?

2018-09-03 Thread D';Arcy Cain
On 09/03/18 09:45, Malcolm Greene wrote: > Use case: Want to prevent 2+ instances of a script from running ... > ideally in a cross platform manner. I've been researching this topic and > am surprised how complicated this capability appears to be and how the > diverse the solution set is. I've seen

Re: Cross platform mutex to prevent script running more than instance?

2018-09-05 Thread D';Arcy Cain
On 09/03/18 09:45, Malcolm Greene wrote: > Use case: Want to prevent 2+ instances of a script from running ... > ideally in a cross platform manner. I've been researching this topic and > am surprised how complicated this capability appears to be and how the > diverse the solution set is. I've seen

Re: [OT] master/slave debate in Python

2018-09-26 Thread D';Arcy Cain
On 9/26/18 3:58 AM, David Palao wrote: > Hello, > My opinion is that the terms "master/slave" describe well some situations. > They could be seen by some people as offensive (although unfortunately > sometimes true, even today) when applied to persons. But it is not > offensive when applied to proc

Re: Python indentation (3 spaces)

2018-10-15 Thread D';Arcy Cain
On 10/15/18 5:54 PM, Gregory Ewing wrote: > Cameron Simpson wrote: >> I can't express how pleasing it is to see the traditional vi-vs-emacs >> wars supplanted by emacs-vs-emacs :-) > > We're the People's Front of Emacs, not the Emacs People's Front! I thought we were the People's Emacs Front. --

Re: PEP 594 cgi & cgitb removal

2019-05-24 Thread D';Arcy Cain
On 2019-05-22 03:51, Robin Becker wrote: > In PEP 594 t has been proposed that cgi & cgitb should be removed. I > suspect I am not the only person in the world that likes using cgi and > cgitb. I use both heavily. Just another data point. I wasn't going to respond with a "Me too" except that I s

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

2019-06-10 Thread D';Arcy Cain
On 2019-06-10 10:48, Michael Torrie wrote: > Probably you should be using Python 3, which uses a print() function. > But even in Python 2.7, the recommended way to do this is like this: > > fd = open("file","w+") > with fd: There is still a small window there if there are asynchronous events happ

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

2019-06-10 Thread D';Arcy Cain
On 2019-06-10 15:46, Alan Bawden wrote: > D'Arcy Cain writes: >> with open("file","w+") as fd: > > That makes the window smaller, but it doesn't actually eliminate it. Look > at the generated byte code. In both cases the call to open() is

Re: Print formatting

2019-10-18 Thread D';Arcy Cain
On 10/18/19 2:21 PM, Jagga Soorma wrote: I seem to have found a way to do this with the following: print('{:<12s}{:>12s}'.format((temp_list[0]),(temp_list[3]))) Still let me know if there is a better way to format this output :) I would start with removing the redundant parens. print('{:<1

Re: Print formatting

2019-10-18 Thread D';Arcy Cain
On 10/18/19 5:00 PM, D'Arcy Cain wrote: Finally, if this is in a loop do this. FMT = '{0[0]:<12s}{0[3]:>12s}'.format for temp_list in GetLists(): print FMT(temp_list) Oops. Time warp. I meant "print(FMT(temp_list)) -- D'Arcy J.M. Cain Vybe Networks Inc. htt

Re: exiting a while loop

2020-05-22 Thread D';Arcy Cain
On 2020-05-22 7:49 a.m., John Yeadon via Python-list wrote: > Am I unreasonable in expecting this code to exit when required? Yes. > # Add up the powers of 2 starting with 2**0 until 2 million is met. > n = 1 > target = 200 > sum = 0 > > while True: >     x = 2 ** (n - 1) >     sum += x >   

Re: How do I do this in Python 3 (string.join())?

2020-08-26 Thread D';Arcy Cain
On 2020-08-26 09:22, Chris Green wrote: > I have the following line in Python 2:- > > msgstr = string.join(popmsg[1], "\n") # popmsg[1] is a list > containing the lines of the message > > ... so I changed it to:- > > s = "\n" > msgstr = s.join(popmsg[1]) # popmsg[1] is a l

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread D';Arcy Cain
On 2020-08-28 08:30, Richard Damon wrote: > This might be one of the cases where Python 2's lack handling of string > vs bytes was an advantage. For English speaking Americans. > Python2 handled that sort of case quite easily. Python 3 on the other > hand, will have issue converting the byte mess

Re: What might cause my sample program to forget that already imported datetime?

2020-10-13 Thread D';Arcy Cain
On 10/12/20 7:20 AM, Chris Angelico wrote: > This is yet another reason that "from MODULE import *" is a bad idea. > Instead, just import the module itself, and take whatever you need. Or just import the objects that you need; from datetime import datetime, SYMBOL, etc... I use Decimal a lot. I

Re: File Name issue

2020-10-18 Thread D';Arcy Cain
On 10/18/20 5:55 AM, Steve wrote: I am not sure if what I did to repair it but the problem is gone. A copy/paste/rename was performed on the original code file and now I do not get the error. No need for "r" or "\"... WTH? I hate it when that happens. Could that original hyphen have been a uni

Re: Dataframe to postgresql - Saving the dataframe to memory using StringIO

2020-10-22 Thread D';Arcy Cain
On 10/22/20 7:23 AM, Marco Sulla wrote: I would add that usually I do not recommend saving files on databases. I usually save the file on the disk and the path and mime on a dedicated table. I used to do that because backing up the database became huge. Now I use ZFS snapshots with send/recei

Cannot marshal objects

2020-11-27 Thread D';Arcy Cain
I am getting this error. I found this recipe to fix it: from xmlrpclib import Marshaller from decimal import Decimal def dump_decimal(self, value, write): write("") write(str(value)) write("\n") Marshaller.dispatch[Decimal] = dump_decimal That seems to be for Python 2. I am ru

Re: Cannot marshal objects

2020-11-27 Thread D';Arcy Cain
On 11/27/20 4:05 PM, Skip Montanaro wrote: I am getting this error. I assume you mean the email subject. It doesn't work in 3.8 either: Yes I do and that's too bad. but that's not surprising to me. The marshal module is more-or-less meant to serialize Python byte code. Pickle is more genera

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread D';Arcy Cain
On 12-01-03 01:13 PM, Sean Wolfe wrote: Hello everybody, I'm a happy pythonista newly subscribed to the group. Welcome. The question is, given this possibility, would this get us closer to being able to compile down to a language like C or C++? That's "a" question. "The" question is "do yo

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread D';Arcy Cain
On 12-01-03 01:24 PM, gene heskett wrote: The solution is to chop the link between google.groups and this list. But that subject has been declared verboten. Too much inconvenience to ask the googlers to subscribe to the real list I guess. Because my spamassassin Perhaps they just need to be r

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread D';Arcy Cain
On 12-01-03 02:24 PM, Benjamin Kaplan wrote: :0 Hir * ^List-Id:.*python-list.python.org * ^From:.*@gmail.com * ^Newsgroups:.* /dev/null -- Wouldn't that just kill everything sent from a gmail account? That's not the same thing as Google Groups. The mailing list posts, at least, have an "Organi

Re: your feedback to my first project please

2012-01-07 Thread D';Arcy Cain
On 12-01-07 07:10 AM, patr...@bierans.de wrote: It's my first script in python and I'd like to know if my way of coding so far is right and if YOU have some little tips for me or if you can point my nose on some things I've missed so far. Looks pretty good overall. I have a little armchair qua

Re: your feedback to my first project please

2012-01-11 Thread D';Arcy Cain
On 12-01-08 02:46 PM, patr...@bierans.de wrote: Thanks for the feedback! You're welcome. D'Arcy wrote: [code examples] But I will keep some of my underscores for "private" attributes and methods. And I googled: "dim" was basic. I know too many languages and start mixing the keywords - shame

Re: [RELEASE] Python 3.6.1rc1 is now available

2017-03-05 Thread D';Arcy Cain
On 2017-03-05 07:01 AM, Ned Deily wrote: On behalf of the Python development community and the Python 3.6 release team, I would like to announce the availability of Python 3.6.1rc1. 3.6.1rc1 is the first release candidate for Python 3.6.1, the first maintenance release of Python 3.6. 3.6.0 was r

Re: [RELEASE] Python 3.6.1rc1 is now available

2017-03-05 Thread D';Arcy Cain
On 2017-03-05 07:01 AM, Ned Deily wrote: On behalf of the Python development community and the Python 3.6 release team, I would like to announce the availability of Python 3.6.1rc1. 3.6.1rc1 is the first release candidate for Python 3.6.1, the first maintenance release of Python 3.6. 3.6.0 was r

Re: [RELEASE] Python 3.6.1rc1 is now available

2017-03-05 Thread D';Arcy Cain
On 2017-03-05 07:01 AM, Ned Deily wrote: On behalf of the Python development community and the Python 3.6 release team, I would like to announce the availability of Python 3.6.1rc1. 3.6.1rc1 is the first release candidate for Python 3.6.1, the first maintenance release of Python 3.6. 3.6.0 was r

Re: str.title() fails with words containing apostrophes

2017-03-05 Thread D';Arcy Cain
On 2017-03-05 03:40 PM, Terry Reedy wrote: import re def title(string): return re.sub(r"\b'\w", lambda m: m.group().lower(), string.title()) Nice. It lowercases a word char that follows an "'" that follows a word without an intervening non-word char. It passes this test: print(title("'tim

Re: Who still supports recent Python on shared hosting

2017-03-05 Thread D';Arcy Cain
On 2017-03-05 09:39 PM, John Nagle wrote: I'm looking for shared hosting that supports at least Python 3.4. http://www.VybeNetworks.com/ We have Python 2.7 and 3.6 installed. -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...@vex.net VoIP: sip:da...@vybenetworks.com

Re: str.title() fails with words containing apostrophes

2017-03-06 Thread D';Arcy Cain
On 2017-03-06 05:04 AM, Peter Otten wrote: Won't Steve D'aprano And D'arcy Cain Be Happy Now :) Perhaps one could limit the conversion to go from lower to upper only, as names tend be in the desired case in the original text. That would help with acronyms as well. -- D'

Re: str.title() fails with words containing apostrophes

2017-03-07 Thread D';Arcy Cain
On 2017-03-06 06:33 PM, Steve D'Aprano wrote: If you read "title case" as *literally* as being only for titles (of books, I believe there is only one conclusion to be drawn from this thread - There is still a place for human proofreaders. I'm taking that as good news. -- D'Arcy J.M. Cain V

  1   2   >