Re: No newline using printf

2005-09-16 Thread Gary Herron
. Use '%1d' % i to convert your number into a single character string. Use sys.stdout.write to send exactly the characters you want to sys.stdout. Thus: sys.stdout.write('%1d' % i) should do what you want. Dr Gary Herron Digipen Institute of Technology -- http://mail.python.org/mailman/listinfo/python-list

Re: pyFMOD writing a callback function in Python

2005-02-10 Thread Gary Bishop
Check out pySonic, a new FMOD wrapper written with Pyrex. Much more Pythonic. gb -- http://mail.python.org/mailman/listinfo/python-list

Re: pyFMOD writing a callback function in Python

2005-02-19 Thread Gary Bishop
I haven't tried it on Linux but I believe it should work. FMOD works on Linux as does Pyrex. I don't think there is any win32 specific code. Grab the source and try building it. You'll likely have to fool with the libraries and includes in setup.py. gb Marian Aldenh?vel <[EMAIL PROTECTED]> wrot

class factory example needed (long)

2005-02-26 Thread Gary Ruben
ric.sqrt(a) print Numeric.sqrt(b) This would print 3 7 Note that the methods I want to create under program control are all identical in form. In this example they all call the wrapped method with an argument 42 greater than the value of the number. Does anyone have an example where they've do

Re: class factory example needed (long)

2005-02-28 Thread Gary Ruben
ld be able to sort it out from here with the info you provided, thanks again, Gary Rainer Mansfeld wrote: Hi Gary, you want your 'class factory' to change the methods of Numeric, so that they accept foo objects and return foo objects? I've not the slightest idea how to achieve tha

Re: class factory example needed (long)

2005-03-01 Thread Gary Ruben
t would be better to do the same thing with class 'static' methods, if this is possible, so that the methods are created just once. Is this possible? Gary Rainer Mansfeld wrote: If OTOH you want your foo class to have sqrt, arccos, etc. methods without defining them explicitly, I thin

Re: class factory example needed (long)

2005-03-03 Thread Gary Ruben
Thanks Steven and Kent, both of your suggestions look good to me. I'll try both out and pick one. Gary Gary Ruben wrote: OK, I've managed to get this to work with Rainer's method, but I realised it is not the best way to do it, since the methods are being added by the constru

Ruby on Rails or Perl's Maypole..is there a Python equivalent

2005-03-03 Thread Gary Nutbeam
I've noticed that the Perl camp has a very nice web/database environment called Maypole. Ruby has the Rails environment which on the surface seems similar to Maypole. I can't find anything in Python that ties a database to a web interface anywhere near as well as Ruby on Rails or Maypole. I see th

Re: Ruby on Rails or Perl's Maypole..is there a Python equivalent

2005-03-03 Thread Gary Nutbeam
Two out of three on the home made approach I was thinking about. Quixote, Cheetah and SQLObject. Thanks for the link. I'm perusing it now. deelan wrote: > Gary Nutbeam wrote: > (...) >> Does anyone know of something similar to Rails or Maypole in Python? > > you may

Re: Ruby on Rails or Perl's Maypole..is there a Python equivalent

2005-03-03 Thread Gary Nutbeam
I count zpt as xml because page templates can operate in html or xml mode. This is not a troll. It is a lot of work in Zope to create interfaces to relational data for anything more than simple data models. It's a lot less work in Maypole or Rails, but I don't want to go back to writing in Perl,

Re: Ruby on Rails or Perl's Maypole..is there a Python equivalent

2005-03-03 Thread Gary Nutbeam
Thanks for the feedback. I should have been more specific though and mentioned this has done on Linux (client and server). D H wrote: > Gary Nutbeam wrote: > >> I've noticed that the Perl camp has a very nice web/database environment >> called Maypole. Ruby has the Rai

Re: Ruby on Rails or Perl's Maypole..is there a Python equivalent

2005-03-07 Thread Gary Nutbeam
John J. Lee wrote: I know mono runs on linux but I want nothing to do with it unless absolutely necessary. > Gary Nutbeam <[EMAIL PROTECTED]> writes: >> D H wrote: > [...] >> > Check out Castle on Rails for .NET/Mono. It is still in early >> > development, bu

Re: Ruby on Rails or Perl's Maypole..is there a Python equivalent

2005-03-07 Thread Gary Nutbeam
Learning Ruby to use Rails is tempting. Iwan van der Kleyn wrote: > Gary Nutbeam wrote: >> needing to learn Ruby. > > But why wouldn't you just use Rails and learn Ruby in the process? The > "effort" required to learn Ruby pales in comparisson to the advantages

Re: why this error?

2005-03-15 Thread Gary Herron
spencer wrote: Hi, I'm not sure why I can't concatenate dirname() with basename(). Of course you *can* concatenate them, but you're not getting that far. The piece os.path.dirname(os.getcwd) should be os.path.dirname(os.getcwd()) Then it will work without raising an exception, but

Bug 834351 - Mouse wheel crashes program

2004-12-08 Thread Gary Richardson
Has this bug been fixed in 2.3.5 or 2.4? Does it exist in XP systems? #- from Tkinter import * def _onMouseWheel(event): print event root = Tk() root.bind('',_onMouseWheel) root.mainloop() -- http://mail.python.org/mailman/listinfo/python-list

Re: example code sought

2004-12-19 Thread Gary Richardson
"Sean McIlroy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > There's something quite simple I'd like to do, but I'm hampered by > lack of knowledge regarding Tkinter. If someone could help me out with > a snippet of maximally-simple code showing, in general terms, how to > do this,

Re: IPython - problem with using US international keyboard input scheme on W2K

2005-04-15 Thread Gary Bishop
Fernando Perez <[EMAIL PROTECTED]> wrote: > Claudio Grondi wrote: > > Considering what I found in the ipython mailing archives > > and the fact, that after the fix with displaying colors on > > bright backgrounds Gary had no time yet to get in touch > > with me

Python consulting opportunity

2005-04-25 Thread Gary Robinson
ant. If this sounds like an opportunity you'd be interested in, or if you know of someone who might be a match, please let us know. Thanks, Gary -- Gary Robinson CTO Emergent Music, LLC [EMAIL PROTECTED] 207-942-3463 Company: http://www.goombah.com Blog:http://www.garyrobinson.

Re: Please help with this

2013-11-12 Thread Gary Herron
this group, but the question, as you've asked it, is a misuse (or even an *abuse*) of this group. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Gary Herron
will follow. As a side note, these are extremely simple beginner problems, each requiring only a few lines of code. Any programming class that assigned these must have included some lectures on the basics of programming. That's where he should start. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie - Trying to Help a Friend

2013-11-21 Thread Gary Herron
ever, the function itself looks correct otherwise, although you may want to start the sequence off with [n] rather than [] so as to match the suggested output. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie - Trying to Help a Friend

2013-11-21 Thread Gary Herron
ed. Then perhaps we can get to the bottom of this. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Extending the 'function' built-in class

2013-12-01 Thread Gary Herron
you think the function class is, and why are you trying to extend it? Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Eliminate "extra" variable

2013-12-06 Thread Gary Herron
a complete waste of time. In fact, with what you've shown us, you can eliminate the variable dateStrs, and both loops and be no worse off. Perhaps there is more to your code than you've shown to us ... Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: python programming help

2013-12-08 Thread Gary Herron
certainly need a loop (through the dictionary entries), an 'if' conditional to test for the age matching the given age, and a print, Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Script

2013-12-12 Thread Gary Herron
oject", but we don't know what that project is. In fact, I can't even figure out if your trouble is with the script, or with using the script in this unknown project. Also, if you repost, please include the script in the email, not as a pointer to somewhere else. Gary He

Re: Knapsack Problem Without Value

2013-12-12 Thread Gary Herron
ython list. Does your problem have anything to do with Python? * Is this a homework problem? We generally don't solve homework problems here (since you don't learn anything that way), but we are certainly happy to help you learn. Gary Herron -- Dr. Gary Herron Department of Comp

Re: Wrapping around a list in Python.

2013-12-15 Thread Gary Herron
thon is general enough to do what you want, but you'll have to do a much better job telling is what you want. While you are at it, tell us what you've already done, and how it fails to do whatever it is you want. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Pygame vector handling?

2013-12-21 Thread Gary Herron
rk" tells us nothing. What error message, or what incorrect results? * I'm not likely to read your hundred+ lines of code trying to find a bug. Please reduce you question to one or several lines of code, what you expect them to do, and what they are doing that you conside

Re: cascading python executions only if return code is 0

2013-12-22 Thread Gary Herron
On 12/22/2013 10:37 AM, Frank Cui wrote: hey guys, I have a requirement where I need to sequentially execute a bunch of executions, each execution has a return code. the followed executions should only be executed if the return code is 0. is there a cleaner or more pythonic way to do this oth

Re: 2nd Try: Trouble writing lines to file that include line feeds - Newbie

2013-12-23 Thread Gary Herron
the second parameter of the open call. See http://docs.python.org/3/library/functions.html#open for a list of other modes available for the open call. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: How can i return more than one value from a function to more than one variable

2013-12-23 Thread Gary Herron
If you want a function to return several values to several variables, try: def fn(...): # calculate a and b return a,b p,q = fn(...) All these comma-separated sequences are tuples, often written with parentheses as (x,y)=(y,x) and (p,q)=fn(...), but as here, the parentheses

Django filer plugins for django-cms installation

2014-01-01 Thread Gary Roach
ckage not being installed. The settings.py file has been properly annotated. Where should I put the untared files in a typical Debian Wheezy installation. All help will be sincerely appreciated. Gary R. -- https://mail.python.org/mailman/listinfo/python-list

Re: Ifs and assignments

2014-01-02 Thread Gary Herron
nvinced, ... then sorry, that's just the way Python is. Gary Herron handleMatch1(m) elif m = r2.search(w): handleMatch2(m) else: print("No match") If the regular expressions are complex, running them multiple times (once to test, another to capture groups) isn'

Re: Ifs and assignments

2014-01-02 Thread Gary Herron
rry. I shot off my answer before reading the whole post. That's never a good idea. After reading to the end, I rather like your suggestion. It works well in your example, , nicely avoids the C/C++ trap, and has some consistency with other parts of Python. Gary Herron On 02/01/2014

Re: gotta love radio buttons

2014-01-05 Thread Gary Herron
o return an element from the list (indexed by r -- expected to be an integer). Either of these remove the redundancy (but the first is more Pythonic) for r in var: helper = r.get() or for i in range(len(var)): helper = var[i].get() Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: gotta love radio buttons

2014-01-05 Thread Gary Herron
erstanding tracebacks are skills well worth trying to develop. Good luck. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: converting a string to a function parameter

2014-01-05 Thread Gary Herron
t; associated with the same object. That's one object associated with three names in two different namespaces. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: buggy python interpretter or am I missing something here?

2014-01-26 Thread Gary Herron
ould differ slightly, but the advice is the same.) Perh

Re: buggy python interpretter or am I missing something here?

2014-01-26 Thread Gary Herron
On 01/26/2014 10:17 PM, me wrote: On Sun, 26 Jan 2014 21:04:57 -0800, Gary Herron wrote: Never *ever* have a bare except like that. If it gets invoked, you have no idea why. A simple typo like ixd instead of idx or a(idx) instead of a[idx] would raise an exception but give you no idea why

Re: buggy python interpretter or am I missing something here?

2014-01-26 Thread Gary Herron
ksome habit you have there, this jumping to (incorrect) conclusions so quickly. We'd like to get to the bottom of this. (And correct your mis-interpretations while we're at it :-)But we need to see your test *and* the results. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Calculator Problem

2014-02-02 Thread Gary Herron
ke 1 = float(...) don't make sense. It's as if you are trying to change the value of the number one, but that's nonsense. And lines like print('Your Final Result is:', 5 * 6) had better print out 30 (since that is what 5 times 6 is) but that's clearly not what you intended. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: [newbie] copying identical list for a function argument

2014-02-03 Thread Gary Herron
... On the other hand expanding a sequence into individual parameters: fn(*(4*[[1,2,3]])) # note extra * preceding the arg willl be a valid call for def fn(a,b,c,d): ... I'm sure other interpretations of your question are possible. Gary Herron what is the prefered method to real

Re: Calculator Problem

2014-02-03 Thread Gary Herron
On 02/03/2014 10:04 AM, Charlie Winn wrote: On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote: ... Sorry, but in fact you did *not* run this program as you claim. It's full of syntax errors. Any attempt to run it will display syntax errors immediately, and never actuall

Re: kivy

2014-02-04 Thread Gary Herron
might find an answer here, but I think you'd have much better luck if you found a kivy specific newsgroup. Good luck, Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Gary Herron
the time to tell us what line produced that error? That is: cut and paste the *full* traceback instead of hiding useful information when you are asking for help. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries

2014-02-08 Thread Gary Herron
as a key, so b[x] works. If a and b had different keys, then you would get an error: >>> a = {'a':1} >>> b = {'b':2} >>> for x in a: ... print x ... print a[x] ... print b[x] ... a 1 Traceback (most recent call last): File "", line 4, in KeyError: 'a' Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Flag control variable

2014-02-11 Thread Gary Herron
tion is how you ran the program in such a manner that sys.argv[3] has such an odd value. What does your command line look like? You didn't tell us, but that's where the trouble is. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Flag control variable

2014-02-11 Thread Gary Herron
ran the program in such a manner that sys.argv[3] has such an odd value. What does your command line look like? You didn't tell us, but that's where the trouble is. Gary Herron how do you meen "what does your command line look like?" When you run this python script, *h

Re: Flag control variable

2014-02-11 Thread Gary Herron
for someone to respond to on this list. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Flag control variable

2014-02-11 Thread Gary Herron
ed command and runs Python with the rest of the command line arguments is in control of this. If you can find a way to tell your shell to not expand '*' characters, or find a shell that does not do so, then yes, you can dispense with the back-slash. Gary Herron -- https://mail.python.

Re: Flag control variable

2014-02-11 Thread Gary Herron
expect. Multiplying a *string* by an integer is what you are doing. (And it just repeats the string a number of times -- not what you want.) Your code used to have int(...) to convert the string supplied by sys.argv into integers. What happened to them? Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Flag control variable

2014-02-11 Thread Gary Herron
On 02/11/2014 01:18 PM, luke.gee...@gmail.com wrote: Would it be possible to make an int(sys.argv[1]) Not needed and set value 0 ( or in another script 1) For example a = int(sys.argv[1]) b = int(sys.argv[2]) c = int(sys.argv[3]) And I run Python ./script.py 2 3 It just set c automaticly to 0 or

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

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

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: 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: 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: 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: 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: 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: Combining lists to dictionary

2014-11-11 Thread Gary Herron
ses StopIteration. ... 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: Help with Python Multiprocessing

2014-11-13 Thread Gary Herron
aving files named py.py and __init__.py in a directory named Worker1 (and the same for directories Worker2 and Worker3). I think it's more likely that you miss-typed the above code. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Error when trying to open an image

2014-11-16 Thread Gary Herron
ot with *opening* an image, but (if you look at the error message) its with importing PIL. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Brython 3.0.0 relased

2014-11-16 Thread Gary Herron
On 11/16/2014 12:54 AM, Pierre Quentel wrote: Hi, Version 3.0.0 of Brython has been released recently Brython is an implementation of Python 3 running in the browser, with an interface to DOM elements and events. It allows writing web client applications with Python instead of Javascript. Py

Re: Using Python for date calculations

2014-11-21 Thread Gary Herron
hat in Python? The datetime module has lots of capabilities including the several you mention. See https://docs.python.org/2/library/datetime.html Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: help with processing text file

2014-12-04 Thread Gary Herron
. I would use regular expressions. See https://docs.python.org/3/library/re.html Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Question on lambdas

2014-12-08 Thread Gary Herron
nction, and the other the name of the supplied default value (from the outer scope). Any help would be greatly appreciated. TIA, Monte Hope that helps, 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: 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

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: 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: 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: 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: 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: 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: How does python know?

2014-02-12 Thread Gary Herron
nd perhaps version) specific. The process is called "string interning". Google and wikipedia have lots to say about it. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Best practices to overcome python's dynamic data type nature

2014-02-14 Thread Gary Herron
code, the best strategy to find them is a good testing strategy. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Quick Help

2014-02-15 Thread Gary Herron
't ask us to write the program for you.) Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Cannot figure out line of code, also not understanding error

2014-02-20 Thread Gary Herron
it is created is your choice. Assignment is one possibility, but many other operation are also possible: x = Athlete(...) print( Athlete(...) ) Athlete(...)+Athlete(...) # If addition made any sense and was implemented in the class return Athlete(...) ... Gary Herron --

Re: Remove comma from tuples in python.

2014-02-21 Thread Gary Herron
tuple is a Python data structure. It has no commas or parentheses. The *printing* of a Python tuple uses both for it's appearance on the output, but the tuple itself has no such thing. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Can global variable be passed into Python function?

2014-02-21 Thread Gary Herron
prints the global v v = 456 # Assigns to the global v. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange behavior with sort()

2014-02-26 Thread Gary Herron
On 02/26/2014 10:24 PM, ast wrote: Hello box is a list of 3 integer items If I write: box.sort() if box == [1, 2, 3]: the program works as expected. But if I write: if box.sort() == [1, 2, 3]: Most such questions can be answered by printing out the values in question and observi

Re: image processing in python and opencv

2014-03-09 Thread Gary Herron
displaying images? (All three seem to be implied above.) Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Making Labels from python

2014-03-09 Thread Gary Herron
for you. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: running python 2 vs 3

2014-03-20 Thread Gary Herron
look like any other installed program. If you need to be in a specific directory when you run it, then perhaps you should consider a bit of a rewrite to remove this constraint. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Memory error

2014-03-24 Thread Gary Herron
#x27;hs'] hs_2050s=swh_2050s.variables['hs'] This is not really a Python question. It's a question about netCDF (whatever that may be), or perhaps it's interface to Python python-netCD4. You may get an answer here, but you are far more likely to get one quickly and

Re: writing reading from a csv or txt file

2014-03-30 Thread Gary Herron
n. or book, textbook. How is this a Python question? There is a standard module included with Python for reading CSV files. Would you like to know how to use that? You can find documentation on it here: http://docs.python.org/3/library/csv.html Gary Herron -- https://mail.python.org/ma

Re: If statement issue driving me nuts

2014-04-05 Thread Gary Herron
d you do to try to get it to work? What did you get instead? If there was a traceback, please include it in an email. While you're at it, please also tell us what version of Python, and on what hardware you are running -- just in case that matters. Gary Herron -- https://mail.pyth

Re: Mutable objects inside tuples - good or bad?

2014-04-06 Thread Gary Herron
jects, and (as always) without regard to the specifics or contents of those two objects. Gary Herron 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

Re: the logical operation confused me

2014-04-10 Thread Gary Herron
t; output "not ok" ? You are probably confusing yourself with the string "not ok". That string, and any other non-empty string is considered true >>> bool("not ok") True >>> bool("ok") True perhaps you meant >>> n

Re: Pass variable by reference

2014-05-05 Thread Gary Herron
t mentions "mutable" here -- that's something very different, And your question then goes on to end on an even more confused note with "I want to nuke ..." which seems to have nothing to do with passing values anywhere? Sorry to be of so little help, Gary Herron For e

Re: How can this assert() ever trigger?

2014-05-10 Thread Gary Herron
e smallest value representable by a float, at which point it becomes zero. To see this clearly, try this Python code: >>> a = 1.0 >>> while a > 0: ... a = a*1.0e-50 ... print(a) ... 1e-50 1e-100 1e-150 1e-200 1e-250 1e-300 0.0 Gary Herron Any hints appreciated. Groetjes Albert -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Gary Herron
Which is a relic of the even older punch cards which contained one line of (up to) 80 characters. Gary Herron 80 character was the hard limit. The soft limit for readability is 60..65 characters. Think about it. Just that a language accepts #define MASK_SEPIA_INTERNAL_BLEEDING_WASHINGTON_DC_BLACK

Re: IndexError: pop from empty list

2014-05-15 Thread Gary Herron
, in _parse_samples digital_data_set = (sample_bytes.pop(0) << 8 | sample_bytes.pop(0)) IndexError: pop from empty list The error means that sample_bytes is an empty list so calling pop is an error. Or were you asking something deeper, like *why* sample_bytes is an empty list? Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Can't figure out 'instance has no attribute' error

2014-05-17 Thread Gary Herron
dNode and addEdge should all be at the same indentation level. Instead, you have the later two defined *inside* the __init__. Gary Herron File RW1: class PHY_NETWORK: def __init__(self, nodes, edges): self.nodes = nodes self.edges = edges def addNode(self,

Re: Python and Math

2014-05-17 Thread Gary Herron
ready mentioned, I'll add Sage: www.sagemath.org/index.html which presents a consistent Python interface to nearly 100 OpenSource mathematical packages containing symbolic manipulation of all sorts of algebra, calculus, linear algebra, plotting, rings and groups, and much *much* more. G

Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread Gary Herron
tually does. Why you think it's wrong. You should also tell us what version of Python you are using, and on what platform you are running it. Moreover, please reduce down to a bare minimum, the amount of code needed to show us the part that fails. Gary Herron -- https://mail.python.

Re: Yet another "simple" headscratcher

2014-05-30 Thread Gary Herron
small example that demonstrates problem: >>> row = [0,0,0,0] >>> data = [] >>> data.append(row) >>> data.append(row) >>> data[0][0] = 99 >>> data [[99, 0, 0, 0], [99, 0, 0, 0]] Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

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