Re: How to specific multiple dtypes in numpy.ndarray?

2019-12-21 Thread John Ladasky
On Thursday, December 19, 2019 at 2:53:18 AM UTC-8, lampahome wrote: > I meet performance is low when I use struct.unpack to unpack binary data. > > So I tried to use numpy.ndarray > But meet error when I want to unpack multiple dtypes > > Can anyone teach me~ > > Code like below: > # python3 >

ModuleNotFoundError, even though I can see module in dist-packages folder, Setuptools / EGG issue?

2020-04-08 Thread John Ladasky
Hi folks, Something broke in my Python installation in the past two or three days. I'm working in Ubuntu 19.10 and Python 3.7, without virtual environments. I have two modules of Python source code that I am developing. I regularly change this code and "distribute" it to myself using setupt

Re: ModuleNotFoundError, even though I can see module in dist-packages folder, Setuptools / EGG issue?

2020-04-08 Thread John Ladasky
On Wednesday, April 8, 2020 at 10:47:42 AM UTC-7, John Ladasky wrote: > Hi folks, > > Something broke in my Python installation in the past two or three days. I'm > working in Ubuntu 19.10 and Python 3.7, without virtual environments. > > I have two modules of Pytho

Multiprocessing vs. concurrent.futures, Linux vs. Windows

2020-05-04 Thread John Ladasky
Several years ago I built an application using multiprocessing. It only needed to work in Linux. I got it working fine. At the time, concurrent.futures did not exist. My current project is an application which includes a PyQt5 GUI, and a live video feed with some real-time image processing.

Re: Multiprocessing vs. concurrent.futures, Linux vs. Windows

2020-05-04 Thread John Ladasky
On Monday, May 4, 2020 at 4:09:53 PM UTC-7, Terry Reedy wrote: > On 5/4/2020 3:26 PM, John Ladasky wrote: > > Several years ago I built an application using multiprocessing. It only > > needed to work in Linux. I got it working fine. At the time, > > concurrent.

Should setuptools version propagate to a module's __version__? If so, how?

2020-05-08 Thread John Ladasky
I just came across a package in PyPI which is in a state of neglect. The official version on the PyPI page is 1.3.1 -- but the installed module reports its version as 1.2.0. This is confusing. There are several bugs in this package besides the mismatched version number. I've forked a copy of

Re: Should setuptools version propagate to a module's __version__? If so, how?

2020-05-08 Thread John Ladasky
On Friday, May 8, 2020 at 6:07:33 PM UTC-7, John Ladasky wrote: > Is there a recommended way to keep the internal reference and the setup.py > reference in sync? Is there any reason someone would NOT want these numbers > to match? Replying to myself... I just found thi

Re: Should setuptools version propagate to a module's __version__? If so, how?

2020-05-10 Thread John Ladasky
On Saturday, May 9, 2020 at 8:17:19 PM UTC-7, Cameron Simpson wrote: > I also autopatch the module itself to > set __version__ to match when I make that release tag. Yes, that's exactly what the module I wrote for my company's internal use does. The official version number is hard-coded into se

Re: Plot a contour inside a contour

2013-11-14 Thread John Ladasky
On Thursday, November 14, 2013 11:39:37 AM UTC-8, Isaac Won wrote: > I tried to plot one smaller contour inside of the other larger contour. Using what software? A plotting package is not part of the Python standard library. You did not show the import statements in your code. If I had to gues

Re: Obtaining "the" name of a function/method

2013-11-17 Thread John Ladasky
On Sunday, November 17, 2013 11:34:15 AM UTC-8, Ned Batchelder wrote: > Functions have a __name__ attribute, which is the name they were defined as: Thank you, that's exactly what I needed. -- https://mail.python.org/mailman/listinfo/python-list

Re: The Name of Our Religion Is Islam

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 8:52:06 AM UTC-8, BV BV wrote: > The Name of Our Religion Is Islam Incorrect. The name of YOUR religion is apparently "Spam." I have been flagging your posts. They do not belong in comp.lang.python. Please find a forum which discusses religion. Thank you. -- htt

Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
A few days ago, I asked about getting the original declared name of a function or method, and learned about the __name__ attribute. https://groups.google.com/forum/#!topic/comp.lang.python/bHvcuXgvdfA Of course, I have used __name__ for years in the common expression "if __name__ == "__main__")

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 12:13:42 PM UTC-8, I wrote: > 2. If I created a superclass of namedtuple which exposed > type(namedtuple).__name__ in the namespace of the namedtuple itself, would I > be doing anything harmful? Sigh. Of course, that should read "subclass", not "superclass." Becau

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 12:43:28 PM UTC-8, Ian wrote: > Classes and functions are frequently kept in module namespaces, where > they are known by a specific name. The intent is that the __name__ > attribute should match that name by which it is commonly referred. > > > > Specific instanc

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 1:11:08 PM UTC-8, Terry Reedy wrote: > On 11/18/2013 3:13 PM, John Ladasky wrote: > > > Of course, I have used __name__ for years in the common expression "if > > __name__ == '__main__'") to determine whether a particular modul

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 3:37:03 PM UTC-8, Steven D'Aprano wrote: > On Mon, 18 Nov 2013 13:02:26 -0800, John Ladasky wrote: > > > I am implementing a state machine. The outputs of the various states in > > the machine have variable contents. I started by making di

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
Thanks for your replies, Steven. Between this post and your other post, you wrote a lot. On Monday, November 18, 2013 3:21:15 PM UTC-8, Steven D'Aprano wrote (and I quote, edited, and sometimes out of order): > So if you have any > thought that "the name of an object" should be the name of th

Re: Traceback when using multiprocessing, less than helpful?

2013-11-21 Thread John Ladasky
On Thursday, November 21, 2013 12:53:07 PM UTC-8, Chris Angelico wrote: > What you could try is Suggestion 1: > printing out the __cause__ and __context__ of > the exception, to see if there's anything useful in them; Suggestion 2: > if there's > nothing, the next thing to try would be some

Re: Traceback when using multiprocessing, less than helpful?

2013-11-21 Thread John Ladasky
Followup: I didn't need to go as far as Chris Angelico's second suggestion. I haven't looked at certain parts of my own code for a while, but it turns out that I wrote it REASONABLY logically... My evaluate() calls another function through pool.map_async() -- _evaluate(), which actually proce

Traceback when using multiprocessing, less than helpful?

2013-11-21 Thread John Ladasky
Hi folks, Somewhat over a year ago, I struggled with implementing a routine using multiprocessing.Pool and numpy. I eventually succeeded, but I remember finding it very hard to debug. Now I have managed to provoke an error from that routine again, and once again, I'm struggling. Here is the

Re: Traceback when using multiprocessing, less than helpful?

2013-11-21 Thread John Ladasky
On Thursday, November 21, 2013 9:24:33 AM UTC-8, Chris Angelico wrote: > Hmm. This looks like a possible need for the 'raise from' syntax. Thank you, Chris, that made me feel like a REAL Python programmer -- I just did some reading, and the "raise from" feature was not implemented until Python

Re: Traceback when using multiprocessing, less than helpful?

2013-11-21 Thread John Ladasky
On Thursday, November 21, 2013 2:32:08 PM UTC-8, Ethan Furman wrote: > Check out bugs.python.org. Search for multiprocessing and tracebacks to see > if anything is already there; if not, create a new issue. And on Thursday, November 21, 2013 2:37:13 PM UTC-8, Terry Reedy wrote: > 1. Use 3.3.3

Why pickling (was: Traceback when using multiprocessing)

2013-11-22 Thread John Ladasky
On Thursday, November 21, 2013 8:24:05 PM UTC-8, Chris Angelico wrote: > Oh, that part's easy. Let's leave the multiprocessing module out of it > for the moment; imagine you spin up two completely separate instances > of Python. Create some object in one of them; now, transfer it to the > other. H

Re: Dvalve! we called the heart of outsourcing world.

2013-11-22 Thread John Ladasky
On Friday, November 22, 2013 12:44:38 AM UTC-8, kevow...@gmail.com wrote: > You know your website doesn't work? > Do you have any contact details You're responding to a (spam!) post which is dated April 9, 2010 -- two and a half years ago. -- https://mail.python.org/mailman/listinfo/python-lis

Re: squeeze out some performance

2013-12-06 Thread John Ladasky
On Friday, December 6, 2013 12:47:54 AM UTC-8, Robert Voigtländer wrote: > I try to squeeze out some performance of the code pasted on the link below. > http://pastebin.com/gMnqprST Several comments: 1) I find this program to be very difficult to read, largely because there's a whole LOT of du

Does Python optimize low-power functions?

2013-12-06 Thread John Ladasky
The following two functions return the same result: x**2 x*x But they may be computed in different ways. The first choice can accommodate non-integer powers and so it would logically proceed by taking a logarithm, multiplying by the power (in this case, 2), and then taking the anti-log

Re: Does Python optimize low-power functions?

2013-12-06 Thread John Ladasky
On Friday, December 6, 2013 11:32:00 AM UTC-8, Nick Cash wrote: > The reasons why have already been answered, I just wanted to point out that > Python makes it extremely easy to check these sorts of things for yourself. Thanks for the heads-up on the dis module, Nick. I haven't played with that

Re: python programming help

2013-12-08 Thread John Ladasky
On Sunday, December 8, 2013 10:32:31 AM UTC-8, rafae...@gmail.com wrote: [snip] > def people(age): > people=lambda age: [name for name in dic if dic[name]==age] > > people(20) [snip] > this is the code i have so far(with the help of the first post ;p). i > understand how a function and a d

Spoiler alert? (Re: Programming puzzle with boolean circuits)

2013-12-09 Thread John Ladasky
It has been ages since I've thought about logic gates, but... (Spoiler alert? I'm not sure...) . . . . . . . . . . . . . . . . My thought is that with two NOT logic gates, you can only build a flip-flop memory circuit. That strongly suggests to me that a memory circuit would

Re: Python 2.x and 3.x usage survey

2014-01-10 Thread John Ladasky
I responded to the survey about a week ago. Dan, I hope you will share the results with us soon. I also tried to reply to this thread, but I lost the ability to post to newsgroups for about a week. It seems to have been restored, so I will try again. My transition from Py2 to Py3 is implicit

Re: Python 2.x and 3.x usage survey

2014-01-10 Thread John Ladasky
On Friday, January 10, 2014 9:48:43 AM UTC-8, Ned Batchelder wrote: > On Python-Dev, Dan Stromberg posted this link with the results: > > http://stromberg.dnsalias.org/~strombrg/python-2.x-vs-3.x-survey/ That link gave me a 404. :^( -- https://mail.python.org/mailman/listinfo/python-list

Re: Chanelling Guido - dict subclasses

2014-01-15 Thread John Ladasky
On Wednesday, January 15, 2014 12:40:33 AM UTC-8, Peter Otten wrote: > Personally I feel dirty whenever I write Python code that defeats duck- > typing -- so I would not /recommend/ any isinstance() check. While I am inclined to agree, I have yet to see a solution to the problem of flattening nes

numpy.where() and multiple comparisons

2014-01-17 Thread John Ladasky
Hi folks, I am awaiting my approval to join the numpy-discussion mailing list, at scipy.org. I realize that would be the best place to ask my question. However, numpy is so widely used, I figure that someone here would be able to help. I like to use numpy.where() to select parts of arrays.

Re: numpy.where() and multiple comparisons

2014-01-17 Thread John Ladasky
On Friday, January 17, 2014 6:16:28 PM UTC-8, duncan smith wrote: > >>> a = np.arange(10) > >>> c = np.where((2 < a) & (a < 7)) > >>> c > (array([3, 4, 5, 6]),) Nice! Thanks! Now, why does the multiple comparison fail, if you happen to know? -- https://mail.python.org/mailman/listinfo/pyth

Re: trivial import question

2014-02-06 Thread John Ladasky
On Wednesday, February 5, 2014 9:52:33 AM UTC-8, nevets...@gmail.com wrote: > The underscore relative to a prfixed abbb. Is to be noted Reviving a fourteen year-old thread? That has to be some kind of record. -- https://mail.python.org/mailman/listinfo/python-list

Re: Where are we in the Python 3 transition?

2016-01-04 Thread John Ladasky
I switched to Python 3 between three and four years ago, I think. I was actually eager to make the switch, as I could see the value of clean Unicode support and lazy evaluation. I had to wait until Matplotlib supported Py3, then I changed. -- https://mail.python.org/mailman/listinfo/python-li

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-03 Thread John Ladasky
Yeah, I know, I shouldn't answer this troll-bait. Rick, you don't like Python? Fine, go program in a language that you do like. There are many to choose from! Meanwhile, Python is satisfying many programmers' needs. -- https://mail.python.org/mailman/listinfo/python-list

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-11 Thread John Ladasky
On Saturday, February 6, 2016 at 12:54:41 PM UTC-8, Rick Johnson wrote: > On Wednesday, February 3, 2016 at 12:02:35 AM UTC-6, John Ladasky wrote: > > > Rick, you don't like Python? > > If i didn't like Python, then i would happily let it self- > destruct, y

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-15 Thread John Ladasky
On Monday, February 15, 2016 at 6:02:24 PM UTC-8, Rick Johnson wrote: > On Friday, February 12, 2016 at 1:51:35 AM UTC-6, John Ladasky wrote: > > Reguarding a migration from Python2 to Pyhton3, John said: > > I had to wait until my favorite packages were ported > > (num

Re: Guido on python3 for beginners

2016-02-18 Thread John Ladasky
On Wednesday, February 17, 2016 at 11:28:17 PM UTC-8, Chris Angelico wrote: > 5) print statement/function. Py3 forces you to put parentheses on it, > which is no different from C's printf() or Pike's write() or any > number of other languages where console I/O needs no language support. > Maybe a

Re: [Python-Dev] Dinamically set __call__ method

2014-11-06 Thread John Ladasky
On Tuesday, November 4, 2014 11:12:31 AM UTC-8, Ethan Furman wrote: > If you really absolutely positively have to have the signature be correct for > each instance, you may to either look at a > function creating factory, a class creating factory, or a meta-class. +1. Overriding __call__() wit

How about some syntactic sugar for " __name__ == '__main__' "?

2014-11-12 Thread John Ladasky
I have taught Python to several students over the past few years. As I have worked with my students, I find myself bothered by the programming idiom that we use to determine whether a module is being executed or merely imported: "if __name__ == '__main__':" The use of two dunder tokens -- on

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-11-12 Thread John Ladasky
It appears that I'm not the first person to have thoughts along these lines. Here's a relevant article: http://aliles.tumblr.com/post/7455032885/sugar-for-pythons-main -- https://mail.python.org/mailman/listinfo/python-list

pickle, modules, and ImportErrors

2015-01-07 Thread John Ladasky
I am progressing towards organizing a recent project of mine as a proper Python package. It is not a huge package, about 700 lines of code so far. But it breaks into logical pieces, and I don't feel like scrolling back and forth through a 700-line file. I am running Python 3.4.0 on Ubuntu 14.

Re: pickle, modules, and ImportErrors

2015-01-07 Thread John Ladasky
On Wednesday, January 7, 2015 12:56:29 PM UTC-8, Devin Jeanpierre wrote: [snip] > If you never run model directly, and only ever import it or run it as > my_svr.model, then you will be fine, and pickles will all serialize > and deserialize the same way. Thank you Devin... I re-ran TrainingSessio

Namespace puzzle, list comprehension fails within class definition

2015-01-12 Thread John Ladasky
I've never come across this before. Here's a minimal example (in Python 3.4): Code: - d = {0:"a", 1:"b", 2:"c", 3:"d"} e = [d[x] for x in (0,2)] class Foo: f = {0:"a", 1:"b", 2:"c", 3:"d"} print(f) g = [f[x] for x

Re: Namespace puzzle, list comprehension fails within class definition

2015-01-12 Thread John Ladasky
Following up to myself: I finally did the right keyword search, and found a relevant article: http://stackoverflow.com/questions/13905741/accessing-class-variables-from-a-list-comprehension-in-the-class-definition Maybe I HAVE tried to define a list comprehension inside a class definition befor

Re: Namespace puzzle, list comprehension fails within class definition

2015-01-12 Thread John Ladasky
On Monday, January 12, 2015 at 12:41:30 PM UTC-8, Ethan Furman wrote: > In Foo 'f' is part of an unnamed namespace; the list comp 'g' has its own > namespace, effectively making be a nonlocal; > class name lookup skips nonlocal namespaces. > > Workaround: use an actual for loop. Thanks, Ethan.

Re: What killed Smalltalk could kill Python

2015-01-21 Thread John Ladasky
On Wednesday, January 21, 2015 at 11:18:54 AM UTC-8, Grant Edwards wrote: > On 2015-01-21, Steven D'Aprano wrote: > > In 2009, Robert Martin gave a talk at RailsConf titled "What Killed > > Smalltalk Could Kill Ruby". > > But does he answer the more important question "and can we use it to > kill

Re: Formatting string with accented characters for printing

2015-01-27 Thread John Ladasky
Jerry, I can tell from your code that you are using Python 2. If you are a new Python programmer, and you do not HAVE to use Python 2, use Python 3 instead. In Python 3, text objects are something called "Unicode" rather than just sequences of bytes. Unicode makes it much easier to handle cha

Re: Please help.

2015-02-09 Thread John Ladasky
On Monday, February 9, 2015 at 9:44:16 AM UTC-8, chim...@gmail.com wrote: > Hello. Am trying to change the key words to my tribal language. Eg change > English language: print() to igbo language: de(). I have been stuck for > months I need a mentor or someone that can guide me and answer some of

Re: Please help.

2015-02-09 Thread John Ladasky
On Monday, February 9, 2015 at 10:26:47 AM UTC-8, Dave Angel wrote: > That will help him with the functions. But not with the keywords. The > OP didn't specify Python version, but in 3.x, print() is a function, and > can be rebound. Since he said keyword, he's either mistaken, or he's > runn

Taming the verbosity of ipython tracebacks

2015-02-10 Thread John Ladasky
Hi folks, I'm running Python 3.4.0, and ipython3 1.2.1, on Ubuntu Linux 14.04 64-bit. Whenever I execute code from within ipython which triggers an exception -- any exception -- I get a page full of information. The exceptions in my code trigger exceptions within ipython. Every error message

Re: Taming the verbosity of ipython tracebacks

2015-02-10 Thread John Ladasky
On Tuesday, February 10, 2015 at 11:00:32 AM UTC-8, Chris Angelico wrote: > On Wed, Feb 11, 2015 at 5:53 AM, John Ladasky > wrote: > > I'm running Python 3.4.0, and ipython3 1.2.1, on Ubuntu Linux 14.04 64-bit. > > > > That's nice recent Python, but I just tri

Re: Taming the verbosity of ipython tracebacks

2015-02-10 Thread John Ladasky
he verbosity of ipython tracebacks > > > > On Wed, Feb 11, 2015 at 5:53 AM, John Ladasky > > wrote: > >> I'm running Python 3.4.0, and ipython3 1.2.1, on Ubuntu Linux 14.04 > > 64-bit. > >> > > > > That's nice recent Pytho

Re: Python discussed in Nature

2015-02-12 Thread John Ladasky
On Thursday, February 12, 2015 at 3:08:10 AM UTC-8, Fabien wrote: > ... what a coincidence then that a huge majority of scientists > (including me) dont care AT ALL about unicode. But since scientists are > not paid to rewrite old code, the scientific world is still stuck to > python 2. I'm a

Re: Python discussed in Nature

2015-02-13 Thread John Ladasky
On Thursday, February 12, 2015 at 7:12:01 PM UTC-8, Steven D'Aprano wrote: > John Ladasky wrote: > > > And I use Unicode in my Python. In implementing some mathematical models > > which have variables like delta, gamma, and theta, I decided that I didn't > > l

Parallelization of Python on GPU?

2015-02-25 Thread John Ladasky
I've been working with machine learning for a while. Many of the standard packages (e.g., scikit-learn) have fitting algorithms which run in single threads. These algorithms are not themselves parallelized. Perhaps, due to their unique mathematical requirements, they cannot be paralleized.

Re: Parallelization of Python on GPU?

2015-02-25 Thread John Ladasky
On Wednesday, February 25, 2015 at 7:03:23 PM UTC-8, Steven D'Aprano wrote: > I would like to point out that GPUs > typically don't support IEE-754 maths, which means that while they are > likely significantly faster, they're also likely significantly less > accurate. Historically, that has be

Re: Parallelization of Python on GPU?

2015-02-25 Thread John Ladasky
Thanks for the various links, Ethan. I have encountered PyCUDA before, but not the other options. So far, I'm not seeing code examples which appear to do what I would like, which is simply to farm out one Python process to one GPU core. The examples all appear to parallelize array operations.

Re: Combination Function Help

2014-02-12 Thread John Ladasky
On Wednesday, February 12, 2014 7:56:05 AM UTC-8, kjak...@gmail.com wrote: [snip] > choices(n, k) > > Changed it like you said, didn't work What are you doing with the value returned by the function, choices()? Right now, you aren't doing anything with it. You are throwing it away. That's the

Re: How to begin

2014-02-13 Thread John Ladasky
On Thursday, February 13, 2014 7:06:03 AM UTC-8, pete suchsland wrote: > if x = 99: Surely, Pete, you meant to write "if x == 99:" ? -- https://mail.python.org/mailman/listinfo/python-list

Welcome to the Internet. No one here likes you. (was: Newcomer Help)

2014-02-13 Thread John Ladasky
On Thursday, February 13, 2014 8:32:46 AM UTC-8, larry@gmail.com wrote: > This reminds me of post that was circulating in the early 90's: > > Welcome to the Internet. > > No one here likes you. > > We're going to offend, insult, abuse, and belittle the living hell out > of you. And when you

Re: Python programming

2014-03-07 Thread John Ladasky
On Thursday, February 13, 2014 12:30:39 AM UTC-8, larry@gmail.com wrote: > On Wed, Feb 12, 2014 at 10:56 PM, William Ray Wing wrote: > > > OK, and how many of you remember the original version of the > > tongue-in-cheek essay "Real Programmers Don't Use Pascal" from the back > > page of Dat

Re: Python programming

2014-03-08 Thread John Ladasky
On Friday, March 7, 2014 4:38:54 PM UTC-8, Dennis Lee Bieber wrote: > On Fri, 7 Mar 2014 10:03:35 -0800 (PST), John Ladasky > declaimed the following: > >> More than once, I have queried Google with the phrase "Why isn't FORTRAN >> dead yet?" For some reas

Mutable objects inside tuples - good or bad?

2014-04-05 Thread John Ladasky
I find this programming pattern to be useful... but can it cause problems? Python 3.3.2+ (default, Feb 28 2014, 00:52:16) [GCC 4.8.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> a = [1,2,3] >>> b = [4,5,6] >>> c = (a,b) >>> c ([1, 2, 3], [4, 5, 6]) >>> c[0]

Method(s) called by square brackets, slice objects

2014-04-09 Thread John Ladasky
I would like to build a multi-dimensional array that allows numpy-style indexing and, ideally, uses Python's familiar square-bracket and slice notations. For example, if I declare a two-dimensional array object, x, then x[4,7] retrieves the element located at the 4th row and the 7th column. If

Re: Method(s) called by square brackets, slice objects

2014-04-10 Thread John Ladasky
Thanks to both Ethan and Steven for their replies. Steven: I was trying to use the interpreter and wasn't getting results that I understood -- because I didn't know that __getslice__ was simply gone in Python 3. I implemented a __getslice__ method in my subclass that never got called. Ethan: I

Re: is there a list/group for beginners?

2014-05-27 Thread John Ladasky
Hi, Deb. Ten years ago (or eleven?), I was completely new to Python. I could not begin to understand over 90 percent of what I was reading here in comp.lang.python. Still, I asked my newbie questions here. For the most part, I got excellent responses. I think you're in the right place. --

Re: Python: Code is ignoring the if and else

2013-08-02 Thread John Ladasky
On Friday, August 2, 2013 5:40:52 PM UTC-7, kevin...@gmail.com wrote: > Basically, my code is ignoring the if's and else's. I don't get why. > Everything appears to be positioned correctly, but for some odd reason, even > after an if, the program also runs the else as well. Look carefully at y

Why do I have to use "global" so much when using Turtle?

2013-09-21 Thread John Ladasky
Hi, folks, Some of you may remember that I am teaching some high school students how to program. Because they all love graphics, I have been investigating the turtle module, which I gather is built on top of Tk. I can see that real-time applications are possible. I'm writing a classic "bounc

Re: Why do I have to use "global" so much when using Turtle?

2013-09-22 Thread John Ladasky
All right, never mind! I hacked around this morning, making some changes to parts of my program that I thought were unrelated to my namespace issues. I was paring it down to a minimal example, to post here as Ned requested. As an experiment, I also commented out the global declaration line in

Re: Why do I have to use "global" so much when using Turtle?

2013-09-23 Thread John Ladasky
No, Rusi, I have never seen Pynguin before -- and it looks very cool! -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with Python please (picture)

2013-09-27 Thread John Ladasky
On Friday, September 27, 2013 5:43:42 PM UTC-7, jae...@gmail.com wrote: > http://imgur.com/E6vrNs4 > > Can't seem to be getting an output. Because you aren't printing anything! One possible way to fix that is to change the line which reads... random_characters(8) to read... print(random_chara

Variable arguments (*args, **kwargs): seeking elegance

2013-10-05 Thread John Ladasky
Hi folks, I'm trying to make some of Python class definitions behave like the ones I find in professional packages, such as Matplotlib. A Matplotlib class can often have a very large number of arguments -- some of which may be optional, some of which will assume default values if the user does

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
Thanks, everyone, for your replies. Perhaps I have complicated things unnecessarily? I was just trying to do some error-checking on the arguments supplied to the class constructor. Perhaps Python already implements automatically what I am trying to accomplish manually? I'll tinker around wit

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
On Monday, October 7, 2013 9:26:51 AM UTC-7, I wrote: > Here is one more detail which may be relevant. The base class for the family > of classes I am developing is a numpy.ndarray. The numpy.ndarray is a C > extension type (and if I understand correctly, that means it is immutable by > ordina

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
Wow, Steven, that was a great, detailed reply. I hope you will forgive me for shortcutting to the end, because I've been hacking away for a few hours and came to this very conclusion: On Monday, October 7, 2013 2:13:10 PM UTC-7, Steven D'Aprano wrote: > In general, you should aim to use either

Is this the room for an argument?

2013-10-10 Thread John Ladasky
On Thursday, October 10, 2013 5:07:11 PM UTC-7, Roy Smith wrote: > I'd like an argument, please. 'Receptionist' (Rita Davies) - Yes, sir? 'Man' (Michael Palin) - I'd like to have an argument please. 'Receptionist' - Certainly sir, have you been here before...? 'Man' - No, this is my first time. 'R

Re: Multiprocessing: killing children when parent dies

2013-10-18 Thread John Ladasky
What a lovely thread title! And just in time for Halloween! :^) -- https://mail.python.org/mailman/listinfo/python-list

Re: Check if this basic Python script is coded right

2013-10-26 Thread John Ladasky
HC, you have come straight out and told us honestly that you are seeking help with homework. That is refreshing. You should know that people in programming newsgroups generally do not want to do your homework for you. Many of us are willing to teach you HOW to program, but that's different

Python on a MacBook Pro (not my machine)

2013-10-26 Thread John Ladasky
Hi folks, My side job as a Python tutor continues to grow. In two weeks, I will start working with a high-school student who owns a MacBook Pro. I have had students with Linux systems (my preference) and Windows systems before, but not Macs. On my first visit, I set up each student's comput

Re: Python on a MacBook Pro (not my machine)

2013-11-06 Thread John Ladasky
I just wanted to say thank you to everyone who posted here with recommendations for programming-friendly text editors. I will follow up on this after I have resolved a more fundamental issue with my new student -- his Python 3.3.2 interpreter segfaults and crashes on the second command! I'll s

Py 3.3.2, MacBookPro, segmentation fault, GCC issue?

2013-11-06 Thread John Ladasky
I am trying to help a student of mine install Python 3 on his MacBook Pro. The installation succeeds. However, upon opening the Python interpreter, he can only execute one Python command successfully. On the second command, the interpreter crashes, giving the error "Segmentation fault: 11".

Re: Py 3.3.2, MacBookPro, segmentation fault, GCC issue?

2013-11-06 Thread John Ladasky
Thanks, Mark. Reading through the information in your link, I appear to have encountered an actual bug specific to Python 3.3.2 and OS X 10.9. And it appears that the 3.3.3 version of Python that fixes this bug is still in beta. And that I can have my student download the working version from

Re: Show off your Python chops and compete with others

2013-11-06 Thread John Ladasky
On Wednesday, November 6, 2013 4:00:57 PM UTC-8, Nathaniel Sokoll-Ward wrote: > Thought this group would appreciate this: www.metabright.com/challenges/python I have to concur with what several other people are saying here. Several of MetaBright's questions are ambiguously worded, or expect non-

Re: Parallelization of Python on GPU?

2015-02-26 Thread John Ladasky
On Thursday, February 26, 2015 at 8:41:26 AM UTC-8, Sturla Molden wrote: > If you are doing SVM regression with scikit-learn you are using libSVM. > There is a CUDA accelerated version of this C library here: > http://mklab.iti.gr/project/GPU-LIBSVM > > You can presumably reuse the wrapping code f

Re: Topic Modeling LDA Gensim

2015-03-17 Thread John Ladasky
Hey you two, get a room. -- https://mail.python.org/mailman/listinfo/python-list

Re: Sudoku solver

2015-03-25 Thread John Ladasky
On Wednesday, March 25, 2015 at 4:39:40 AM UTC-7, Marko Rauhamaa wrote: > I post below a sudoku solver. I eagerly await neater implementations (as > well as bug reports). So, it's a brute-force, recursive solver? The code is nice and short. But I bet it takes a long time to run. I and a stude

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread John Ladasky
On Saturday, April 25, 2015 at 4:16:04 PM UTC-7, Mario Figueiredo wrote: [snip] > This works as intended. But plots a jagged curve due to the small > discrepancies normal of a random number generation. > > Other than replacing the random module with the probability density > function for the expon

Re: Tit for tat

2015-04-26 Thread John Ladasky
On Sunday, April 26, 2015 at 6:41:08 PM UTC-7, Seymore4Head wrote: > Richard Dawkins explains with passion the idea of game theory and tit > for tat, or why cooperation with strangers is often a strong strategy. > > He talks of a computer program tournament. I don't know what I could > say that

Re: Tit for tat

2015-04-26 Thread John Ladasky
Following up to myself... Here's a link to Patrick Grim's results that you can actually download (Springer really retains a 1997 research paper behind a paywall?): http://www.pgrim.org/pgrim/SPATIALP.HTM -- https://mail.python.org/mailman/listinfo/python-list

Re: Tit for tat

2015-04-28 Thread John Ladasky
On Tuesday, April 28, 2015 at 1:10:14 PM UTC-7, Robert Kern wrote: > On 2015-04-28 07:58, Steven D'Aprano wrote: > I do believe he is trying to make a crude joke. I agree, that's what he's doing. And I find it ironic, since he started this thread, and seemed to invite a serious discussion of th

Re: CHALLENGE HELP - GOOGLE DEVELOPER DAY

2015-05-05 Thread John Ladasky
On Tuesday, May 5, 2015 at 4:59:51 PM UTC-7, Chris Angelico wrote: > On Wed, May 6, 2015 at 2:59 AM, wrote: > > Good afternoon everyone. > > > > I'm with the following exercise of the option is a modification of a google > > developer day exercise. > > > > SOMEONE HELP ME IN THIS CHALLENGE? > >

Re: anomaly

2015-05-12 Thread John Ladasky
On Monday, May 11, 2015 at 3:16:16 AM UTC-7, Antoon Pardon wrote: > Try overriding None, True or False in python3 and see what happens. Much fun was able to be had in Python 2, though: Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "cre

Re: Where is 'palindrome' defined?

2015-06-02 Thread John Ladasky
On Monday, June 1, 2015 at 2:22:02 AM UTC-7, Marko Rauhamaa wrote: > Sota-apina nakataan raastimeen. > Apelle pane emit. > Saarnaa takanani paatos. > > (= "The war monkey will be chucked into a grater. > Hand the pistils to father-in-law. > Pathos does prea

Re: most ambiguous line of code ever written?

2015-06-03 Thread John Ladasky
On Wednesday, June 3, 2015 at 8:21:43 AM UTC-7, Mark Lawrence wrote: > right = not right > > Isn't that just beautiful? A few weeks ago, we were discussing the fact that, in Python 2, True = False, and False = True, were both legal statements in Python. I remarked: "every politician's dream!"

Re: Python programming classes for children

2015-07-01 Thread John Ladasky
On Wednesday, July 1, 2015 at 6:03:06 AM UTC-7, beli...@aol.com wrote: > My 11yo son is taking the online class "Intermediate Programming with Python" > http://www.artofproblemsolving.com/school/course/catalog/python2 offered by > the Art of Problem Solving company (AoPS). Classes meet for 1.5 ho

Re: beginners choice: wx or tk?

2015-07-11 Thread John Ladasky
On Saturday, July 11, 2015 at 2:51:32 AM UTC-7, Ulli Horlacher wrote: > Chris Angelico wrote: > > There are other choices, too - pygtk/pygobject (GTK) and pyqt (Qt) > > come to mind > > Both create BIG executables, much bigger than with wx or tk. I worked with wxPython back when I was using Pyth

Re: Hi

2015-07-25 Thread John Ladasky
On Saturday, July 25, 2015 at 10:39:48 AM UTC-7, 김지훈 wrote: > Hi. > I recently changed my path to be a programmer so I decided to learn python. > I downloaded files(Python 2.7.10 - 2015-05-23) to setup on your website. Unless you need to maintain someone's older software, I would personally recom

<    1   2   3   >