Re: importing modules from subdirs

2010-03-11 Thread Gary Herron
from config? You don't import from up the hierarchy. You can put a higher folder on sys.path, and get to it that way. Gary Herron Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Function that knows its argument's variable name

2010-03-14 Thread Gary Herron
ite absolutely "no". Python has lots of introspection capabilities, including, perhaps, getting at and parsing the original code to find the call.But there's nothing direct for what you want. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: File existence check with partial filename

2010-03-14 Thread Gary Herron
import os for filename in os.listdir( "." ): if "HV" in filename.upper(): print( filename ) Cheers & hth., - Alf Or learn the glob module. It allows you to ask for a list of files matching a pattern that can include wildcard characters -- p

Re: affectation in if statement

2010-03-16 Thread Gary Herron
ot;...", "...", ] thing = "" for expr in exps: m = re.match(expr, line) if m: thing = m.group(1) break Thanks! Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode blues in Python3

2010-03-23 Thread Gary Herron
(at least), the "od" program can verify the contents is correct: > od abc -d 000 253 001 Hope that helps. Gary Herron #nntst2.py import sys,codecs mychar=chr(253) print(sys.stdout.encoding) print(mychar) > ./nntst2.py ISO8859-1 ý > ./nntst2.py >nnout2 Traceba

Re: associative array

2010-03-31 Thread Gary Herron
] print s.id, s.FirstName, s.LastName, ... I'd *not* call this a multi-dimension association, but rather just an association between student objects and their ids. Hope that helps, Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425)

Re: no module named exceptions?

2010-04-01 Thread Gary Herron
cense" for more information. >>> print(ImportError) And another example: >>> import builtins >>> print(builtins.ImportError) -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGame migrating to JavaScript

2010-04-02 Thread Gary Herron
? Cheers, -Xav It's a joke -- see http://en.wikipedia.org/wiki/April_Fools%27_Day -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Qt with PyDev

2011-01-04 Thread Gary Herron
-webkit-box-shadow border-radius Other overflow cursor visibility ... Rohit See either of these packages: PyQt: http://qt.nokia.com/products/ PySide: http://www.pyside.org/ Either one should work with PyDev. Gary Herron -- http://mail.python.org/mailman

Re: compute the double square...... :(

2011-01-08 Thread Gary Herron
written as the sum of two squares. For example, 10 can only be written as 32 + 12 (we don't count 12 + 32 as being different). On the other hand, 25 can be written as 52 + 02 or as 42 + 32. Huh? In what number system does 10 = 32 + 12? And how do either 32 or 12 qualify as perfect squares?

Perl Hacker, Python Initiate

2011-02-01 Thread Gary Chambers
@{$cnames{$host}}); print " "; } print "$ip{$host}\n"; } exit 0; Will someone please provide some insight on how to accomplish that task in Python? I am unable to continually (i.e. it stops after displaying a single line) loop through the output while testing for the matches on the two regular expressions. Thank you. -- Gary Chambers -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Gary Chambers
script is doing, or to be shown the Python way of how to accomplish something like that. Surprisingly, there's no mention of regular expressions in the Perl Phrasebook at http://wiki.python.org/moin/PerlPhrasebook. -- Gary Chambers -- http://mail.python.org/mailman/listinfo/python-list

Re: Errors while using strip and remove on a variable.

2011-02-03 Thread Gary Herron
it removes the element from the list in place.In your code, you "print a" and "print c", but you should have done "print b", where you will find the result you expect. Gary Herron ==

Re: pythonrag

2010-04-05 Thread Gary Herron
e memory usage. Python, the language, does not specify which storage option will be used. Python, the C implementation, does both, choosing the second option for small integers (those less 100 last time I checked). Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Ins

Re: Generating a rainbow?

2010-04-08 Thread Gary Herron
call hsv_to_rgb from the standard Python library to convert to RGB. Enjoy! Gary Herron from colorsys import hsv_to_rgb for hue : rgb = hsv_to_rgb(hue, saturation, value) Let 'hue' run from 0 (red) through 2/3 (blue) Hues from 2/3 to 1 get into purples and magentas, which are no

Re: Pythonic list reordering

2010-04-08 Thread Gary Herron
out a one liner? L.sort(key=lambda s: int(s.split('_')[1])) (Which is not necessarily elegant, but it is short.) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Line Intersection

2010-04-09 Thread Gary Herron
e - b*d) If the denominator is zero then the lines are parallel, and there is no (unique) solution. (There are other was of solving the system, but they will all amount to the same arithmetic, and will, of course, produce the same result.) Gary H

Re: Deleting more than one element from a list

2010-04-21 Thread Gary Herron
del z[2], z[3],z[6] to be equivalent to the successive calls del z[2] del z[3] del z[6] Yes, those are equivalent. The reason it fails is that, by the time it gets around to the third delete, there is no longer in index [6] in the list. The element you were thinking of is now at index [4]

Re: NameError: how to get the name?

2010-04-24 Thread Gary Herron
tml#locals> when it is called in function blocks, but not in class blocks. Note: The contents of this dictionary should not be modified; changes may not affect the values of local and free variables used by the interpreter. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: how to select column

2010-04-26 Thread Gary Herron
to do Thanks Do you know how to open a file, and how to read individual lines from it? If so, then you can split a line at the spaces into a list by using fields = line.split() Then print fields[0], fields[3] would do what you ask. Gary Herron -- http://mail.python.org/mailman

Re: CGI python 3 write RAW BINARY

2010-04-28 Thread Gary Herron
Dodo wrote: Help! this is driving me crazy lol I want to print raw binary data to display an image file BUT python3 outputs b'' instead of so the browser can't read the image!! f = open("/some/path/%s" % x, 'rb') print(f.read()) any idea? Dorian Huh??? In what universe does print

Re: Teaching Programming

2010-05-04 Thread Gary Herron
wait a decade or so before discovering Python in the mid 90's, but I never forgot that paper nor lost my eager anticipation waiting for language design to catch up with that idea. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: struct

2010-05-19 Thread Gary Herron
On 05/19/2010 02:53 PM, Back9 wrote: Can anyone explain the difference between f and d in struct unpack? When using them, some data work in either one not both. To me it seems to be same, TIA 'f' is single precision float (32 bits), and 'd' is a double precision f

Re: How to unescape a raw string?

2010-05-19 Thread Gary Herron
the \t as a tab and so on.Various methods of output may or may not convert those characters back into \n and \t and so on. But that's a matter of output not internal storage. So tell us what you're trying to accomplish -- and better also tell us Python2 or Python3? Gary Herr

Re: Import Module

2010-05-20 Thread Gary Herron
plitext(abc.__module__)[0] Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: |help| python 3.12

2010-05-23 Thread Gary Herron
d pickle -- perhaps it is empty, or created incorrectly. But that's where to look. Show us how you created that file. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Error

2010-05-26 Thread Gary Herron
y,z,whatever or import re import mpmath ... re.search ... ... mpmath.whatever ... Gary Herron Trash the search function fro the regular expression module? I'm running Python 2.6.2 on Mac running OS 10.6.3. Thanks! Buff Miner -- Enig Associates, Inc. Suite 500, Bethesda Cresce

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Gary Herron
ult with test to determine which type was returned. Fortunately that's not hard, as your one example shows. 3. Create a test function Empty(Result) which does what you want returning a boolean and write your tests as: if Empty(Result): ... Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: round issue

2010-07-12 Thread Gary Herron
so rounding to -9.9 is correct according to the definition. Do you actually *believe* that -9.9 - -9.85 = 0.050711. Of course you know it's really 0.05. All you've done here is demonstrate the fallible nature of (the last several digits of) floating point arithmetic on

Re: floatref

2010-07-13 Thread Gary Herron
nit__(self): self.sharedFloat = 0 sharedObject = Shared() sharedObject.sharedFloat = 123 Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: floatref

2010-07-13 Thread Gary Herron
On 07/13/2010 03:02 PM, Roald de Vries wrote: Hi Gary, On Jul 13, 2010, at 8:54 PM, Gary Herron wrote: On 07/13/2010 10:26 AM, Roald de Vries wrote: Hi all, I have two objects that should both be able to alter a shared float. So i need something like a mutable float object, or a float

Re: python3: help with subprocess

2010-07-14 Thread Gary Herron
te arrays displays the b'...' to indicate the type of thing begin printed. If you want a string, then you must convert the byte array to a string. For instance: str_out = out.decode('ascii') (And remember: in Python3, strings are always unicode.) Also, using out.

Re: Please Help

2010-07-14 Thread Gary Herron
the 'self' parameter. class Honey(ttk.Label): def __init__(self,master=None,te='Honey'): ttk.Label.__init__(*self*,master,text=te)# self parameter added here self.grid(column=0,row=0) -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Identify the Color of an Image

2010-07-14 Thread Gary Herron
On 07/14/2010 05:37 AM, Monyl wrote: Hi, 1. How can I find the color of an image present the webpage? 2. How to identify the font type of the selected text present in the content of the web page It would be much helpfull, if anyone responds to it ASAP Thanks Mohmyda Please be clearer

Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Gary Herron
the thread but still about python: http://xkcd.com/353/ Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Merging two dictionaries

2010-08-02 Thread Gary Herron
On 08/01/2010 11:11 PM, Douglas Garstang wrote: On Sun, Aug 1, 2010 at 10:58 PM, Gary Herron wrote: On 08/01/2010 10:09 PM, Douglas Garstang wrote: Anyone, I have the two dictionaries below. How can I merge them, such that: 1. The cluster dictionary contains the additional

Re: python interview quuestions

2010-08-06 Thread Gary Herron
On 08/06/2010 10:44 AM, prakash jp wrote: Hi all, I would like to aquint myself with Python Interview questions . I am a Python Scripter, so if u could orient the pointers in the same direction it would be very handy Regards Huh??? -- http://mail.python.org/mailman/listinfo/python-list

Re: Image histogram

2010-08-09 Thread Gary Herron
hen you are on the wrong list, and you'd be better off asking on some image processing news group. If, on the other hand, you have an image processing algorithm in mind, then tell us about the algorithm, and we'll discuss how to implement it in Python. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Image histogram

2010-08-09 Thread Gary Herron
On 08/09/2010 05:02 PM, Paul Rubin wrote: Gary Herron writes: This is a Python newsgroup, not an image processing news group. If you are asking for an algorithm to modify an image I saw it as a question of how to do something using PIL. Seems ok to me. A quote from the OP

Re: Floating numbers

2010-08-12 Thread Gary Herron
thon chooses to display a number.) Python 3: Python3 uses David Gay’s algorithm for chosing how to display floats. Both str(a) and repr(a) produce '34.52' for your example, which is probably just what you want. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing libs on Windows?

2010-08-12 Thread Gary Herron
http://docs.python.org/library/ctypes.html Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Opposite of split

2010-08-15 Thread Gary Herron
le by 'write'. All hints welcome. Regards, Alex van der Spek Strings have a join method for this: '\t'.join(someList) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: errors and exception

2010-08-16 Thread Gary Herron
yfile.txt") for line in f: print line f.close() # This is what the "with" statement guarantees; so now just do it yourself Gary Herron Things that seems to be new in python 2.6 and higher, however reading http://docs.python.org/tutorial/errors.html and this not clear when thi

Re: Get the class name

2009-06-08 Thread Gary Herron
fails But even so, perhaps this will answer your question >>> class Foo: ... pass ... >>> print Foo.__name__ Foo >>> c = Foo >>> print c.__name__ Foo >>> ob = Foo() >>> print ob.__class__.__name__ Foo Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: how to import a name from a module-path?

2009-06-16 Thread Gary Herron
ction. Both are available in Python2.x and Python3.x Gary Herron -- bjorn -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing a python script while it is running

2009-06-16 Thread Gary Herron
Zach Hobesh wrote: Hi everybody, Here's my situation: I have a batch file that calls a python script. This batch file is triggered by an outside application when the application completes a task. The problem is that while the batch file (and pythons script) is running, the application will co

Re: A Bug By Any Other Name ...

2009-07-05 Thread Gary Herron
;Python gotcha". But even so, it's quite arrogant of the OP to flaunt his ignorance of the language by claiming this is a bug and a failure. It shouldn't have been all that hard for him to figure out what was really happening. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie needs help

2009-07-06 Thread Gary Herron
nacim_br...@agilent.com wrote: Dear Python gurus, If I'd like to set dielectric constant for the certain material, is it possible to do such in Python environment? If yes, how to do or what syntax can be used? Also, I'd like to get a simulation result, like voltage, is it possible to get this

Re: way for a function to understand whether it's being run through a OnCreate callback or not

2009-07-10 Thread Gary Herron
time to tell is what you are asking about. You may want to start here: http://www.catb.org/~esr/faqs/smart-questions.html#intro Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Automate rsync w/ authentication

2009-07-11 Thread Gary Duzan
Exec, '-a', '-v', '--dry-run', '-e', rshArg, source, dest] or: rshArgs = [ '-e', '/usr/bin/ssh -i /home/bry/keys/brybackup.key' ] args = [rsyncExec, '-a', '-v', '--dry-run'] + rshArgs + [ source, dest] Gary Duzan Motorola H&NM -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing the private variables content

2009-07-21 Thread Gary Herron
side class. I've got problem with changing some variable value _inside__my_ class, which i'm writing. Not sure this is what you are asking, but a method (which is how I interpret "_inside__my_ class") changes the value by normal assignment like this: class Secret(object):

Re: initializing with empty list as default causes freaky problems

2009-07-27 Thread Gary Herron
l/#why-are-default-values-shared-between-objects Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

supported versions policy?

2009-07-31 Thread Gary Wilson
gh), would someone please point me in the right direction. If there is no posted policy, would someone be kind enough to describe the practiced policy here. I'm looking for is something like this: http://docs.djangoproject.com/en/dev/internals/release-process/#supported-versions Thanks

Re: is it possible to overload operator "^"?

2009-08-08 Thread Gary Herron
dmitrey wrote: hi all, is it possible to overload operator "^"? (AFAIK __pow__ overloads ** instead of ^) Thank you in advance, D. The ^ operator is not an exponentiation, but rather the xor operator. Thus you can override it with the __xor__ method. Beware, if you are thinking of ^ as a

Re: Subclass dynamically

2009-08-08 Thread Gary Herron
rn Derived DerivedClass = Derive(MyBase) foo = DerivedClass(...) I believe that will produce what you were looking for. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: for key, value in dict.() - how to get? (which func)

2009-08-12 Thread Gary Duzan
In article , dmitrey wrote: >hi all, >which method should I use to get iterator over (key, value) pairs for >Python dict, Python v 2.6 and above? dict.iteritems() >>> import sys >>> for (key, value) in sys.modules.iteritems(): print key, value

Re: Python "and" behavior

2009-08-13 Thread Gary Herron
goldtech wrote: Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. ss=1 and "f" ss 'f' ss=0 and "f" ss 0 Python's Boolean operators don't turn arbitrary valu

Re: Splitting on '^' ?

2009-08-14 Thread Gary Herron
['spam\nham\neggs\n'] Am I doing something wrong? Just split on the EOL character: the "\n": re.split('\n', 'spam\nham\neggs\n') ['spam', 'ham', 'eggs', ''] The "^" and "$" characters do not match END-OF-LINE, but rather the END-OF-STRING, which was doing you no good. Gary Herron kynn -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying To Catch Invalid User Input

2009-08-23 Thread Gary Herron
== '1' or style == '2'): or if style == '1' or style == '2': flag = 1 ... or if style in ['1','2']: flag = 1 ... or better yet dispense with flag altogether while style not in ['1','2']: style = raw_input('There was a mistake ... Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: why python got less developers ?

2009-08-27 Thread Gary Herron
Deep_Feelings wrote: python got relatively fewer numbers of developers than other high level languages like .NET , java .. etc why ? Perhaps because we value QUALITY over QUANTITY ... Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Is behavior of += intentional for int?

2009-08-29 Thread Gary Herron
from the two prints happens because Python stores integers 1 and 2 in different locations and the assignments causes a to refer to one and then the other. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Pida 0.6beta3

2009-09-01 Thread Gary Herron
poelzi wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 We are proud to announce the hopfully last beta of Pida 0.6. [1] Wouldn't this be a good time to tell us what Pida does? It was a long time since beta2 and a lot of changes happened since then: == Core Highlights == • multiproc

pickling question

2009-09-02 Thread Gary Robinson
ate a separate module just to contain such a class can be a little annoying. -- Gary Robinson CTO Emergent Music, LLC personal email: gary...@me.com work email: grobin...@flyfi.com Company: http://www.flyfi.com Blog:http://www.garyrobinson.net -- http://mail.python.org/mailman/listinfo/python-list

Re: pickling question

2009-09-02 Thread Gary Robinson
writePickle() # The dumped pickle can be read by any other script. That is, we need to do the pickling in a context where the module name for the class is "pick1" rather than "__main__". The example above allows us to do that without changing __name__ or doing

Re: Question about apply

2009-09-03 Thread Gary Herron
=None): pass kw={'a':1} apply(f1,[],kw) But I read in the doc that apply is deprecated. What is the non-deprecated way of doing this? Many thanks Use the double-star syntax: f1(**kw) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread Gary Herron
ce of "hello." How can this be done? This is asking for more power then regular expressions can support. However, your request reads like an algorithm. Search for an occurrence of "hello" (using the find string method), and search backwards from there for "money" (use rfind string method). Two lines of code in a loop should do it. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows, CreateThread

2009-09-07 Thread Gary Herron
dules. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing objects at runtime.

2009-09-11 Thread Gary Duzan
ely available template engines or other web framework pieces. When you move to different processes and/or machines, the access method can remain the same by varying the port and/or hostname in the URL. Good luck... Gary Duzan

Re: KeyBoard interrupt and Redirection operator

2009-09-15 Thread Gary Herron
on on that, you will have to tell us what shell, and indeed what OS you are using. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] surprised to "++" and "--"

2009-09-25 Thread Gary Herron
followed by a unary operator or two unary operators. ++a, --a, a++b, a--b are all legal and interpreted as +(+a), -(-a), a+(+b), and a-(-b). Could it be from one of these that the OP formed his (mistaken) idea? Gary Herron Facundo Batista wrote: 2009/9/23 Wee Binn : I know that there

Re: what is this kind of string: b'string' ?

2010-09-01 Thread Gary Herron
On 09/01/2010 02:32 PM, Stef Mientki wrote: in winpdb I see strings like this: a = b'string' a 'string' type(a) what's the "b" doing in front of the string ? thanks, Stef Mientki In Python2 the b is meaningless (but allowed for compatibility and future

Re: compare dictionaries

2010-09-07 Thread Gary Herron
the whole word: def ...(): for c in word: if c not in dict2: return False #if any character is not in dict return True # otherwise If you know of generator expressions, and remember that True and False are 1 and 0 respectively, then this works def ...(): return sum(c

Re: compare dictionaries

2010-09-07 Thread Gary Herron
On 09/07/2010 01:26 PM, Baba wrote: On 7 sep, 22:08, Gary Herron wrote: On 09/07/2010 12:46 PM, Baba wrote: word= 'even' dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2} Just go through each letter of word chec

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread Gary Herron
agree.) List comprehension may also be faster, but you'd have to test to know for sure. >>> x=[2,4,3,1] >>> y=[5,9,10,6] >>> z = [a*b for a,b in zip(x,y)] >>> print z [10, 36, 30, 6] Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: toy list processing problem: collect similar terms

2010-09-25 Thread Gary Herron
(4,'q','r'), (5,'s','t')) from collections import OrderedDict r = OrderedDict() for label,*rest in data: r.setdefault(label, []).extend(rest) print(list(r.values())) produces: (['a', 'b'], ['c', 'd', 'i', 'j'], ['e', 'f', 'k', 'l', 'o', 'p'], ['g', 'h'], ['m', 'n', 'q', 'r'], ['s', 't']) -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: partial sums problem

2010-09-28 Thread Gary Herron
ut you cannot put a statement inside an expression. -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine sockets in use by python

2010-09-29 Thread Gary Herron
Does anyone have any suggestions on how to proceed? Thanks in advance It's certain that any answer to this will depend on which operating system you are using. So do tell: What OS? -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-441

Re: Inheritance and name clashes

2010-10-03 Thread Gary Herron
're all consenting adults here". I won't willingly allow someone else to control what I have access to. And I assume that if I do step on something important, I'll figure it out during testing, long before releasing any code. Gary Herron Please give me a hand on th

Re: 2D List

2010-10-11 Thread Gary Herron
integers. a[i] indexes the list to produce an integer a[i].append(...) attempts to append something to an integer -- an operation that makes no sense. -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Gary Herron
.InnerOb.attribute Hope that answers your question. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating PDF file in Python

2010-10-26 Thread Gary Herron
eddable print engine for other applications, including a 'report language' so that users can customize their own reports. * As 'build system' for complex documents with charts, tables and text such as management accounts, statistical reports and scientific papers * from X

Re: is list comprehension necessary?

2010-10-26 Thread Gary Herron
l. Example: i = 5 l = [i**2 for i in range(3)] i 2 That (very small) issue has been fixed in Python3: >>> l = [i**2 for i in range(3)] >>> i Traceback (most recent call last): File "", line 1, in NameError: name 'i' is not defined Gary Herron I m

Re: playful coding problems for 10 year olds

2010-11-01 Thread Gary Herron
statements based on sensor values for object avoidance or light following and such. Great fun (and a bit of Python programming) was had by all. -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

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: 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: 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

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: Set/Get attribute syntatic sugar

2005-06-28 Thread Gary Wilson Jr
Заур Шибзухов wrote: > There is a syntactic sugar for item access in > dictionaries and sequences: > > o[e] = v <-> o.__setitem__(e, v) > o[e] <-> o.__getitem__(e) > > where e is an expression. > > There is no similar way for set/get attribute for objects. > If e is a given name, then > >

Re: Cleaning strings with Regular Expressions

2005-09-08 Thread Gary Wilson Jr
sheffdog wrote: > Using regular expressions, the best I can do so far is using the re.sub > command but it still takes two lines. Can I do this in one line? Or > should I be approaching this differently? All I want to end up with is > the file name "ppbhat.tga". A regular expression to do what you

Re: My First Python Script

2005-09-16 Thread Gary Wilson Jr
Ed Hotchkiss wrote: > def ZeroThrough255(): > x = 0 > while x <= 255: > if len(x) == 1: > mySet = '00' + str(x) > elif len(x) == 2: > mySet = '0' + str(x) > else: > mySet = x >

Re: Python 2.4 removes None data type?

2005-03-04 Thread Gary D. Duzan
== Python 2.4 (#1, Mar 4 2005, 16:55:16) [GCC 3.3.3 (NetBSD nb3 20040520)] on netbsd2 Type "help", "copyright", "credits" or "license" for more information. >>> type(None) >>> None="Fred" SyntaxError: a

Re: Proposal for adding Shallow Threads and a Main Loop to Python

2005-03-17 Thread Gary D. Duzan
r way. (This is useful if the value is provided by some asynchronous mechanism.) This was all done using plain Python 1.5.2 in 80 lines of code, including some blank lines and doc strings. Maybe I'll brush off the code a bit and post it one of these days. Gary Duzan BBN Technologies -- http://mail.python.org/mailman/listinfo/python-list

python-list@python.org Removed

2006-06-14 Thread Gary M. Gordon
We are sorry to see you leaving Gary M. Gordon, LLC! You will not receive news and information about Gary M. Gordon, LLC anymore. -- If you ever want to join Gary M. Gordon, LLC again, simply visit: http://www.garymgordon.com

python-list@python.org Removed

2006-06-15 Thread Gary M. Gordon
We are sorry to see you leaving Gary M. Gordon, LLC! You will not receive news and information about Gary M. Gordon, LLC anymore. -- If you ever want to join Gary M. Gordon, LLC again, simply visit: http://www.garymgordon.com

trying to use swig for the first time

2006-01-23 Thread Gary Wilson Jr
...I have some C code (foo.c and foo.h) that I would like to be able to access using python. I've written my interface file (foo.i) like so: %module foo %{ #include "foo.h" %} %include "foo.h" I then do the following on the command line: $ swig -python foo.i $ gcc -c foo.c foo_wrap.c -I /usr/inc

Re: Python features

2005-05-12 Thread Gary D. Duzan
e like map, but the overall language more closely reflects an imperative style, so we call it an imperative language. Gary Duzan BBN Technologies -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Gary Wilson Jr
Bill Mill wrote: > On 5/19/05, Peter Otten <[EMAIL PROTECTED]> wrote: > >>Bill Mill wrote: >> >> Traceback (most recent call last): File"",line1,in? NameError: name 'sorted' is not defined I think you're probably using 2.4 ?? >>> >>>Yes, sorted() is new in python 2.4 .You coul

Re: Convert from numbers to letters

2005-05-19 Thread Gary Wilson Jr
Gary Wilson Jr wrote: > alpha = 'abcdefghijklmnopqrstuvwxyz'.upper() > pairs = [x for x in alpha] + [''.join((x,y)) for x in alpha for y in alpha] I forget, is string concatenation with '+' just as fast as join() now (because that would look even nicer)

PAM authentication?

2005-05-24 Thread Gary Wilson Jr
I would like my application to be able to authenticate through PAM. Is there any code out there that implements this? All I could find was PyPAM (http://www.pangalactic.org/PyPAM/), which doesn't look like it has been touched in almost 6 years and requires python1.5. -- http://mail.python.org/mai

__init__.py in packages

2005-06-08 Thread Gary Wilson Jr
I'm creating a python package foo. What is intended use for __init__.py files? Well, I found this: http://www.python.org/doc/essays/packages.html >From what I can gather it is for initialization of the package when doing an import, but I would really like to see an example or situation that makes

<    5   6   7   8   9   10   11   >