Re: Standard class for time *period*?

2023-03-27 Thread Gary Herron
The Python standard library module datetime seems to be what you want.  It has objects representing date/times, and deltatimes (i.e., durations).  These can be timezone aware or not as you wish. Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology On 3/27/23 6:00 AM

Re: =- and -= snag

2023-03-13 Thread Gary Herron
instead of -=. Isn't it unpythonic to be able to make a mistake like that? Regards, Morten These all mean the same thing, but I don't see a good way to designate the second or third as an error. x = -5 x=-5 x =- 5 Dr. Gary Herron Professor of Computer Science DigiPen Institute of

Re: Change first occurrence of character x in a string - how?

2021-02-14 Thread Gary Herron
requirement of needing to change '.' to '@'. Alternatively is there an RE 'match' function that would test if linux-r...@vger.kernel.org matches linux-raid.vger.kernel.org? I don't really care if the '.' are all regarded as wild cards, the match will

Re: Calculations and Variables

2019-10-31 Thread Gary Herron
uot; % eachPay) I am aiming for the result of 43.6, but somehow get the result of 44.44. (meal cost: 200) (Tip: 9) (people: 5) I seem to do the calculation below, but get different results each time. Total * Percentage Amount / 100 -- Dr. Gary Herron Professor of Computer Science DigiPen Ins

Re: Multiprocessing and memory management

2019-07-03 Thread Gary Herron
2156 Koyukuk Drive Fairbanks AK 99775-7320 Work: 907-474-5172 cell: 907-328-9145 -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: CAD Application

2019-05-06 Thread Gary Herron
it's still available for download. -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: namedtuples anamoly

2018-10-18 Thread Gary Herron
ou destroy the   it so carefully stored in Grade.ID. So now the real question is:  What were you trying to accomplish with the assignment?  Tell us, and let's see if we can find a way to accomplish yor goal without wrecking the internals of the Grade class. Gary Herron it has impact on

Re: Advice on law firm

2018-10-18 Thread Gary Herron
suits? Sent from Mail for Windows 10 -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: My python code has suddenly started to give me error. Please see code below**

2018-10-08 Thread Gary Herron
t((UL1)/(10**(count-1: B12 B1=(B11,"-",B12,"M") B1 -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.

2018-10-02 Thread Gary Herron
We're not here to do your homework for you, and you won't learn anything if we do.  You make an attempt at solving this, asking any specific Python related questions you need help with, and you'll find this to be prompt, friendly, and helpful group. Gary Herron -- Dr. Gary

Re: import inspect error

2018-09-17 Thread Gary Herron
You appear to have a local file named keyword.py which is hiding a python installation file of the same name. Gary Herron On 09/17/2018 01:06 AM, jupiter@gmail.com wrote: I have following errors running on Ubuntu 18, any insight how to fix it? Thank you. Python 2.7.15rc1 (default

Re: trying to connect the setarrange and blendshape input target weight while running the script am getting error in the 8th line. (for each in lip_val_list: )

2018-09-13 Thread Gary Herron
lendshape, what's an input target weight,  what does it mean to connect them?  Either none of that is important (as is the case in this simple indentation error), so don't include such distractions, or it does matter, so take the time to define those terms. Gary Herron On

Re: Python Probability

2018-09-11 Thread Gary Herron
make a table. But its giving me zeros or 333. And to get 5digits after the zero i wanted to use "%.5f " %First. Could you help me to finish this, and tell me what am I doing wrong? Thank you -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895

Re: Python Probability

2018-09-11 Thread Gary Herron
table. But its giving me zeros or 333. And to get 5digits after the zero i wanted to use "%.5f " %First. Could you help me to finish this, and tell me what am I doing wrong? Thank you -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895

Re: curve_fit in scipy

2018-06-19 Thread Gary Herron
_fit(test_func, x_data, y_data, p0=[2, 2]) print(params) plt.figure(figsize=(6, 4)) plt.scatter(x_data, y_data, label='Data') plt.plot(x_data, test_func(x_data, params[0], params[1]), label='Fitted function') plt.legend(loc='best&#

Re: How can an int be '+' with a tuple?

2018-06-02 Thread Gary Herron
the "any + context" at line 18. The "any" was passed as an integer from line 43 and the "context" was defined as a tuple at line 35. This concatenation works! how? Best Regards, Jach Fong --- This email has been checked for viruses by Avast antivirus softwa

Re: Numpy array

2018-05-20 Thread Gary Herron
second columns alone for x and y respectively. I am confused as to how data[:10] gives the first 10 rows while data[:,0] gives all rows -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Weird side effect of default parameter

2018-05-03 Thread Gary Herron
This is a well known feature of Python.   It's a very common "gotcha" to new Python programmers. Google "Mutable default parameters in Python" for long list of explanations and fixes. In short, don't use a mutable object as a default parameter. Gary Herron

Re: specifying the same argument multiple times with argparse

2018-04-16 Thread Gary Herron
e: >>> >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='append') >>> parser.parse_args('--foo 1 --foo 2'.split()) Namespace(foo=['1', '2']) I hope that helps. -- Dr. Gary Herr

Re: Please Help

2018-01-26 Thread Gary Herron
know what that means?  The answer you might have expected (i.e. 260) does not fit in the 0 ... 255 range of 8 bits, and so the result has overflowed and "wrapped around" to produce 4. Try this for a simpler example of the same: >>> np.uint8(260) 4 Gary Herron -- Dr. Gary

Re: None is None but not working

2017-09-27 Thread Gary Herron
   if data is None: ... and I get output of None None {'MeetingDate': '2017-01- ... and so on. How can I actually get this to check? If i use type(data) I also get None. Cheers Sayth -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

How to change variable from list to float

2017-06-05 Thread Gary Barker
I have searched for a solution to this but have not found a suitable example. The attached code generates this error: Traceback (most recent call last): File "calcsignal.py", line 7, in siglevfromexist = 34.8 + existattn TypeError: unsupported operand type(s) for +: 'float' and 'list' Ho

Re: getting the center of mass of each part of a molecule

2017-05-15 Thread Gary Herron
iate to ask here for help in translating it into a Python program. Gary Herron -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Write a function group(L).

2017-04-21 Thread Gary Herron
. Welcome to python-list. If you ask a Python question, it will probably get answered. If you want someone to do your homework, it will probably not happen. -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman

Re: Who are the "spacists"?

2017-03-18 Thread Gary Herron
installed packages, and my own work. I would strongly resist anything that needs that much re-installation and personal attention. -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: why this code loop forever after a draw a rectangle

2016-09-16 Thread Gary Herron
manual for opencv, we see that cv2.rectangle does indeed return None: Python: cv.Rectangle(img, pt1, pt2, color, thickness=1, lineType=8, shift=0) → None So the first pass through your loop does indeed set im to None with the line im = cv2.rectangle(im.copy(), (x,y), (x+w,

Re: why this code loop forever after a draw a rectangle

2016-09-16 Thread Gary Herron
e guesswork: if cv2.rectangle draws a rectangle, what does it return? If it doesn't return anything, the line im = cv2.rectangle(...) is how im gets the value of None. -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: degrees and radians.

2016-08-23 Thread Gary Herron
libraries Just for what its worth. Do you really need anything more complex than this? >>> toRadians = math.pi/180.0 >>> math.sin(90*toRadians) 1.0 Perhaps I'm not understanding what you mean by "clunky", but this seems pretty clean and simple to me. Gary H

DED processing

2016-08-22 Thread Gary Sublett
I have to go out for a while, so for DED processing two options from my end: 1. Process as you all have been in the past for now. If you all do this, the records that have not been mailed prior to the latest list are contained in a MailManage Job name DED_master. If you chose to process as in th

Re: A strange list concatenation result

2016-08-11 Thread Gary Herron
, 6] In this next example, there are two separate lists: >>> list1 = [1,2,3] >>> list2 = [1,2,3] >>> list1 += [4,5,6] >>> print(list1, list2) [1, 2, 3, 4, 5, 6] [1, 2, 3] Does that help? Gary Herron -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Operator precedence problem

2016-06-06 Thread Gary Herron
", "credits" or "license" for more information. >>> 2 ** 3 ** 2 512 >>> 2 ** (3 ** 2) 512 >>> (2 ** 3) ** 2 64 >>> Here's the relevant documentation page: https://docs.python.org/3/reference/expressions.html Look for "... except

Re: Spreading a class over multiple files

2016-06-05 Thread Gary Herron
esult will be essentially the same as if all three methods were defined in MainCLass. Gary Herron -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 My primary use case is when I create a "Model" class to reflect an entire SQL database.

Re: Image loading problem

2016-05-21 Thread Gary Herron
Label(win, image=img).pack() return img saved_img = load_img(win) ... Gary Herron -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: def __init__(self):

2016-04-26 Thread Gary Herron
my original answer (that it's the constructor), and suggest ignoring the overly pedantic (and confusing) response to the contrary. -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: def __init__(self):

2016-04-26 Thread Gary Herron
_ method is the constructor for instances of a class. It is not required, but the situations in which a constructor is not needed are few and unusual. If you don't know object-oriented-programming, then I'd suggest you put that high on your list of things to learn. It's a valuab

Re: what is the difference between one-line-operation and 2-line-operation

2016-04-25 Thread Gary Herron
cond time, the iterator is exhausted and returns no objects. A simpler example: "b" is a map object (iterator), then list(b) is run twice. >>> a = [1,2,3] >>> b = map(lambda e: e+1, a) >>> b >>> list(b) [2, 3, 4] >>> list(b) [] I h

Re: Exclude every nth element from list?

2016-03-26 Thread Gary Herron
8, 10, 11, 13, 14, 16, 17, 19] Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Gary Herron
whoever wrote it into converting it to Python3. Or my guess is completely wrong and the code is buggy and won't run until fixed. (Which brings up the questions: What is cppdep.py? Who wrote it? How do you know that it runs?) Gary H

Re: Struggeling with collections

2016-03-07 Thread Gary Herron
format(self.a, self.b) # Modify to suit your needs. ... >>> print(C(1,2)) C(a=1, b=2) >>> Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: list reversal error

2016-03-03 Thread Gary Herron
reverse order: for datum in reversed(data): ... whatever with datum ... which wastes no time actually reversing the list, but simply loops through them back to front. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 --

Re: problem with dateutil

2016-02-13 Thread Gary Herron
On 02/13/2016 12:27 PM, Tom P wrote: On 02/13/2016 07:13 PM, Gary Herron wrote: On 02/13/2016 09:58 AM, Tom P wrote: I am writing a program that has to deal with various date/time formats and convert these into timestamps. It looks as if dateutil.parser.parse should be able to handle about any

Re: problem with dateutil

2016-02-13 Thread Gary Herron
ons are used to separate :MM:DD. Is there a way to include this as a valid format? Yes, there is a way to specify your own format. Search the datetime documentation for datetime.strptime(date_string, format) Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Ins

Re: import cannot be used inside eval

2016-02-04 Thread Gary Herron
xpression. Also, it's a bad idea to use eval like this, and it's a *really* bad idea to use eval with user supplied input. The user could inject *any* malicious code. Instead, use the importlib module to programmatically import a module. Gary Herron -- Dr. Gary Herron Department o

Duplicate Output

2016-01-27 Thread Gary Roach
g or how do I remove the duplicate list. Gary R. -- https://mail.python.org/mailman/listinfo/python-list

Re: 'string.join' is wrong in my Python console

2015-12-03 Thread Gary Herron
't see string should be replaced by something else. Could you tell me why I have such an error? You are trying to use the *string* module without importing it, I'd guess. Try: import string first then you should be able to access string.join without error. Gary Herron Thanks, -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: reading from a txt file

2015-11-26 Thread Gary Herron
print(words) ... ['a', 'b', 'c'] ['aa', 'bb', 'cc'] -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Why won't this run?

2015-11-16 Thread Gary Herron
) lines to print(...) (without the colon) and try again. If there is further trouble, ask another question, but please cut and paste the actual and *exact* results into the email. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Pyvenv use

2015-10-15 Thread Gary Roach
n.py loads the bin, include and lib directories into the project instead of the normal django setup. django 1.8 Debian 8 (jessie) OS python 3.4 Any help will be sincerely appreciated. Gary R. -- https://mail.python.org/mailman/listinfo/python-list

Re: Errors installing xmiparser with Python 3.4 and windows - any help?

2015-10-10 Thread Gary Hanyzewski
Laura, Thanks for the pointer to PyXB, I think this will work for my purposes and it appears to be Python 3.4 / Windows compatible. Thank you to all who helped. On Friday, October 9, 2015 at 1:14:32 PM UTC-5, Laura Creighton wrote: > In a message of Fri, 09 Oct 2015 10:24:34 -0700, G

Errors installing xmiparser with Python 3.4 and windows - any help?

2015-10-09 Thread Gary Hanyzewski
s the trick? if not any pointers on what I can do to get it to go. Are there any other xmi parsers or tools? Thanks Gary Error output below -- >python setup.py install running install running bdist_egg running egg_info writing entry points to xmiparser.egg-info\entry_points.txt

Re: Lesson 39 of Learning Python the Hard Way hangs (Fixed?)

2015-09-09 Thread Gary Roach
On 09/09/2015 01:45 PM, John Gordon wrote: In Gary Roach writes: Traceback (most recent call last): File "/root/mystuff/mystuff/ex39_test.py", line 6, in hashmap.set(states, 'Oregon', 'OR') File "/root/mystuff/mystuff/hashmap.py", line

Re: Lesson 39 of Learning Python the Hard Way hangs

2015-09-09 Thread Gary Roach
On 09/09/2015 01:45 PM, John Gordon wrote: In Gary Roach writes: Traceback (most recent call last): File "/root/mystuff/mystuff/ex39_test.py", line 6, in hashmap.set(states, 'Oregon', 'OR') File "/root/mystuff/mystuff/hashmap.py", line

Re: Lesson 39 of Learning Python the Hard Way hangs (Fixed?)

2015-09-09 Thread Gary Roach
On 09/09/2015 01:45 PM, John Gordon wrote: In Gary Roach writes: Traceback (most recent call last): File "/root/mystuff/mystuff/ex39_test.py", line 6, in hashmap.set(states, 'Oregon', 'OR') File "/root/mystuff/mystuff/hashmap.py", line

Lesson 39 of Learning Python the Hard Way hangs

2015-09-09 Thread Gary Roach
): """Deletes the given key from the Map.""" bucket = get_bucket(aMap, key) for i in xrange(len(bucket)): k, v = bucket[i] if key == k: del bucket[i] break def list(aMap): """Prints out what's in the Map.""" for bucket in aMap: if bucket: for k, v in bucket: print k, v Very frustrating and probably a stupid error. Any help will be sincerely appreciated. Gary R. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is Django the way to go for a newbie?

2015-08-09 Thread Gary Roach
use to be a whiz at fortran, C and Xbase but haven't done anything since I retired. Good luck Gary R -- https://mail.python.org/mailman/listinfo/python-list

Re: Improper Django Project error (solved)

2015-08-01 Thread Gary Roach
On 07/30/2015 11:15 PM, dieter wrote: Gary Roach writes: Being new to Django and Python, I have two projects setup side by side, each in it's own virtualenv wrapper. The twr_project is running Django 1.7, python 2.7 and is set up to duplicate the 'Tango With Rango' tutorial

Re: Improper Django Project error (solved)

2015-07-31 Thread Gary Roach
On 07/30/2015 11:15 PM, dieter wrote: Gary Roach writes: Being new to Django and Python, I have two projects setup side by side, each in it's own virtualenv wrapper. The twr_project is running Django 1.7, python 2.7 and is set up to duplicate the 'Tango With Rango' tutorial

Improper Django Project error

2015-07-30 Thread Gary Roach
ex.html (Django 1.7) and home.html (Django 1.8) is the name changes. I have inserted print statements in the url tree to try debugging this but all the path information returned seems reasonable. Is this a bug in Ninja-IDE, Django 1.8 or is it something else. If you need more information, pl

Re: password authentication failed (SOLVED)

2015-07-24 Thread Gary Roach
On 07/22/2015 04:44 PM, Chris Angelico wrote: On Thu, Jul 23, 2015 at 9:35 AM, Gary Roach wrote: At this point, I'm confused about a few things. Does the postgresql server and my archivedb reside globally or are they inside my archivedb virtual environment. I think globally. Your vi

Re: password authentication failed

2015-07-23 Thread Gary Roach
On 07/16/2015 04:53 PM, Chris Angelico wrote: On Fri, Jul 17, 2015 at 9:34 AM, Gary Roach wrote: On 07/15/2015 11:25 AM, Chris Angelico wrote: You should then be able to create a regular user, and grant appropriate permissions: postgres=# create user archives password 'traded-

Re: password authentication failed

2015-07-22 Thread Gary Roach
On 07/16/2015 04:53 PM, Chris Angelico wrote: On Fri, Jul 17, 2015 at 9:34 AM, Gary Roach wrote: On 07/15/2015 11:25 AM, Chris Angelico wrote: You should then be able to create a regular user, and grant appropriate permissions: postgres=# create user archives password 'traded-

Re: Should non-security 2.7 bugs be fixed?

2015-07-18 Thread Gary Herron
On 07/18/2015 04:36 PM, Terry Reedy wrote: I would like more viewpoints from 2.7 users. I read that (incorrectly of course) and just had to ask: How do you intend to extract a viewpoint from that last 7/10 of a user? With apologies, Gary Herron -- Dr. Gary Herron Department of

Re: password authentication failed

2015-07-16 Thread Gary Roach
On 07/15/2015 11:25 AM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 3:13 AM, Gary Roach wrote: Every time I try to do a python manage.py migrate I get: django.db.utils.OperationalError: FATAL: password authentication failed for user "postgres" FATAL: password authentication faile

password authentication failed

2015-07-15 Thread Gary Roach
a postgres account in postgres or is Django supposed to do this with the migrate command. I feel like I am at a critical point where I can really screw things up and need some expert advise. This is my first time working with python / Django and am really shaky. I do have another learning project (rango) using SQLite that works fine. Gary R -- https://mail.python.org/mailman/listinfo/python-list

Re: Can anybody explain the '-' in a 2-D creation code?

2015-06-26 Thread Gary Herron
t same name: >>> _ = 123 >>> print(_) 123 >>> Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Why this list of dictionaries doesn't work?

2015-06-18 Thread Gary Herron
person['name'] = 'jose' person['age'] = 12 people.append(person) Here's where you need to create the second one. person['name'] = 'kacey' person['age'] = 18 people.append(person) for person in people: print( person[&#

Re: So what's happening here?

2015-06-05 Thread Gary Herron
On 06/05/2015 06:39 AM, Todd wrote: On Fri, Jun 5, 2015 at 3:23 PM, Gary Herron <mailto:gary.her...@islandtraining.com>> wrote: On 06/05/2015 06:11 AM, Paul Appleby wrote: On Fri, 05 Jun 2015 14:55:11 +0200, Todd wrote: Numpy arrays are not lists, they

Re: So what's happening here?

2015-06-05 Thread Gary Herron
ort numpy >>> a = numpy.array([1,2,3]) >>> id(a[1]) 28392768 >>> id(a[1]) 28409872 This produces two different view of the same underlying object. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: How to inverse a particle emitter

2015-06-04 Thread Gary Herron
I have no idea what "inverse" has to do with anything), but I won't waste my time doing so. If you take the time to carefully explain what you want, then I'm sure you will find plenty of people here who will take the time to answer you. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiple thread program problem

2015-06-04 Thread Gary Herron
- Traceback (most recent call last): File "./readfile1.py", line 19, in t=thread.start_new_thread(proc(f),()) TypeError: first arg must be callable You should probably also consider using the higher-level threading module rather than the lower level thread module. (Also consider us

Re: Keypress Input

2015-06-03 Thread Gary Herron
se (Tkinter and the curses module) are distributed with Python, so you should already have them installed. Gary Herron Other suggestions seemed to be overkill and confused me to due to my beginner level knowledge and the fact these suggestions have other, more complicated elements to them.

Re: Keypress Input

2015-06-03 Thread Gary Herron
se (Tkinter and the curses module) are distributed with Python, so you should already have them installed. Gary Herron Other suggestions seemed to be overkill and confused me to due to my beginner level knowledge and the fact these suggestions have other, more complicated elements to them.

Re: Please help on this sorted function

2015-06-03 Thread Gary Herron
>>> sorted(d.values()) [123, 456] or the key/value tuples (called items) >>> sorted(d.items()) [('a', 123), ('b', 456)] but each of those attempts to sort could fail on a general dictionary if the individual keys or values are not sortable. Ther

Re: Where is 'palindrome' defined?

2015-05-31 Thread Gary Herron
o line you have above). Then it will be defined, and calling parlindrome('...') will produce a result rather than an error. Gary Herron a '1234_' parlindrome(a) Traceback (most recent call last): File "", line 1, in parlindrome(a) NameError: nam

Re: Returning a custom file object (Python 3)

2015-05-27 Thread Gary Herron
gt;>> __builtins__.open = "whatever" >>> Python3: >>> import builtins >>> builtins.open = "whatever" >>> Of course doing so is like shooting yourself in the foot: Any subsequent pain is your own fault and probably well deserved. G

Re: Array of Functions

2015-05-26 Thread Gary Herron
On 05/26/2015 05:43 PM, richard_riehle wrote: I realized that I mentioned earlier that I found a solution to my original question, but that I never posted an example of the solution. So, here is a simplified example for anyone who is interested. def fArray(fselect, fparm = 1): def A

Re: a more precise distance algorithm

2015-05-25 Thread Gary Herron
ll, but gives an exact zero instead. 0.0 The squaring of the two values in x*x+y*y just makes the addition even more error prone since the squares make large values even larger and small values even smaller. Gary Herron. -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Tec

Re: a more precise distance algorithm

2015-05-25 Thread Gary Herron
on? This is a statement about floating point numeric calculations on a computer,. As such, it does apply to Python which uses the underlying hardware for floating point calculations. Validity is another matter. Where did you find the quote? Gary Herron Any other thoughts? :D My imagini

Re: I do not have access to the right _hierarchy.py source file

2015-05-17 Thread Gary Herron
re likely that that file is correct, and you are somehow misinterpreting its contents, but we can't even begin to guess until you show us its current content. Gary -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Rule of order for dot operators?

2015-05-16 Thread Gary Herron
m the dot operators from left to right or according to a rule of order (i.e., multiplication/division before add/subtract)? Yes, that's correct. Gary Herron Thank you, Chris Reimer -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: use of subprocess module inside generator

2015-05-13 Thread Gary Herron
ith your workaround, since the assignment to stdout is preserved when done outside the function. I hope that helps. Gary Herron if opath is None: for line in stdout.splitlines(): yield line.strip() else: with open(opath) as f: for line in f:

Re: anomaly

2015-05-12 Thread Gary Herron
quot; argument should drive *all* decisions is foolish. And disingenuous. -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: anomaly

2015-05-10 Thread Gary Herron
ing to define a concept called "keywords", I don't think you should allow them to be shadowed by a class definition. Mark Huh? Python has plenty of keywords, and indeed, none of them can be redefined or shadowed.But you would gain nothing (and lose a bit or dynamic-language

Re: anomaly

2015-05-10 Thread Gary Herron
t's still available as __builtins__.int (unless you've also overridden that). -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Try Except Specific Error Messages

2015-05-02 Thread Gary Herron
text = webpage.read().decode("utf8") except URLError as err: print("URLError: " + str(err)) How do I wrap urllib.request with try/except? -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: l = range(int(1E9))

2015-04-30 Thread Gary Herron
9)) >>> l range(0, 100000) -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Best GUI for Python

2015-04-26 Thread Gary Herron
On 04/26/2015 11:07 AM, Cecil Westerhof wrote: Op Sunday 26 Apr 2015 19:12 CEST schreef Gary Herron: On 04/26/2015 09:32 AM, Cecil Westerhof wrote: Op Sunday 26 Apr 2015 17:09 CEST schreef Steven D'Aprano: On Sun, 26 Apr 2015 11:02 pm, Cecil Westerhof wrote: I want to use a GUI for P

Re: Best GUI for Python

2015-04-26 Thread Gary Herron
rthy GUI programming libraries, and each of them is cross platform (as I required to develop on Linux, but deploy occasionally on Windows). -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: xlwt 1.0.0 released!

2015-04-15 Thread Gary Herron
On 04/15/2015 02:51 PM, Chris Withers wrote: Hi All, I'm pleased to announce the release of xlwt 1.0.0. What a curiously incomplete announcement. Could you tell us what xlwt is? I see no hint here. Gary Herron This release contains the following: - Python 3 support. - An in

Re: PIL(LOW) - What am I missing?

2015-03-25 Thread Gary Herron
img = Image.new('1', (1024, 1280), 1) >>> imagedata = list(img.getdata()) >>> print len(imagedata) 1310720 -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Supply condition in function call

2015-03-25 Thread Gary Herron
dition: def cond1(i,j,a,b): return i+j>4 and do test1(..., cond1) and if condition(i,j,a,b): -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Daylight savings time question

2015-03-24 Thread Gary Herron
...but I want numerically 5 hours later, because of Daylight Savings Time') main() Thanks! The pyzt module (which you've imported) has lots to say about this. Look at its procedures "localize' and 'normalize' and all the rest of the pyzt documentation. -- Dr.

Re: Regex Python Help

2015-03-24 Thread Gary Herron
ntax for prints. Python2: print line # This is a statement Python3 print(line) # This is a procedure call -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: id() and is operator

2015-02-22 Thread Gary Herron
tegers. You can experiment with the cutoff on your particular flavor of Python. On mine (Python 3.4.2 (default, Oct 8 2014, 13:08:17) ;[GCC 4.9.1] on linux) it's somewhere between 200 and 300: >>> 201 is 1+200 True >>> 301 is 1+300 False Gary Herron -- Dr. Gary

Re: id() and is operator

2015-02-22 Thread Gary Herron
r[0] = 123 >>> b array([[123, 1], [ 2, 2], [ 3, 3]]) but the Python/numpy objects that wrap portions of that underlying array of ints are all distinct. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Delegation in Python

2015-01-24 Thread Gary Herron
is achieved by doing nothing! Brian That's *not* "doing nothing". And it's not even really "delegation". It's just sub-classing Fraction to add one new method and inherit all other methods. Gary Herron -- Dr. Gary Herron Department of Computer Scie

Re: Delegation in Python

2015-01-24 Thread Gary Herron
ch Fraction >>> >>> Fraction(1,2).is_integer() False >>> Fraction(2,1).is_integer() True Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: MS-DOS Commands

2015-01-11 Thread Gary Herron
ograms in Idle -- A reasonable GUI environment to experiment with Python. It came with your installation of Python. * In the future, questions should be accompanied with information about your version of Python (Python2 or Python3) and the platform you are running it on. (Apparently Windo

Re: surprise - byte in set

2015-01-03 Thread Gary Herron
's way of returning a 1-byte string when indexing a string (instead of returning an element of type character) allows this surprising result. >>> 'abc'[0] 'a' >>> 'abc'[0][0] 'a' >>> 'abc'[0][0][0] 'a' &

Re: problems with Methods in Python 3.4.2

2014-12-18 Thread Gary Herron
m getting this (and so on) : Traceback (most recent call last): File "", line 1, in abs._doc_() AttributeError: 'builtin_function_or_method' object has no attribute '_doc_' What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet, CH-7000 Chur, Switzerland. -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >