Re: Help needed with Windows Service in Python

2010-09-03 Thread Ian
On 02/09/2010 20:55, Edward Kozlowski wrote: On Sep 2, 2:38 pm, Ian wrote: On 02/09/2010 20:06, Edward Kozlowski wrote: On Sep 2, 10:22 am, Ian Hobsonwrote: Hi All, I am attempting to create a Windows Service in Python. I have the framework (from Mark Hammond and Andy Robinason&#

Re: redirecting stdout and stderr for a windows service

2010-09-06 Thread Ian
On 06/09/2010 15:29, Ian Hobson wrote: Hi all, Forget this. The problem is that it is a Windows Service, so it is not initialised in the normal way. PythonService.exe loads other code (named __main__) that loads the service proper, so the if test was never true! Regards Ian -- http

Re: Help needed - function apparently global cannot be called.

2010-09-07 Thread Ian
Hi Bruno, Thanks for your quick response. I still do not understand. On 07/09/2010 11:50, Bruno Desthuilliers wrote: Ian Hobson a écrit : Hi all you experts, This has me beat. Has anyone any ideas about what might be going wrong? This is code from within a windows service (hence no print

Re: Help needed - function apparently global cannot be called.

2010-09-07 Thread Ian
Hi Rami, Stefan, Bruno. First a big thanks for your replies. On 07/09/2010 20:54, Rami Chowdhury wrote: Hi Ian, I think I see where you're going wrong -- this bit me too when I was learning Python, having come from PHP. Unlike PHP, when you import a module in Python it does *not* in

Re: business date and calendar libraries?

2010-09-16 Thread Ian
ly, Christmas holiday is the first week-day on or after 25th Dec. Boxing Day/St Stephens holiday is the week-day after the Christmas holiday date above. Hope this helps. Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: How to make a web services in python ???

2010-09-20 Thread Ian
pid GUI Programming with Python and Qt" by Mark Summerfield. It shows you how to handle sockets, threading , and the locking of shared data constructs. Regards Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Encoding problem - or bug in couchdb-0.8-py2.7.egg??

2010-09-20 Thread Ian
Thanks Diez, Removing, rebooting and installing the latest version solved the problem. :) Your google-foo is better than mine. Google had not turned that up for me. Thanks again Regards Ian On 20/09/2010 17:00, Diez B. Roggisch wrote: Ian Hobson writes: Hi all, I have hit a

Re: sequence multiplied by -1

2010-09-26 Thread Ian
rotten" by php. Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: if the else short form

2010-10-02 Thread Ian
On Oct 1, 11:19 pm, Paul Rubin wrote: > Steven D'Aprano writes: > > Incorrect. bools *are* ints in Python, beyond any doubt. > >     Python 2.6.2 (r262:71600, Jun  4 2010, 18:28:58) >     >>> type(3)==type(True) >     False >>> -1 < False < True < 2 True >>> True + True 2 >>> hex(True) '0x1'

Re: That interesting notation used to describe how long a loop will take.

2010-10-04 Thread Ian
the execution time varies with the square > of the number of iterations, or items being sorted > etc.. > > I want to google this, but I'm not sure what > keywords to use.  Is there a wikipedia article about this > subject?  I imagine that it has a concise name. "Big O nota

Re: [Python-Dev] Inclusive Range

2010-10-08 Thread Ian
that follows ''. No, that would be '\0'. Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2 script slowing and stopping

2010-10-11 Thread Ian
.py file. In debug mode, Django records every query that is executed in django.db.connection.queries. To fix it, either disable debug mode or just have your script go in and clear out that list from time to time. HTH, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Ian
hich OSes would those be? It doesn't work in Linux: $ python -c "print 'print \'hello\0world\''" > test.py $ cat test.py print 'helloworld' $ python test.py File "test.py", line 1 print 'hello ^ SyntaxError: EOL while scanning string literal Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: choose value from custom distribution

2010-10-19 Thread Ian
d the index by binary search: import bisect import random data = [0, 0, 10, 20, 5] cumsum = [] for x in data: cumsum.append(cumsum[-1] + x if cumsum else x) virtual_index = random.randrange(cumsum[-1]) actual_index = bisect.bisect_right(cumsum, virtual_index) HTH, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: embarrassing class question

2010-10-21 Thread Ian
On Oct 21, 12:53 pm, Brendan wrote: > So it must never make sense to put subclasses in separate modules? It doesn't matter to Python whether the subclass is in the same module or imported. Do it whichever way makes the most sense to you from a code organization perspective. -- http://mail.pytho

Re: Has Next in Python Iterators

2010-10-25 Thread Ian
foo_item != 2: foo_list_iter = next_foo_list_iter break But in practice I think the best solution is to create an explicit iterator wrapper that implements hasnext() and use it as needed, as others in this thread have suggested. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Inconsistent results from int(floatNumber)

2010-10-25 Thread Ian
x in xrange(5): ... i += 0.1 ... z = i * 10.0 ... print ... print z ... print repr(z) ... print int(z) ... -499.0 -499.0 -499 -498.0 -498.0 -498 -497.0 -496.94 -496 -496.0 -495.94 -495 -495.0 -494.999994 -494 Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Inconsistent results from int(floatNumber)

2010-10-25 Thread Ian
; System.out.println(z); System.out.println((int) z); } } } $ javac Test.java $ java Test -499.0 -499 -498.0 -498 -496.94 -496 -495.94 -495 -494.94 -494 Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-10-26 Thread Ian
spam, spam, spam, python and spam in my inbox. :) Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: serial I/O install fail -- DLL not found

2010-11-01 Thread Ian
r file that the isapi package includes when creating an executable with py2exe. It doesn't make any sense for it to be found in this location, and all it's succeeding in doing is obscuring the real win32file import, which should be a dll at E: \Python27\lib\site-packages\win32\win32fil

Re: Compare source code

2010-11-01 Thread Ian
icance to something (whitespace) that many tools are inclined > to treat as insignificant. Beyond Compare at least is smart enough to know that leading whitespace is significant in .py files, using the default configuration. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: functions, list, default parameters

2010-11-02 Thread Ian
classes are fundamentally mutable. Disallowing mutable default arguments would mean disallowing instances of user-defined classes entirely. That would be excessive and would violate Python's general rule of staying out of the programmer's way. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation too difficult for beginners

2010-11-02 Thread Ian
a great little language, and deserves better. Without an on-ramp, noobs will struggle to get on the freeway. And yet, enough will get on, that these pleas for better documentation can be ignored by those who know and could do something about it. Regards Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation too difficult for beginners

2010-11-02 Thread Ian
actually have anything to do with the id() function. They're just what happens any time an unbound variable name is evaluated, in any context. The exact same thing could be said about any Python function in existence that takes at least one argument. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-05 Thread Ian
rs which also format text. Eclipse does that. Visual Studio does that. As for Python, I hear that Eric IDE has a plugin to do that, although I haven't tested it myself. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Final state of underlying sequence in islice

2010-11-05 Thread Ian
On Nov 5, 2:51 pm, Raymond Hettinger wrote: > You may have missed my point.  I wrote the tools, the docs, and the > tests. > If you interpret a "promise" in text, I can assure you it was not > intended.  The behavior *is* undefined because I never defined it. > I'm happy to clarify the docs to mak

Re: Split iterator into multiple streams

2010-11-06 Thread Ian
(itertools.tee(iterable, n)): iterators.append(itertools.imap(operator.itemgetter(i), iterator)) return tuple(iterators) >>> map(list, split(data, 3)) [[1, 4, 7], [2, 5, 8], [3, 6, 9]] Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Popen Question

2010-11-08 Thread Ian
itional parameters to the script as usual (only > starting with $0 rather than $1, for some unknown reason). Perhaps this example better demonstrates what is going on: >>> p = subprocess.Popen(['echo one $0 three $1 five', 'two', 'four'], ...

Re: Popen Question

2010-11-08 Thread Ian
about whether this approach is correct or not, but it's what the shell does, and that's not likely to change. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: DTD Parsing

2010-11-10 Thread Ian
y settings like: SESSION_TIMEOUT = 900 or: DOMAIN_OBJECTS = [ ObjectType1( option1 = 'foo', option2 = 'bar', ), ObjectType2( option1 = 'foo', option2 = 'baz', option3 = 42, ), ... ] Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: How to read the Python tutorial?

2010-11-10 Thread Ian
t; as it is in C++. Because Python does not do implicit attribute lookup, it is always clear from context whether a name refers to an attribute or not, and so the "m" is superfluous. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumeration of strings and export of the constants

2010-11-10 Thread Ian
s evil. Yes, by putting the names to be imported into their own container as I've done above, instead of polluting the class dictionary with them. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread Ian
the number of reads and writes that you have to do. After the first readline, you can do something like "input = sys.stdin.read().strip().split('\n')" to pull everything into a single list, then iterate over the list instead of stdin. For output, append all your results to a l

Re: How to test if a module exists?

2010-11-11 Thread Ian
On Nov 11, 1:26 pm, Lawrence D'Oliveiro wrote: > In message , Tim Chase > wrote: > > > Amusingly, as others have noted, you replied with an unobfuscated > > email address. > > This > > would seem to be an independent, true r

Re: Sending changed parameters into nested generators

2010-11-12 Thread Ian
to manage in the way that you are doing. You can view the docs on the pythonic approach to coroutines at: http://docs.python.org/whatsnew/2.5.html#pep-342-new-generator-features Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Collision of Two Rect

2013-05-06 Thread Ian Kelly
On May 6, 2013 10:39 AM, "Joshua Landau" wrote: > > On 4 May 2013 00:42, Ian Kelly wrote: >> >> The other thing that is suspicious about the code you posted is that >> it has two different notions of the ball's position that are not >> necessarily in

Re: Style question -- plural of class name?

2013-05-08 Thread Ian Kelly
On Wed, May 8, 2013 at 2:37 PM, John Downs wrote: > On Wed, May 8, 2013 at 4:20 PM, Roy Smith wrote: >> >> FooEntry is a class. How would you describe a list of these in a >> docstring? >> >> "A list of FooEntries" >> >> "A list of FooEntrys" >> >> "A list of FooEntry's" >> >> "A list of FooEntr

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Ian Kelly
On Wed, May 8, 2013 at 8:35 PM, Mark Janssen wrote: > Okay, to anyone who might be listening, I found the core of the problem. What "problem" are you referring to? You've been posting on this topic for going on two months now, and I still have no idea of what the point of it all is. I recall so

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Ian Kelly
On Thu, May 9, 2013 at 3:51 PM, Mark Janssen wrote: > On Thu, May 9, 2013 at 10:33 AM, Ian Kelly wrote: >> On Wed, May 8, 2013 at 8:35 PM, Mark Janssen >> wrote: >>> Okay, to anyone who might be listening, I found the core of the problem. >> >> What "pr

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-12 Thread Ian Kelly
On Sun, May 12, 2013 at 5:23 PM, Mr. Joe wrote: > I seem to stumble upon a situation where "!=" operator misbehaves in > python2.x. Not sure if it's my misunderstanding or a bug in python > implementation. Here's a demo code to reproduce the behavior - The != operator is implemented by the __ne__

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Ian Kelly
On Mon, May 13, 2013 at 5:27 PM, Andrew Berg wrote: > On 2013.05.13 17:53, Mark Lawrence wrote: >> I much prefer the alternative <> for != but some silly people insisted >> that this be removed from Python3. > It's not removed from Python 3, though: > > Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 20

Re: Message passing syntax for objects | OOPv2

2013-05-15 Thread Ian Kelly
On Sun, May 12, 2013 at 10:48 PM, Mark Janssen wrote: > You're very right. But that is what has made it sort of a test-bed > for internet collaboration. The project I'm working on is aimed to > solve that problem and take the Wiki philosophy to its next or even > ultimate level. By adding a "n

Re: Fractal

2013-05-15 Thread Ian Kelly
On Mon, May 13, 2013 at 9:41 AM, Sharon COUKA wrote: > Hello, I'm new to python and i have to make a Mandelbrot fractal image for > school but I don't know how to zoom in my image. > Thank you for helping me. Is this a GUI application or does it just write the image to a file? What GUI / image l

Re: Python 2.7.x - problem with obejct.__init__() not accepting *args and **kwargs

2013-05-15 Thread Ian Kelly
On Wed, May 15, 2013 at 6:16 AM, Oscar Benjamin wrote: > I don't generally use super() but I did see some advice about it in > this article: > https://fuhm.net/super-harmful/ > > From the conclusion: > "Never use positional arguments in __init__ or __new__. Always use > keyword args, and always ca

Re: Question re: objects and square grids

2013-05-15 Thread Ian Kelly
On Wed, May 15, 2013 at 10:56 AM, Andrew Bradley wrote: > Hello everyone. > > I am having a good time programming with Python 3.3 and Pygame. Pygame seems > like the perfect platform for the kind of simple games that I want to make. > > What I have currently programmed is basically a drawn rectang

Re: Python 2.7.x - problem with obejct.__init__() not accepting *args and **kwargs

2013-05-15 Thread Ian Kelly
On Wed, May 15, 2013 at 8:06 PM, Steven D'Aprano wrote: > On Wed, 15 May 2013 13:16:09 +0100, Oscar Benjamin wrote: > > >> I don't generally use super() > > Then you should, especially in Python 3. > > If you're not using super in single-inheritance classes, then you're > merely making your own co

Re: Fractal

2013-05-16 Thread Ian Kelly
On Thu, May 16, 2013 at 5:04 AM, Sharon COUKA wrote: > I have to write the script, and i have one but the zoom does not work That doesn't answer my question. Perhaps if you would share with us what you already have, then we could point out what you need to do and where to get your "zoom" working

Re: Fractal

2013-05-16 Thread Ian Kelly
On Thu, May 16, 2013 at 10:55 AM, Sharon COUKA wrote: > # Register events > c.bind('i', zoom) > c.bind('i', unzoom) > c.bind('i', mouseMove) I'm not an expert at Tkinter so maybe one of the other residents can help you better with that. The code above looks wrong to me, though. As far as I know,

Re: Non-identifiers in dictionary keys for **expression syntax

2013-05-23 Thread Ian Kelly
On Thu, May 23, 2013 at 12:52 PM, Matthew Gilson wrote: > Using Cpython, we can do the following: > > def func(**kwargs): > print kwargs > > d = {'foo bar baz':3} > > So that might lead us to believe that the keys of the mapping do not need to > be valid identifiers. However,

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 12:13 PM, Peter Brooks wrote: > No, on a multi-core machine it's normal. The machine shows python > running multiple threads - and the number of threads change as the > program runs. Perhaps the OS/X implementation of python does allow > concurrency when others don't. It ce

Re: Future standard GUI library

2013-05-26 Thread Ian Foote
Linux, Windows, MaxOSX, Android and IOS. Regards, Ian F -- http://mail.python.org/mailman/listinfo/python-list

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 10:36 PM, Peter Brooks wrote: > This makes complete sense - any atomic action should be atomic, so two > threads can't be doing it at the same time. They can be doing anything > else though. > > If two threads create a new object at the same time, for example, > there's pot

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 4:16 PM, Chris Angelico wrote: > On Mon, May 27, 2013 at 5:35 AM, Ian Kelly wrote: >> I'm pretty sure that CPython uses the GIL regardless of platform. And >> yes you can have multiple OS-level threads, but because of the GIL >> only one wil

Re: Solving the problem of mutual recursion

2013-05-27 Thread Ian Kelly
On Mon, May 27, 2013 at 12:19 AM, Ian Kelly wrote: > 7) Since the program being tested does basically nothing except start > and exit threads, the extra 40% probably represents the overhead of > all that starting and stopping, which would be done outside the GIL. To test this, I trie

Re: String object has no attribute "append"

2013-05-28 Thread Ian Kelly
On Tue, May 28, 2013 at 12:25 PM, Matt Graves wrote: > I receive this error while toying around with Functions... > > def pulldata(speclist,speccolumn): > with open('profiles.csv', 'r') as f: > reader = csv.reader(f) > for column in reader: > (specl

Re: String object has no attribute "append"

2013-05-28 Thread Ian Kelly
On Tue, May 28, 2013 at 12:41 PM, Ian Kelly wrote: > On Tue, May 28, 2013 at 12:25 PM, Matt Graves wrote: >> I receive this error while toying around with Functions... >> >> def pulldata(speclist,speccolumn): >> with open('profiles.csv', 'r'

Re: Short-circuit Logic

2013-05-29 Thread Ian Kelly
On Wed, May 29, 2013 at 8:33 AM, rusi wrote: > 0.0 == 0.0 implies 5.4 == 5.4 > is not a true statement is what (I think) Steven is saying. > 0 (or if you prefer 0.0) is special and is treated specially. It has nothing to do with 0 being special. A floating point number will always equal itself (

Re: Getting a callable for any value?

2013-05-29 Thread Ian Kelly
On Wed, May 29, 2013 at 11:46 AM, Croepha wrote: > Is there anything like this in the standard library? > > class AnyFactory(object): > def __init__(self, anything): > self.product = anything > def __call__(self): > return self.product > def __repr__(self): > return "%s.%s(%r)" % (self.__class__._

Re: Getting a callable for any value?

2013-05-29 Thread Ian Kelly
On Wed, May 29, 2013 at 12:19 PM, Fábio Santos wrote: > Are you sure you don't want to use a lambda expression? They are pretty > pythonic. > > none_factory = lambda: None > defaultdict_none_factory = lambda: defaultdict(none_factory) > > collections.defaultdict(defaultdict_none_factory) Gah. If

Re: python b'...' notation

2013-05-29 Thread Ian Kelly
On Wed, May 29, 2013 at 12:33 PM, alcyon wrote: > This notation displays hex values except when they are 'printable', in which > case it displays that printable character. How do I get it to force hex for > all bytes? Thanks, Steve Is this what you want? >>> ''.join('%02x' % x for x in b'hel

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ian Kelly
On Wed, May 29, 2013 at 8:49 PM, rusi wrote: > On May 30, 6:14 am, Ma Xiaojun wrote: >> What interest me is a one liner: >> print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in >> range(1,10)]) for j in range(1,10)]) > > Ha,Ha! The join method is one of the (for me) ugly features of python

Re: How to get an integer from a sequence of bytes

2013-05-30 Thread Ian Kelly
On Thu, May 30, 2013 at 12:26 PM, Mok-Kong Shen wrote: > Am 27.05.2013 17:30, schrieb Ned Batchelder: >> >> On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: >>> >>> From an int one can use to_bytes to get its individual bytes, >>> but how can one reconstruct the int from the sequence of bytes? >>> >> T

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ian Kelly
On Thu, May 30, 2013 at 12:44 PM, Chris Angelico wrote: > On Fri, May 31, 2013 at 4:36 AM, Ian Kelly wrote: >> I don't object to changing the join method (one of the more >> shoe-horned string methods) back into a function, but to my eyes >> you've got the ar

Re: Short-circuit Logic

2013-05-30 Thread Ian Kelly
On Thu, May 30, 2013 at 1:30 PM, Neil Cerutti wrote: > On 2013-05-30, Chris Angelico wrote: >> On Thu, May 30, 2013 at 3:10 PM, Steven D'Aprano >> wrote: >>> # Wrong, don't do this! >>> x = 0.1 >>> while x != 17.3: >>> print(x) >>> x += 0.1 >> >> Actually, I wouldn't do that with integers

Re: How clean/elegant is Python's syntax?

2013-05-31 Thread Ian Kelly
On Thu, May 30, 2013 at 1:38 PM, MRAB wrote: > And additional argument (pun not intended) for putting sep second is > that you can give it a default value: > >def join(iterable, sep=""): return sep.join(iterable) One argument against the default is that it is specific to the str type. If you

Re: How clean/elegant is Python's syntax?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 4:16 AM, Fábio Santos wrote: > On Fri, May 31, 2013 at 10:08 AM, Alister wrote: >> I think that is the winning argument. >> Next question is what should be the default ("", " " or',')? > > join, comma_join, whitejoin, linejoin variants, with different defaults? The more s

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 9:41 AM, Νικόλαος Κούρας wrote: > Τη Παρασκευή, 31 Μαΐου 2013 6:37:06 μ.μ. UTC+3, ο χρήστης Fábio Santos έγραψε: > >> Check if python3 and python3.3 aren't the same. Run them and look at the >> "intro" > lines. > > root@nikos [~]# python -V > Python 2.6.6 > root@nikos [~]#

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 11:10 AM, Νικόλαος Κούρας wrote: > root@nikos [~]# ls -al /usr/bin/python* > -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python* > lrwxrwxrwx 1 root root6 Apr 5 20:34 /usr/bin/python2 -> python* > -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python2.6* > -rw

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 11:16 AM, Νικόλαος Κούρας wrote: > root@nikos [~]# which python > /usr/bin/python > root@nikos [~]# which python2 > /usr/bin/python2 > root@nikos [~]# which python3 > /root/.local/lib/python2.7/bin/python3 > root@nikos [~]# which python3.3 > /root/.local/lib/python2.7/bin/p

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 11:42 AM, Νικόλαος Κούρας wrote: > OMG i gave by mistake > > root@nikos [/]# rm -rf /root/.local/ > > did i screwed up my remote VPS which i host 10 peoples webpages? I don't know, is that where you were keeping the data? The website still appears to be working, as best I

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 5:30 PM, Νικόλαος Κούρας wrote: > Indeed i have comiled python 2.7 and 3.3 form source after wget and > ./configure an make install > > but i belive somehting is mixed up althouh python works ok. > > root@nikos [/opt/python3/bin]# ls -al > ... > root@nikos [/opt/python3/bi

Re: PyWart: The problem with "print"

2013-06-03 Thread Ian Kelly
On Sun, Jun 2, 2013 at 6:16 PM, Jason Swails wrote: > I'm actually with RR in terms of eliminating the overhead involved with > 'dead' function calls, since there are instances when optimizing in Python > is desirable. I actually recently adjusted one of my own scripts to > eliminate branching an

Re: Too many python installations. Should i remove them all and install the latest?

2013-06-03 Thread Ian Kelly
On May 31, 2013 6:27 PM, "Chris Angelico" wrote: > Yeah. I know that particular one because I have l aliased to ls -CF > (aka --columns --classify), mainly because it came that way as a > commented-out entry in my first Debian. Have since become quite > accustomed to it; to me, 'l' means 'look' (I

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-04 Thread Ian Kelly
On Tue, Jun 4, 2013 at 9:44 AM, Rick Johnson wrote: > It is my firm belief that truth testing a value that is not > a Boolean should raise an exception. If you want to convert > a type to Boolean then pass it to the bool function: > > lst = [1,2,3] > if bool(lst): > do_something >

Re: Do you consider Python a 4GL? Why (not)?

2013-06-05 Thread Ian Kelly
On Tue, Jun 4, 2013 at 6:38 PM, Carlos Nepomuceno wrote: > I don't have an opinion yet, but I've found contradictory evidence from many > sources, such as: > > "A domain-specific language (DSL) is a type of programming language or > specification language in software development and domain enginee

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-05 Thread Ian Kelly
On Wed, Jun 5, 2013 at 10:25 PM, Russ P. wrote: > I recall reading a few years ago that Guido was thinking about adding > optional type annotations. I don't know if that went anywhere or not, but I > thought it was a good idea. Eventually I got tired of waiting, and I realized > that I just wan

Re: Python Game Development?

2013-06-07 Thread Ian Kelly
On Fri, Jun 7, 2013 at 9:53 AM, wrote: > I was planning on making a small 2D game in Python. Are there any libraries > for this? I know of: > > • Pygame - As far as I know it's dead and has been for almost a year > • PyOgre - Linux and Windows only(I do have those, but I want multi-platform) > •

Re: Python Game Development?

2013-06-07 Thread Ian Kelly
On Fri, Jun 7, 2013 at 10:28 AM, Eam onn wrote: > Do you know of any tutorial for PyGame? Preferably a video tutorial but any > tutorial at all is fine! I can't seem to find any, even on pygame.org!!! I'd start here: http://www.pygame.org/wiki/tutorials -- http://mail.python.org/mailman/listinf

Re: Python Game Development?

2013-06-07 Thread Ian Kelly
On Fri, Jun 7, 2013 at 10:35 AM, Ian Kelly wrote: > On Fri, Jun 7, 2013 at 10:28 AM, Eam onn wrote: >> Do you know of any tutorial for PyGame? Preferably a video tutorial but any >> tutorial at all is fine! I can't seem to find any, even on pygame.org!!! >

Re: Python Game Development?

2013-06-07 Thread Ian Kelly
On Fri, Jun 7, 2013 at 11:53 AM, Eam onn wrote: > Pygame isn't too good. You still need a lot of other libraries from what I > understand(like for physics). Is there any alternative for 2D? I don't know of any Python libraries that provide both a rendering engine and a physics engine. I'm not s

Re: Python Game Development?

2013-06-07 Thread Ian Foote
ne in Python for fun. I also understand that Python isn't exactly the *BEST* choice programming a game, but I have heard it is possible. Tell me if it's true. Thanks! You might also wish to consider Kivy (kivy.org). Regards, Ian F -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Ian Kelly
amiliar with Python who is reading the code would be surprised by the way the model updates work. A third possibility of course would be to just not try to do case B. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 9:47 AM, Eam onn wrote: > Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he > didn't finish his. MetalX100 did a VERY good tutorial. I've been having > trouble with some player movement because he isn't moving smoothly, he jumps. > If I add 5 pi

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 10:56 AM, Eam onn wrote: > Also, is there a specific forum for PyGame or is here fine? Go to pygame.org and click the link "Help (irc, lists)" in the navigation menu. I could give you the direct link, but I want to point out that this stuff is readily available on the pyg

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 10:57 AM, Eam onn wrote: > On Tuesday, June 11, 2013 5:31:22 PM UTC+1, Mark Lawrence wrote: >> Try typing "pygame tutorial" into your favourite search and see what >> comes back, you might be pleasantly surprised. > > Typed it in several times over the past 2 years and noth

Re: Cutting a deck of cards

2013-06-12 Thread Ian Kelly
On Sun, May 26, 2013 at 12:16 PM, Carlos Nepomuceno wrote: > list(range(13 * 4 * decks)) == range(13 * 4 * decks) Not in Python 3. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cutting a deck of cards

2013-06-12 Thread Ian Kelly
On Sun, May 26, 2013 at 12:17 PM, RVic wrote: > Ah, brilliant -- yes, this is so much more elegant in Python: > > #now cut the cards > x = random.randrange(2,range(13 * 4 * decks)) > cards = cards[x:]+cards[:x] Or if for some reason you want to do it in place: cards[x:], cards[:x] = cards[:x], c

Re: How to get an integer from a sequence of bytes

2013-06-12 Thread Ian Kelly
On Tue, Jun 4, 2013 at 3:49 PM, Chris Angelico wrote: > So... can we cite http://xkcd.com/859/ in two threads at once, or does > that create twice as much tension? No, you just look at one of them upside-down, and then they cancel each other out. -- http://mail.python.org/mailman/listinfo/python

Re: My son wants me to teach him Python

2013-06-12 Thread Ian Kelly
On Wed, Jun 12, 2013 at 4:06 PM, John Ladasky wrote: > On Wednesday, June 12, 2013 8:34:15 PM UTC, Chris Angelico wrote: >>Unless you have a good reason for sticking with 2.x, go with 3.x. > > I agree, Chris, I will be teaching my son Python 3 from the start. In fact, > I'm in the middle of a me

Re: Creating a Super Simple WWW Link, Copy, & Paste into Spreadsheet Program

2013-06-13 Thread Ian Kelly
On Thu, Jun 13, 2013 at 1:41 PM, Joel Goldstick wrote: > there is a python module that reads and writes to excel files. look for > that More than one, actually, and which to use depends on whether "Excel files" means the .xls or .xlsx format. On Windows, the most flexible solution is going to b

Re: Don't feed the help-vampire

2013-06-15 Thread Ian Kelly
On Fri, Jun 14, 2013 at 6:09 AM, rusi wrote: > Since identifying a disease by the right name is key to finding a > cure: > Nikos is not trolling or spamming; he is help-vampiring. I think he's a very dedicated troll elaborately disguised as a help vampire. Remember that one of the names he previ

Re: Timsort in Cpython

2013-06-16 Thread Ian Kelly
On Sat, Jun 15, 2013 at 10:05 PM, wrote: > Yes I've read it. Very interesting read. There are other resources too online > that make it very clear, for instance the wikipedia articles is pretty good. > > Though, if anyone would be interested in helping me out further -- though by > all means, I

Re: My son wants me to teach him Python

2013-06-17 Thread Ian Kelly
On Sun, Jun 16, 2013 at 3:55 AM, Cameron Simpson wrote: > On 14Jun2013 20:12, Dennis Lee Bieber wrote: > | [...] PowerShell has been > | available as a download on WinXP and standard on Win7 [PS 3 is a > | download for Win7, stock on real Win8]. > | While I'm not fluent in it, there are som

Re: Timsort in Cpython

2013-06-19 Thread Ian Kelly
On Wed, Jun 19, 2013 at 11:18 AM, wrote: > The second argument takes the tuple which determines which varialble(key) to > use the comparator on. And the third determines whether to return the list in > ascending or descending order. That's not exactly correct. The arguments are listed in that

Re: Don't feed the troll...

2013-06-19 Thread Ian Kelly
On Wed, Jun 19, 2013 at 4:57 AM, Antoon Pardon wrote: > I don't remember making such a claim. What I do remember is > you among others claiming that the problem was not (so much) > the troll (Nikos) but the others. Count me among those who feel this way. > And your last conclusion is unsound. Yo

Re: Problem with the "for" loop syntax

2013-06-19 Thread Ian Kelly
On Wed, Jun 19, 2013 at 3:14 PM, arturo balbuena wrote: > Hello guys... > I´m a begginer in Python, I'm doing a Hangman game, but I'm having trouble > with this blank space. I would be greatful if you help me. :) > > Here's my code: > > http://snipplr.com/view/71581/hangman/ > > When I run the co

Re: Default Value

2013-06-20 Thread Ian Kelly
On Thu, Jun 20, 2013 at 11:19 AM, Chris Angelico wrote: > On Fri, Jun 21, 2013 at 3:12 AM, rusi wrote: >> Python (and all the other 'cool' languages) dont have gotchas because >> someone malevolently put them there. >> In most cases, the problem is seen too late and the cost of changing >> entren

Re: Don't feed the troll...

2013-06-20 Thread Ian Kelly
On Thu, Jun 20, 2013 at 3:41 AM, Antoon Pardon wrote: > There are two problems with your reasoning. The first is that you > are equivocating on "expect". "Expect" can mean you will be surprised > if it doesn't happen but it can also mean you will feel indignant or > disappointed or something simil

Re: Don't feed the troll...

2013-06-21 Thread Ian Kelly
On Fri, Jun 21, 2013 at 3:18 AM, Antoon Pardon wrote: > Op 21-06-13 04:40, Ian Kelly schreef: > >> On Thu, Jun 20, 2013 at 3:41 AM, Antoon Pardon >> wrote: >>> There are two problems with your reasoning. The first is that you >>> are equivocating on &qu

Re: Default Value

2013-06-21 Thread Ian Kelly
On Fri, Jun 21, 2013 at 7:15 PM, Steven D'Aprano wrote: > On Fri, 21 Jun 2013 23:49:51 +0100, MRAB wrote: > >> On 21/06/2013 21:44, Rick Johnson wrote: > [...] >>> Which in Python would be the "MutableArgumentWarning". >>> >>> *school-bell* >>> >> I notice that you've omitted any mention of how yo

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