Re: Quick survey: locals in comprehensions (Python 3 only)

2018-06-25 Thread Jim Lee
From: Jim Lee On 06/23/2018 11:02 PM, Chris Angelico wrote: > On Sun, Jun 24, 2018 at 3:44 PM, Jim Lee wrote: >> >> On 06/23/2018 10:03 PM, Steven D'Aprano wrote: >>> I'd like to run a quick survey. There is no right or wrong answer, since >>> this

Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Jim Lee
From: Jim Lee On 06/24/2018 04:35 AM, Steven D'Aprano wrote: > > Indeed. That's one of the beauties of Python -- even when there's an > advanced way to do it, there's generally a simple way too. > > What happened to the Python maxim "There should be one

Re: configparser v/s file variables

2018-06-27 Thread Jim Lee
On 06/27/18 11:45, Abdur-Rahmaan Janhangeer wrote: and that closes it, thanks !!! Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Importing variables from a file is dangerous because it can execute arbitrary code. It should never be done with files provided by the user. Using c

Re: OSError: [Errno 48] Address already in use

2018-06-27 Thread Jim Lee
On 06/27/18 08:49, T Berger wrote: Why am I getting this error? I'm not sure what additional information I need to supply, so please let me know. You asked this question two weeks ago and got several answers.  Here is one of them: On 06/15/18 10:17, Percival John Hackworth wrote: On 15-

Re: configparser v/s file variables

2018-06-27 Thread Jim Lee
On 06/27/18 15:19, Steven D'Aprano wrote: On Wed, 27 Jun 2018 12:15:23 -0700, Jim Lee wrote:   It seems a bit silly to me to worry about arbitrary code execution   in an interpreted language like Python whose default runtime execution method is to parse the source code directly

Re: configparser v/s file variables

2018-06-28 Thread Jim Lee
On 06/28/18 00:46, Steven D'Aprano wrote: Yes, attacks by trusted insiders are the hardest to defend against. Betrayal of trust sucks. Trusted users with sufficient privileges could just modify the source code of your application or of Python itself. They could also attack your system in a tho

Re: [OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-28 Thread Jim Lee
On 06/28/18 07:34, Grant Edwards wrote: OK, I've got to ask... Why are there still BBSes? Who even has a modem these days? [OK, I'll admit my 11 year old Thinkpad T500 has a built-in POTS modem, but it's never been used.] BBS's are most often connected to via telnet these days.  There are

Re: configparser v/s file variables

2018-06-28 Thread Jim Lee
On 06/28/18 07:30, Grant Edwards wrote: I still maintain it's a bad idea to run arbitrary code found in user-edited config files. There may be cases where somebody has figured out how to muck with a config file that's shared among multiple users, or has tricked somebody into including somethin

Re: [OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-28 Thread Jim Lee
On 06/28/18 11:45, Grant Edwards wrote: On 2018-06-28, Jim Lee wrote: On 06/28/18 07:34, Grant Edwards wrote: OK, I've got to ask... Why are there still BBSes? Who even has a modem these days? [OK, I'll admit my 11 year old Thinkpad T500 has a built-in POTS modem, but it&#x

Re: configparser v/s file variables

2018-06-28 Thread Jim Lee
On 06/28/18 16:44, Steven D'Aprano wrote: I agree with you that it's a bad idea. Aside from the little fact that you described concerns about using Python code for settings as "silly". Umm, no.  I said that worrying about arbitrary code execution in an interpreted language seemed silly. 

Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-29 Thread Jim Lee
On 06/29/18 08:05, T Berger wrote: On Friday, June 29, 2018 at 10:45:10 AM UTC-4, T Berger wrote: On Thursday, June 28, 2018 at 1:21:32 AM UTC-4, T Berger wrote: Hi Guys, Thanks for all the suggestions. I found the problem. I had saved my program in IDLE and quit out of the shell, and then

Re: [OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-29 Thread Jim Lee
On 06/29/18 07:15, Dennis Lee Bieber wrote: On 6/28/2018 9:05 PM, Avon wrote: Being able to send messages by ham radio is useful in disasters as well as nostalgic. I just don't know what people are doing these days. Though I haven't heard much of the AX.25 Packet BBS

Re: Should nested classes in an Enum be Enum members?

2018-06-29 Thread Jim Lee
On 06/29/18 16:02, Cameron Simpson wrote: On 29Jun2018 10:36, Ethan Furman wrote: On 06/28/2018 10:52 PM, Steven D'Aprano wrote: On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote: Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum.  Note that date(), next_business_

Re: I lost nearly all my modules installing 3.7

2018-06-29 Thread Jim Lee
On 06/29/18 21:48, dieter wrote: I do not know "pkg-config". The name seems to indicate an operating system package; but, it might also be a Python extension package (less likely). I would start with the "matplotlib" installation instructions to look for information about it. https://www.f

Re: error in os.chdir

2018-06-30 Thread Jim Lee
On 06/30/18 07:34, Sharan Basappa wrote: sorry. I mean why my code worked in one case but did not in the other one. This worked - os.chdir('D:\Projects\Initiatives\machine learning\programs') This did not work - os.chdir('D:\Projects\Initiatives\machine learning\programs\assertion') only di

Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-30 Thread Jim Lee
On 06/28/18 18:04, Dan Stromberg wrote: [snip] Start an echo server process P that listens on tcp/. Initiate a connection from a client machine to process P at tcp/. It works as expected. Kill P. Initiate a connection from a client machine to process P at tcp/. It gives a connec

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

2018-07-01 Thread Jim Lee
On 07/01/18 18:21, Steven D'Aprano wrote: Guido has been talking about this for a LONG time: You keep bringing that up.  It's not an argument. People have been talking about taxes for a long, long time.  Does it surprise you that they still do?  None of us has a time machine that will tra

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

2018-07-02 Thread Jim Lee
On 07/02/18 04:01, Steven D'Aprano wrote: On Sun, 01 Jul 2018 20:51:42 -0700, Jim Lee wrote: Back before the dot com boom, programmers (generally) knew at least 6, 7, 8 languages. You obviously didn't know (m)any of the hundreds of thousands of COBOL programmers.   I did know

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

2018-07-02 Thread Jim Lee
On 07/02/18 16:22, Gregory Ewing wrote: Ian Kelly wrote: Just because somebody knows a dozen languages doesn't mean that they can come up with the correct algorithm, That doesn't mean there's no correlation. Someone who is familiar with a variety of languages is also very likely to be self-m

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

2018-07-02 Thread Jim Lee
On 07/02/18 17:34, Dan Stromberg wrote: The fact of the matter is the economics have changed a lot since then. Machine time used to be really expensive compared to developer time.  Today, it's the opposite: developer time is really expensive compared to machine time. If you go back far

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

2018-07-02 Thread Jim Lee
On 07/02/18 17:51, Steven D'Aprano wrote: For most of us mere mortals, the "ten thousand hours" rule of thumb applies. Ten thousand hours should be read as an indefinitely large number A truly good programmer will be able to learn about the language being used on the job. Indeed, if you d

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

2018-07-03 Thread Jim Lee
On 07/03/18 01:34, Steven D'Aprano wrote: I said *indefinite* not infinite. Yes, you did.  My bad. You did read the article I linked to, right? You know that people don't suddenly and instantly turn from "beginner" to "expert" when they exceed 9,999 hours 59 minutes and 59 seconds? Quibblin

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

2018-07-03 Thread Jim Lee
On 07/03/18 06:32, Dennis Lee Bieber wrote: On Mon, 2 Jul 2018 19:51:29 -0500, Tim Daneliuk declaimed the following: Except that the current attempt is to use techniques like agile, scrum, pair programming, and so forth to turn programming into a factory activity. High degrees of

Re: Getting posts to sort chronologically in tree view

2018-07-03 Thread Jim Lee
On 07/03/18 08:49, T Berger wrote: It would help if my conversations showed up in my gmail, but they don't. I thought that would happen when I chose the "Automatically subscribe me to email updates when I post to a topic" option in the forum settings. Am I wrong? And is there some way to

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

2018-07-03 Thread Jim Lee
On 07/03/18 16:51, Steven D'Aprano wrote: I love watching pedantically precise people panic and dig themselves into a hole. Since I'm an extremely pedantic person myself, I can recognise it in others -- especially when they're not as precisely correct as they think they're being. It was two n

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

2018-07-03 Thread Jim Lee
On 07/03/18 19:31, Chris Angelico wrote: I've had debates with people about whether "infinity" is a number or not, but I've never yet heard anyone say that "indefinite" is a number. Hmm. This could be interesting. ChrisA If you were to say John had 2 apples, Jane had 4 apples, and Joe had a

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

2018-07-03 Thread Jim Lee
On 07/03/18 19:58, Ben Finney via Python-list wrote: Jim Lee writes: If you were to say John had 2 apples, Jane had 4 apples, and Joe had an indefinite number of apples, how many numbers are we talking about? Three numbers. And “indefinite” is not one of those numbers. So, no, that doesn&#

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

2018-07-03 Thread Jim Lee
On 07/03/18 21:25, Ben Finney wrote: Jim Lee writes: On 07/03/18 19:58, Ben Finney via Python-list wrote: Jim Lee writes: If you were to say John had 2 apples, Jane had 4 apples, and Joe had an indefinite number of apples, how many numbers are we talking about? Three numbers. And

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

2018-07-03 Thread Jim Lee
On 07/03/18 21:35, Ben Finney wrote: Abdur-Rahmaan Janhangeer writes: apart from programming, other questions go like this : […] *cut at this point* Ooh, I like that last step! How do we make that happen on demand? You could start by not adding to the noise... :) -- https://mail.python.

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

2018-07-03 Thread Jim Lee
On 07/03/18 22:03, Ben Finney wrote: Jim Lee writes: I claimed that Steven was using three different numbers to refer to the time it takes to master a subject: 10,000 hours an indefinite number 2 years Yes. He did so in the context of showing that *there is no precise number* that

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 05:14, Marko Rauhamaa wrote: Abdur-Rahmaan Janhangeer : * Create as many functions as you can performance? Python? Seriously, though. The principle of expressive encapsulation is one of the basic cornerstones of writing computer programs. Performance barely ever becomes a questi

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 10:15, Calvin Spealman wrote: On Thu, Jul 5, 2018 at 12:59 PM, Jim Lee <mailto:jle...@gmail.com>> wrote: On 07/05/18 05:14, Marko Rauhamaa wrote: Abdur-Rahmaan Janhangeer mailto:arj.pyt...@gmail.com>>: * Create as many funct

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 10:47, Calvin Spealman wrote: You say "pitfall", but I say "allow developers to focus on higher-level problems and enable developers to specialize among tasks so every single one of us doesn't have to be a jack of all trades just to build a todo list app". Sure, that's the

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 12:58, Chris Angelico wrote: On Fri, Jul 6, 2018 at 4:27 AM, Jim Lee wrote: On 07/05/18 10:47, Calvin Spealman wrote: You say "pitfall", but I say "allow developers to focus on higher-level problems and enable developers to specialize among tasks so every s

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 14:15, MRAB wrote: On 2018-07-05 21:43, Jim Lee wrote: On 07/05/18 12:58, Chris Angelico wrote: On Fri, Jul 6, 2018 at 4:27 AM, Jim Lee wrote: On 07/05/18 10:47, Calvin Spealman wrote: You say "pitfall", but I say "allow developers to focus on higher-lev

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 18:14, Michael Torrie wrote: On 07/05/2018 11:47 AM, Calvin Spealman wrote: That wasn't me, but I do agree with the sentiment in that its often silly to focus on them at the wrong time and without constraints that warrant that focus. Premature optimization is the root of all evil,

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 18:25, Steven D'Aprano wrote: On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: Take a village of people.  They live mostly on wild berries. Because of course a community of people living on one food is so realistic. Even the Eskimos and Inuit, living in some of the har

Re: about main()

2018-07-06 Thread Jim Lee
On 07/06/18 11:25, Grant Edwards wrote: On 2018-07-06, Jim Lee wrote: Pedantics again. Didn't even get the point before tearing apart the *analogy* rather than the *point itself*. Jim Lee, this is the Internet. Intenet, this is Jim Lee. :) You have an inaccurate anthropomo

Re: about main()

2018-07-06 Thread Jim Lee
On 07/06/18 12:57, Terry Reedy wrote: On 7/5/2018 9:40 PM, Jim Lee wrote: On 07/05/18 18:25, Steven D'Aprano wrote: On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: Take a village of people.  They live mostly on wild berries. Because of course a community of people living on one

Re: testing code

2018-07-07 Thread Jim Lee
On 07/07/18 21:21, Sharan Basappa wrote: sorry. there was a copy paste error when i posted. I pasted test_2.py for both the files: here are the files again. The issue remains. [...] output: %run "D:/Projects/Initiatives/machine learning/programs/test_2_test.py" 30 [11:24 PM jlee@kerndev ~

Re: Feasibility of console based (non-Gui) Tkinter app which can accept keypresses?

2018-07-11 Thread Jim Lee
On 07/11/18 07:09, jkn wrote: Hi All This is more of a Tkinter question rather than a python one, I think, but anyway... I have a Python simulator program with a Model-View_Controller architecture. I have written the View part using Tkinter in the first instance; later I plan to use Qt. Ho

Re: Cult-like behaviour [was Re: Kindness]

2018-07-14 Thread Jim Lee
On 07/14/18 02:09, Christian Gollwitzer wrote: Am 14.07.18 um 10:00 schrieb Marko Rauhamaa: Steven D'Aprano : Apparently Marko didn't notice the irony of suggesting that we display excessive commitment to GvR The object of the "cult" isn't GvR, it's Python itself. I agree with this obser

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread James Lee
On 7/15/2018 3:43 AM, Steven D'Aprano wrote: No. The real ten billion dollar question is how people in 2018 can stick their head in the sand and take seriously the position that Latin-1 (let alone ASCII) is enough for text strings. Easy - for many people, 90% of the Python code they write

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 12:37, MRAB wrote: To me, Unicode and UTF-8 aren't things to be reserved for I18N. I use them as a matter of course because I find it a lot easier to stick with just one encoding, one that will work with _any_ text I have. Which is exactly the same rationale for using any other s

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 13:09, Chris Angelico wrote: On Mon, Jul 16, 2018 at 4:22 AM, James Lee wrote: On 7/15/2018 3:43 AM, Steven D'Aprano wrote: No. The real ten billion dollar question is how people in 2018 can stick their head in the sand and take seriously the position that Latin-1 (let

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 13:30, Chris Angelico wrote: It doesn't matter what Twitch is, except for the fact that it is a platform for HUMANS to communicate with HUMANS. Ultimately, that is what matters. Pick any other web site or communication protocol you please. ChrisA Yes, and for *that*, language ma

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 14:53, Chris Angelico wrote: On Mon, Jul 16, 2018 at 7:02 AM, Jim Lee wrote: On 07/15/18 13:30, Chris Angelico wrote: It doesn't matter what Twitch is, except for the fact that it is a platform for HUMANS to communicate with HUMANS. Ultimately, that is what matters. Pic

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 15:07, Chris Angelico wrote: On Mon, Jul 16, 2018 at 7:57 AM, Jim Lee wrote: On 07/15/18 14:53, Chris Angelico wrote: On Mon, Jul 16, 2018 at 7:02 AM, Jim Lee wrote: On 07/15/18 13:30, Chris Angelico wrote: It doesn't matter what Twitch is, except for the fact that

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 14:50, Marko Rauhamaa wrote: Jim Lee : Yes, and for *that*, language matters;  but, for a vast array of programming tasks that *don't* involve global communications, it's an added level of complexity with zero benefit.  It would be *nice* to be able to turn support

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 16:04, Chris Angelico wrote: You claimed that Unicode was insignificant to many programs. I'm trying to say that a Unicode text string is a vital part of any program that works with text, which is pretty much anything that talks to humans. You keep saying that ... well you keep say

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 16:13, Chris Angelico wrote: On Mon, Jul 16, 2018 at 9:08 AM, Jim Lee wrote: On 07/15/18 14:50, Marko Rauhamaa wrote: Jim Lee : Yes, and for *that*, language matters; but, for a vast array of programming tasks that *don't* involve global communications, it's an adde

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 16:24, Chris Angelico wrote: That is why this seems obtuse to me. There is no benefit to going to a pre-Unicode way of working with text. ChrisA In a word - simplicity. As I said, there are programming situations where the programmer only needs to deal with a single language

Re: Users banned

2018-07-15 Thread Jim Lee
On 07/15/18 14:53, Chris Angelico wrote: On Mon, Jul 16, 2018 at 7:35 AM, Marko Rauhamaa wrote: Christian Gollwitzer : Am 15.07.18 um 19:25 schrieb Ethan Furman: The following users are now banned from Python List: ... BartC I don't really think that this is appropriate. Bart may have dev

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 16:55, Steven D'Aprano wrote: On Sun, 15 Jul 2018 11:22:11 -0700, James Lee wrote: On 7/15/2018 3:43 AM, Steven D'Aprano wrote: No. The real ten billion dollar question is how people in 2018 can stick their head in the sand and take seriously the position that La

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 17:18, Steven D'Aprano wrote: On Sun, 15 Jul 2018 16:08:15 -0700, Jim Lee wrote: Python3 is intrinsically tied to Unicode for string handling. Therefore, the Python programmer is forced to deal with it (in all but trivial cases), rather than given a choice.  So I don't

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Jim Lee
On 07/15/18 17:17, MRAB wrote: On 2018-07-16 00:10, Jim Lee wrote: On 07/15/18 16:04, Chris Angelico wrote: You claimed that Unicode was insignificant to many programs. I'm trying to say that a Unicode text string is a vital part of any program that works with text, which is pretty

Re: Unicode [was Re: Cult-like behaviour]

2018-07-16 Thread Jim Lee
On 07/16/18 03:26, Steven D'Aprano wrote: But the thing is, that complexity is *inherent in the domain*. You can try to deal with it without Unicode, and as soon as you have users expecting to use more than one code page, you're doomed. No, I'm not doomed, because there *are* no other users

Re: Unicode [was Re: Cult-like behaviour]

2018-07-16 Thread Jim Lee
On 07/16/18 03:39, Steven D'Aprano wrote: Good for you. But Python is not a programming language written to satisfy the needs of people like you, and ONLY people like you. It is a language written to satisfy the needs of people from Uzbekistan, and China, and Japan, and India, and Brazil, and

Re: Unicode [was Re: Cult-like behaviour]

2018-07-16 Thread Jim Lee
On 07/16/18 10:40, Mark Lawrence wrote: On 16/07/18 18:27, Jim Lee wrote: Obviously, the most vocal representatives of the Python community are too sensitive about their language to enable rational discussion. Please moderators ban this person as he's going down the same line as bart

Re: Unicode [was Re: Cult-like behaviour]

2018-07-16 Thread Jim Lee
On 07/16/18 11:31, Steven D'Aprano wrote: On Mon, 16 Jul 2018 10:27:18 -0700, Jim Lee wrote: Had you actually read my words with *intent* rather than *reaction*, you would notice that I suggested the *option* of turning off Unicode. Yes, I know what you wrote, and I read it with i

RE: Recommendation for Object-Oriented systems to study

2016-05-29 Thread Joseph Lee
Hi, Replies inline. -Original Message- From: Python-list [mailto:python-list-bounces+joseph.lee22590=gmail@python.org] On Behalf Of Ankush Thakur Sent: Sunday, May 29, 2016 7:42 AM To: python-list@python.org Subject: Recommendation for Object-Oriented systems to study Hello, I'm a se

RE: Iteration, while loop, and for loop

2016-06-28 Thread Joseph Lee
Hi, Answers inline. -Original Message- From: Python-list [mailto:python-list-bounces+joseph.lee22590=gmail@python.org] On Behalf Of Michael Selik Sent: Tuesday, June 28, 2016 6:16 AM To: Elizabeth Weiss ; python-list@python.org Subject: Re: Iteration, while loop, and for loop On Tue,

RE: New to programming and asking about accessibility with jaws screen reader.

2016-07-24 Thread Joseph Lee
Hi, How are you running Python - via Command Prompt, perhaps? It might be better to ask a list like program-l (a dedicated programming list for blind devs). Cheers, Joseph -Original Message- From: Python-list [mailto:python-list-bounces+joseph.lee22590=gmail@python.org] On Behalf Of jo

Help on regular expression match

2005-09-22 Thread Johnny Lee
Hi, I've met a problem in match a regular expression in python. Hope any of you could help me. Here are the details: I have many tags like this: xxxhttp://xxx.xxx.xxx"; xxx>xxx xx xxxhttp://xxx.xxx.xxx"; xxx>xxx . And I want to find all the "http://xxx.xxx.

Re: Help on regular expression match

2005-09-23 Thread Johnny Lee
Fredrik Lundh wrote: > ".*" gives the longest possible match (you can think of it as searching back- > wards from the right end). if you want to search for "everything until a > given > character", searching for "[^x]*x" is often a better choice than ".*x". > > in this case, I suggest using some

A Moronicity of Guido van Rossum

2005-09-29 Thread Xah Lee
A Moronicity of Guido van Rossum Xah Lee, 200509 On Guido van Rossum's website: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 dated 20050826, he muses with the idea that he would like to remove lambda, reduce(), filter() and map() constructs in a future version Python 3000.

Re: A Moronicity of Guido van Rossum

2005-09-29 Thread Xah Lee
addendum: reduce() in fact embodies a form of iteration/recursion on lists, very suitable in a functional language environment. If Python's lambda and other functional facilities are more powerful, reduce() would be a good addition. For instance, in functional programing, it is a paradigm to nest

A problem while using anygui

2005-09-30 Thread Johnny Lee
Hi, I've met a problem while using anygui to create a GUI. Here is a brief example from Dave: ### def guidialog(): def ok(**kw): win.destroy() app.remove(win) # anygui.link(btn_ok, ok) # app.run() return n #qtgui will NEVER get here ### As you can see, the progra

Re: A Moronicity of Guido van Rossum

2005-10-01 Thread Xah Lee
the programers in the industry, including bigwigs such as Guido or that Larry Wall fuckhead, really don't know shit about computer languages. Sometimes i get pissed by Stephen Wolfram's megalomaniac cries, but in many ways, i think his statements about the fucking moronicities of the academicians a

[OT] Re: how to debug when "Segmentation fault"

2005-10-04 Thread Inyeol Lee
On Tue, Oct 04, 2005 at 11:22:24AM -0500, Michael Ekstrand wrote: [...] > I've never seen "stock" Python (stable release w/ only included modules) > segfault, but did see a segfault with an extension module I was using > the other week (lxml IIRC, but I'm not sure). > > - Michael So far, this i

check html file size

2005-10-04 Thread Xah Lee
would anyone like to translate the following perl script to Python or Scheme (scsh)? the file takes a inpath, and report all html files in it above certain size. (counting inline images) also print a sorted report of html files and their size. (a copy of the script is here: http://xahlee.org/_scr

Re: check html file size

2005-10-07 Thread Xah Lee
Xah Lee wrote: « would anyone like to translate the following perl script to Python or Scheme (scsh)?» Here's the Python version. # -*- coding: utf-8 -*- # Python # Wed Oct 5 15:50:31 PDT 2005 # given a dir, report all html file's size. (counting inline images) # XahLee.org

Daisy Daisy, give me your answer do

2005-10-08 Thread Xah Lee
there is a MacPerl program posted in 1998 that uses Mac's speech synth to sing Daisy Bell. See: http://bumppo.net/lists/macperl/1998/11/msg00412.html can anyone modify it so it runs out of the box on today's OS X? PS i'm posting this also in python and lisp group, i hope it'd be some general int

Re: Daisy Daisy, give me your answer do

2005-10-08 Thread Xah Lee
Dear Michael Goettsche, why don't you lead the pack to be on-topic for a change, huh? Xah Michael Goettsche wrote: > On Saturday 08 October 2005 22:10, Xah Lee wrote: > > there is a MacPerl program posted in 1998 that uses Mac's speech synth > > to sing Daisy Be

Pythot doc problem: lambda keyword...

2005-10-09 Thread Xah Lee
i'm trying to lookup on the detail of language Python's “lambda” function feature. I've seen it before, but today i need to read about it again since i'm writing. I quickly went to the index page: http://python.org/doc/2.4.1/lib/genindex.html but all i got is a LambdaType. i'm thinking, maybe buil

Perl-Python-a-Day: Sorting

2005-10-10 Thread Xah Lee
Sort a List Xah Lee, 200510 In this page, we show how to sort a list in Python & Perl and also discuss some math of sort. To sort a list in Python, use the “sort” method. For example: li=[1,9,2,3]; li.sort(); print li; Note that sort is a method, and the list is changed in place. Sup

A problem while using urllib

2005-10-11 Thread Johnny Lee
Hi, I was using urllib to grab urls from web. here is the work flow of my program: 1. Get base url and max number of urls from user 2. Call filter to validate the base url 3. Read the source of the base url and grab all the urls from "href" property of "a" tag 4. Call filter to validate every u

Python Doc Problem Example: sort() (reprise)

2005-10-11 Thread Xah Lee
Python Doc Problem Example: sort() Xah Lee, 200503 Exhibit: Incompletion & Imprecision Python doc “3.6.4 Mutable Sequence Types” at http://python.org/doc/2.4/lib/typesseq-mutable.html in which contains the documentation of the “sort” method of a list. Quote: « Operation Result N

Re: Python Doc Problem Example: sort() (reprise)

2005-10-11 Thread Xah Lee
Addendum, 200510 Here's further example of Python's extreme low quality of documentation. In particular, what follows focuses on the bad writing skill aspect, and comments on some language design and quality issues of Python. >From the Official Python documentation of the sort() method, at: http:

Re: A problem while using urllib

2005-10-11 Thread Johnny Lee
Alex Martelli wrote: > Johnny Lee <[EMAIL PROTECTED]> wrote: >... > >try: > > webPage = urllib2.urlopen(url) > >except urllib2.URLError: >... > >webPage.close() > >return True > > --

Re: A problem while using urllib

2005-10-12 Thread Johnny Lee
Steve Holden wrote: > Johnny Lee wrote: > > Alex Martelli wrote: > > > >>Johnny Lee <[EMAIL PROTECTED]> wrote: > >> ... > >> > >>> try: > >>> webPage = urllib2.urlopen(url) > >>> excep

Re: A problem while using urllib

2005-10-12 Thread Johnny Lee
Steve Holden wrote: > Steve Holden wrote: > > Johnny Lee wrote: > > [...] > > > >>I've sent the source, thanks for your help. > >> > > > > [...] > > Preliminary result, in case this rings bells with people who use urllib2 > >

Re: Perl-Python-a-Day: Sorting

2005-10-12 Thread Xah Lee
Sorting in Perl In Perl, to sort a list, do like this: @li=(1,9,2,3); @li2 = sort {$a <=> $b} @li; print join(' ', @li2); In Perl, sort is a function, not some Object Oriented thing. It returns the sorted result as another list. This is very simple and nice. It works like this: sort takes the

Re: Perl-Python-a-Day: Sorting

2005-10-12 Thread Xah Lee
Lasse Vågsæther Karlsen wrote: > Like the sorted function in Python ? > > li2 = sorted(li) > > you can also specify a key and a cmp function if you need to. Thanks. I didn't know there's also a sort function in Python (2.4), besides the method. (i've mentioned your name as acknowledgement at my

Re: A problem while using urllib

2005-10-13 Thread Johnny Lee
Steve Holden 写道: > Good catch, John, I suspect this is a possibility so I've added the > following note: > > """The Windows 2.4.1 build doesn't show this error, but the Cygwin 2.4.1 > build does still have uncollectable objects after a urllib2.urlopen(), > so there may be a platform dependency her

Microsoft Hatred FAQ

2005-10-14 Thread Xah Lee
Microsoft Hatred, FAQ Xah Lee, 20020518 Question: U.S. Judges are not morons, and quite a few others are not morons. They find MS guilty, so it must be true. Answer: so did the German population thought Jews are morons by heritage, to the point that Jews should be exterminated from earth

tuple versus list

2005-10-16 Thread Xah Lee
suppose i'm going to have a data structure like this: [ [imgFullPath,(width, height)], [imgFullPath,(width, height)], [imgFullPath,(width, height)], [imgFullPath,(width, height)], ... ] should i use (width,height) or [width,height]? what advantage i get to use n-tuple instead of the generic list?

Perl-Python-a-Day: split a file full path

2005-10-16 Thread Xah Lee
Split File Fullpath Into Parts Xah Lee, 20051016 Often, we are given a file fullpath and we need to split it into the directory name and file name. The file name is often split into a core part and a extension part. For example: '/Users/t/web/perl-python/I_Love_You.html' becomes &#x

Re: bizarro world (was Re: Python Doc Problem Example: sort() (reprise))

2005-10-17 Thread Xah Lee
Bryan wrote: > mr. xah... would you be willing to give a lecture at pycon 2006? i'm sure you > would draw a huge crowd and a lot of people would like to meet you in > person... > > thanks. I'd be delight to. My requirements are: 1 cup of fat-free milk, free, and free pizza. Xah [EMAIL PROTE

Question on class member in python

2005-10-17 Thread Johnny Lee
Class A: def __init__(self): self.member = 1 def getMember(self): return self.member a = A() So, is there any difference between a.member and a.getMember? thanks for your help. :) Regards, Johnny -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl-Python-a-Day: split a file full path

2005-10-17 Thread Xah Lee
Xah Lee wrote: > > In Perl, spliting a full path into parts is done like this: Dr.Ruud wrote: > And then follows Perl-code that only works with an optional .html > "extension", Thanks for the note. I've corrected it here: http://xahlee.org/perl-python/split_fullp

Re: Question on class member in python

2005-10-17 Thread Johnny Lee
Peter Otten 写道: > Johnny Lee wrote: > > > Class A: > >def __init__(self): > > self.member = 1 > > > >def getMember(self): > > return self.member > > > > a = A() > > > > So, is there any difference betw

Re: Question on class member in python

2005-10-18 Thread Johnny Lee
But I still wonder what's the difference between the A().getMember and A().member besides the style -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on class member in python

2005-10-18 Thread Johnny Lee
Alex Martelli 写道: > Johnny Lee <[EMAIL PROTECTED]> wrote: > > > But I still wonder what's the difference between the A().getMember and > > A().member besides the style > > Without parentheses after it, getMember is a method. The difference > between a meth

write a loopin one line; process file paths

2005-10-18 Thread Xah Lee
is there a way to condense the following loop into one line? # -*- coding: utf-8 -*- # python import re, os.path imgPaths=[u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2059m-s.jpg', u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2062m-s.jpg', u'/Users/t/web/Periodic_dosage_dir/lanci/t4

Re: write a loopin one line; process file paths

2005-10-18 Thread Xah Lee
Xah Lee wrote: > is there a way to condense the following loop into one line? > > # -*- coding: utf-8 -*- > # python > > import re, os.path > > imgPaths=[u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2059m-s.jpg', > u'/Users/t/web/Periodic_dosage_di

Python Doc Error: os.makedirs

2005-10-18 Thread Xah Lee
Python doc problem: http://python.org/doc/2.4.2/lib/os-file-dir.html makedirs( path[, mode]) Recursive directory creation function. Like mkdir(), but makes all intermediate-level directories needed to contain the leaf directory. Throws an error exception if the leaf directory already ex

Re: write a loopin one line; process file paths

2005-10-18 Thread Xah Lee
Peter Hansen wrote: > Xah Lee wrote: > > If you think i have a point, ... > > You have neither that, nor a clue. Dear Peter Hansen, My messages speak themselfs. You and your cohorts's stamping of it does not change its nature. And if this is done with repetitiousness, it gi

Re: Jargons of Info Tech industry

2005-10-18 Thread Xah Lee
> Xah Lee, on Aug 22, 2:43 pm wrote: > Unix, RFC, and Line Truncation > http://xahlee.org/UnixResource_dir/writ/truncate_line.html Steve wrote: > I've seen this argument before. There's at least one VERY good reason > to hard-code linebreaks in text: to preserve a cover

Re: write a loopin one line; process file paths

2005-10-18 Thread Xah Lee
Thanks. Here's how the inner loop should be: imgPaths2=map(lambda x: (x, re.sub( r"^(.+?)-s(\.[^.]+)$",r"\1\2", x)), imgPaths) though, now i just need something like map( lambda x: os.path.exists(s)? x[1]:x[0],impPaths2) but Pyhton doesn't support the test ? trueResult : falseResult construct.

<    1   2   3   4   5   6   7   8   9   10   >