Re: Programmer font

2011-06-05 Thread James Mills
On my desktop at home which runs CRUX (http://crux.nu) I use the Terminius (1) fonts which I installed myself. I find this font especially nice for both Terminals and Editing code. cheers James 1. http://terminus-font.sourceforge.net/ -- -- James Mills -- -- "Problems are solv

Re: announcing: dmangame: an ai game. maybe.

2011-06-05 Thread James Mills
is really cool. I haven't looked at the source code yet... There was another game very similar to this - much more basic though and when I saw it back then I wanted to do something similar! Nice job! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http:/

Re: attach to process by pid?

2011-03-08 Thread James Mills
'm missing something here I don't see how you could achieve communication with another process unless that process has some kind of communication(s) interface; eg: * some kind of listening socket * some kind of I/O (pipe, stdin/stdout) cheers James -- -- James Mills -- -- "Prob

Re: Defining class attributes + inheritance

2011-03-08 Thread James Mills
. def __init__(self, x, y): ... super().__init__(x) ... print("Hello %s" % y) ... >>> x = ExtendedBase("foo", "bar") Hello foo Hello bar >>> cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: attach to process by pid?

2011-03-10 Thread James Mills
x27;s stdin (file descriptor of 0) Probably not a portable solution. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: attach to process by pid?

2011-03-10 Thread James Mills
On Fri, Mar 11, 2011 at 9:30 AM, Grant Edwards wrote: > No it doesn't.  Try writing something other than "foobar". You've demonstrated a case where this doesn't work :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing.Process Daemonic Behavior

2011-03-15 Thread James Mills
t process with the KILL signal then any child procesases that were created become zombies. You also can't handle the KILL signal in your application (nor can the multiprocessing library) and so it therefore cannot cleanup and terminate any child processes in the normal way. cheers James --

Re: cx_Freeze 4.2.3

2011-03-31 Thread James Mills
ecognized cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
ython ideology. > be expanded to > >    _temp = expr >    if _temp: return _temp This could be simplified to just: return expr or None And more to the point... If your calee is relying on the result of this function, just returning the evaluation of "expr" is enoug

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
ot;didn't find an answer") >  raise ValueError                     raise ValueError > > Are you saying the two snippets above are equivalent? def foo(n): x = n < 5 if x: return x is functionally equivalent to: def foo(n): return n < 5 -- -

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
On Tue, Apr 12, 2011 at 12:18 PM, Jason Swails wrote: > This is only true if n < 5.  Otherwise, the first returns None and the > second returns False. Which is why I said: return expr or None But hey let's argue the point to death! cheers James -- -- James Mills -- -- "

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
deology. > be expanded to > >_temp = expr >if _temp: return _temp This could be simplified to just: return expr or None """ Please read carefully before putting words in my mouth. I stated very clear y that return? expr didn't seem fitting in the python

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
making assumptions about what the OP intended. Perhaps OPs should be more clear ? :) kid! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
reply. Have a nice day, cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
heers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-12 Thread James Mills
the same today! Regardless of anyone's subjective opinions as to what was clear - I still stand by what I said. Nice comments btw Chris :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-12 Thread James Mills
preciate your comments. Thank you! Yes I do understand there is probably more code that follows the return? - but I made an assumption and I'm not going back on it :) Thanks for making the two sides obviously clear! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: [Bug / Feature Request] IDLE Shell

2011-04-12 Thread James Mills
get the latest IDLE source code, patch it, test it, see how you like it and if you feel it useful, share the patch and/or file a bug with the patch. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-12 Thread James Mills
nt) but hey it's all in good fun until someone looses an eyeball! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested inner classes and inheritance -> namespace problem

2011-04-13 Thread James Mills
tter to make use of modules here as opposed to nesting classes. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
2) Formalize a new design for xyz 3) File a bug report for xyz Complaining doesn't really get you very far, nor does berating others (even if indirectly). Whilst I agree that there are some folk who "might" be guilty of egotist / arrogant attitudes there isn't much anyone can do abou that - that's just part of life and part of social interaction(s). Get over it. For the most part - the Python Community as a whole is very helpful, positive and has a lot of nice thinigs about it (not just the language). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

automated pep8 reformatter ?

2011-04-13 Thread James Mills
Does anyone know of a tool that will help with reformatting badly written code to be pep8 compliant ? a 2to3 for pep8 ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: automated pep8 reformatter ?

2011-04-13 Thread James Mills
On Thu, Apr 14, 2011 at 11:47 AM, James Mills wrote: > Does anyone know of a tool that will help with > reformatting badly written code to be pep8 compliant ? > > a 2to3 for pep8 ? In case there is no such tool (And I don't have the time to write one) I've found this to be

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
On Thu, Apr 14, 2011 at 11:47 AM, Ethan Furman wrote: > *Please* don't re-post his crap. Opps sorry :) I have never really known what to do with big-huge-long posts ? :) Won't happen again! cheers James -- -- James Mills -- -- "Problems are solved by method" --

Re: automated pep8 reformatter ?

2011-04-13 Thread James Mills
d - I'm more interested in readability more than anything. I often use pyflakes in conjunction with pep8 to keep my own code clean, readable and consistent. Thanks for the suggestion! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: automated pep8 reformatter ?

2011-04-13 Thread James Mills
ady exists that fits your tastes. I doubt such a tool could be written either. The vim plugin I referenced earlier works nicely enough. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
week or month at least. Because he has better things to do ? LIke his job at Google ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
different groups in the first place (python-dev, python-core-mentoring, python-ideas, etc) so that there is a clear separation of "what's what". Can we stop arguing about this now ? cheers James > http://mail.python.org/mailman/listinfo/python-list > -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-17 Thread James Mills
7;ve been over this! :) And you're a bit late... You said it yourself "If there is code after that snippet" cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] working with strings in python3

2011-04-18 Thread James Mills
ngs. Use a a format specifier like this: > message = "Bah." > > if test: >   message = "%s %s" (message, " Humbug!") > > print(message) Python3 (afaik) also introduced the .format(...) method on strings. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE bug

2011-04-18 Thread James Mills
On Tue, Apr 19, 2011 at 2:05 PM, harrismh777 wrote: > Are bug reports wanted here, or just in issue tracker? Pretty sure they're wanted in the Issue Tracker. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

meteclasses 2.x/3.x compatibility

2011-04-19 Thread James Mills
Hi all, Is there a compatible way to use meteclasses in both Python 2.x (2.6 to 2.7) and Python 3.x (3.0 to 3.2). Python 2.x: class Foo(object): __meteclass__ = MyMetaClass Python 3.x: class Foo(metaclass=MyMetaClass): pass Thanks, cheers James -- -- James Mills -- -- "Problem

Re: meteclasses 2.x/3.x compatibility

2011-04-20 Thread James Mills
ttp://code.google.com/p/lepl/source/browse/src/lepl/matchers/matcher.py#40 I > have > >  _Matcher = ABCMeta('_Matcher', (object, ), {}) > > and then > >  class Matcher(_Matcher): >      ... Thank Andrew. I like this approach Elegance wins for me :) cheers James --

Re: Composition instead of inheritance

2011-04-28 Thread James Mills
is typical of MixIns cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: importing class objects from a pickled file

2011-05-03 Thread James Mills
See: http://docs.python.org/library/pickle.html#the-pickle-protocol Any time you want to unpickle a user class, that class must be available. I suggest serializing to a more common format (say JSON) and re-create your class with the data. cheers James -- -- James Mills -- -- "Problem

Re: Running and killing a process in python

2011-05-03 Thread James Mills
which module is best suited to > do this? subprocess? Yes start with the subprocess module: http://docs.python.org/library/subprocess.html cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

[OT]: PiCloud - really cool!

2011-05-04 Thread James Mills
: a, b, = 1, 1 while n > 1: a, b = b, a + b n -= 1 return b #cloud.start_simulator() jobs = cloud.map(fib, range(100)) print [cloud.result(job) for job in jobs] Enjoy! :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://

Re: [OT]: PiCloud - really cool!

2011-05-04 Thread James Mills
I find the API provided to be quite simple robust and potentially very powerful - depending on your application. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: BeautifulSoup import error

2011-05-05 Thread James Mills
n Python 2.x and Python 3.x - notably: except Exception, e: # Python 2.x except Exception as e: # Python 3.x I might suggest you take a look at using lxml instead which ships with the standard library. [ ... ] cheers James -- -- James Mills -- -- "Problems are solved by method" -

Re: 回复: Re: BeautifulSoup import error

2011-05-05 Thread James Mills
On Fri, May 6, 2011 at 3:57 PM, Stefan Behnel wrote: > No. While this has been suggested, it will not become part of the stdlib in > the foreseeable future. It's readily available as a separate package on > PyPI, though. Opps I meant xml.etree :/ My bad! cheers James --

Re: checking if a list is empty

2011-05-06 Thread James Mills
On Fri, May 6, 2011 at 4:36 PM, Jabba Laci wrote: > If I want to check if a list is empty, which is the more pythonic way? [...] > (2) if not li: This is fine. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: if statement multiple or

2011-05-06 Thread James Mills
problem You will need to (naively) do this: if "a" not in line or "b" not in line or "c" not in line: print line cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How to access elemenst in a list of lists?

2011-05-08 Thread James Mills
ot; " for x in range(5)] for y in range(5)] >>> from pprint import pprint >>> pprint(grid) [[' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [&

Re: checking if a list is empty

2011-05-08 Thread James Mills
h the suggestion (even if it is "right"), perhaps keep that to yourself. if not my_list: is a perfectly valid and fine idiom to use in Python. If you prefer some other way, that's fine. Quite frankly I'm sick of seeing posts that argue for the sake of arguing. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Overuse of try/except/else?

2011-05-09 Thread James Mills
is a dynamic programming language) but errors should be handled and caught by the caller - not the callee. My 2c, others may have other points of view... cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python backup programs?

2011-05-10 Thread James Mills
> or not? Recently I wrote a simple backup system for a client using a mixture of Python and Bash using rsync, ssh and pptp. (Not packaged well enough to show source though) It works very well and does the job. cheers James -- -- James Mills -- -- "Problems are solved by method"

Re: Overuse of try/except/else?

2011-05-10 Thread James Mills
al stack trace Valid point :) However I was referring to real experience where I've seen code that "catches all any any exception" and simply logs it. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread James Mills
onyms. > 5. is there a way to find out if the thread is still active or dead? See: pydoc threading.Thread or help(threading.Thread) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
te all parts you want to hide in C/C++/Cython and > distribute them as .so/.dll Or you could do what everyone else is doing and provide your "application" as a service in some manner. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
his, short of closed-source? As I mentioned before (which I don't think you quite got)... Write your "game" for the "web". Write is as a SaaS (Software as a Service) - even if it's free and open source. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
are not very accessible. Funny you should mention this "now" :) I happen to be blind myself. Yes I agree Flash is not very accessible (never has been). Web Standards web apps and such however are quite accessible! cheers James -- -- James Mills -- -- "Problems are solved by method&

Re: Overuse of try/except/else?

2011-05-21 Thread James Mills
r calling it a LateFunction seems more "fitting" :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Python Job Board - Call for volunteers

2014-03-05 Thread James Mills
I'd like to volunteer! On Mar 5, 2014 7:13 PM, "M.-A. Lemburg" wrote: > [Please help spread the word by forwarding to other relevant mailing lists, > user groups, etc. world-wide; thanks :-)] > > Dear Python Community, > > for many years, the Python Job board ( > http://legacy.python.org/communi

Re: text to html

2011-12-14 Thread James Mills
On Dec 14, 3:30 am, Pedro Henrique Guedes Souto wrote: > On Tue, Dec 13, 2011 at 3:22 PM, prakash jp wrote: > > Want to publish a log file as a web page, is there a parser to retain the > > format of the text as is and then convert to html. Please provide the > > relevant pointers Hey Pedro,

Re: Object help

2009-01-11 Thread James Mills
On Mon, Jan 12, 2009 at 9:49 AM, killsto wrote: > Thanks. That makes sense. It helps a lot. Although, you spelled color > wrong :P. color colour They are both correct depending on what country you come from :) > Just curious, is there another way? How would I do this in c++ which > is listless

urllib2 - 403 that _should_ not occur.

2009-01-11 Thread James Mills
Hey all, The following fails for me: >>> from urllib2 import urlopen >>> f = >>> urlopen("http://groups.google.com/group/chromium-announce/feed/rss_v2_0_msgs.xml";) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/urllib2.py", line 124, in urlopen return _

Re: urllib2 - 403 that _should_ not occur.

2009-01-11 Thread James Mills
On Mon, Jan 12, 2009 at 12:58 PM, Philip Semanchuk wrote: > > On Jan 11, 2009, at 8:59 PM, James Mills wrote: > >> Hey all, >> >> The following fails for me: >> >>>>> from urllib2 import urlopen >>>>> f = >>>>> ur

Re: urllib2 - 403 that _should_ not occur.

2009-01-11 Thread James Mills
On Mon, Jan 12, 2009 at 1:25 PM, Philip Semanchuk wrote: > Oooops, I guess it is my brain that's not working, then! Sorry about that. Nps. > I tried your sample and got the 403. This works for me: (...) > Some sites ban UAs that look like bots. I know there's a Java-based bot with > a distinct

Re: Object help

2009-01-11 Thread James Mills
On Mon, Jan 12, 2009 at 2:26 PM, killsto wrote: > I was kidding. IMO, we Americans should spell color like everyone > else. Heck, use the metric system too while we are at it. Yes well why don't you start up a rally and convince your brand new shiny government to catch up with the rest of the wor

Re: Standard IPC for Python?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 2:25 AM, Laszlo Nagy wrote: > The question is: what is the standard way to implement fast and portable IPC > with Python? Are there tools in the standard lib that can do this? Certainly not standard by any means, but I use circuits (1). Two or more processes can communicat

Re: Standard IPC for Python?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:40 AM, Laszlo Nagy wrote: > Can anyone tell me if select.select works under OS X? Yes it does. cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: executing multiple functions in background simultaneously

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:02 AM, Catherine Moroney wrote: > I would like to spawn off multiple instances of a function > and run them simultaneously and then wait until they all complete. > Currently I'm doing this by calling them as sub-processes > executable from the command-line. Is there a w

Re: Programming friction

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:29 AM, killsto wrote: > I'm trying to implement a basic user controlled sliding box with > pygame. I have everything worked out, except for two things. Try the pygame mailing list :) cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: executing multiple functions in background simultaneously

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:35 AM, MRAB wrote: > The disadvantage of threads in Python (CPython, actually) is that > there's the GIL (Global Interpreter Lock), so you won't get any speed > advantage if the threads are mostly processor-bound. The OP didn't really say what this function does :) *sig

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:50 AM, Russ P. wrote: > Here's the definition on the Wikipedia page for object oriented > programming (and it does *not* sound like Python classes): > > Encapsulation conceals the functional details of a class from objects > that send messages to it. ... Encapsulation is

Re: problem calling method

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:28 AM, wrote: > class MyFrame(wx.Frame): >def __init__(self, *args, **kwds): It might be helpful here if you called the parent __init__. Like so: class MyFrame(wx.Frame): def __init__(self, *args, **kwds): super(MyFrame, self).__init__(*args, **kwargs) .

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 12:27 PM, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "James Mills" writes: >> You do realize this is a model and not strictly a requirement. Quite >> a few things in Python are done merely by convention. >> Don&#x

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 12:57 PM, Terry Reedy wrote: > public = no leading underscore > private = one leading underscore > protected = two leading underscores > > Python uses encapsulation by convention rather than by enforcement. As mentioned previously this is not encapsulation, but access cont

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 1:18 PM, Russ P. wrote: > Yes, but the fact that you can approximate OO programming in a > particular language does not make that language object oriented. You > can approximate OO programming in C, but that does not mean that C is > an OO language. Wrong. Not having stric

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 1:25 PM, Rhodri James wrote: > I wouldn't violently object to having some means of policing class > or module privacy, but it does have consequences. When it's a > convention, you can break it; when it isn't, you can't, even if > you do have good reason. Add that to the o

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 1:31 PM, r wrote: >> public = no leading underscore >> private = one leading underscore >> protected = two leading underscores >> >> Python uses encapsulation by convention rather than by enforcement. > > Very well said Terry! > > I like that python does not force me to do

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 1:50 PM, Carl Banks wrote: > 1. Wise people don't believe everything that is written on Wikipedia. > 2. The person who wrote that line in Python.org is a wise person. Agreed. > You know what? Computer science buzzwords mean jack squat to me. I > don't give a horse's tai

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:11 PM, Russ P. wrote: (...) >> Give me one use-case where you strictly require >> that members of an object be private and their >> access enforced as such ? > > You're kidding, right? Think about a ten-million line program being > developed by 100 developers. No I"m so

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:11 PM, Russ P. wrote: > I think you are the one who is confused. Part of the problem here is > that the term "encapsulation" has at least two widely used meanings > (in the context of programming). In one sense, it just means grouping > data and methods together. In anoth

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:35 PM, Russ P. wrote: > You know what? The more I think about the kind of nonsense you and > others are spouting here, the more annoyed I get. I will gladly agree > that encapsulation may be more trouble than it's worth for small > applications, maybe even some medium siz

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 4:35 PM, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "James Mills" writes: >> Bare in mind also, that enfocing access control / policing as you >> called it has a performance hit as the machine (the Python vm) >>

Re: pep 8 constants

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 4:49 PM, Brendan Miller wrote: > PEP 8 doesn't mention anything about using all caps to indicate a constant. > > Is all caps meaning "don't reassign this var" a strong enough > convention to not be considered violating good python style? I see a > lot of people using it, bu

Re: Python Crashes

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 6:57 AM, koranthala wrote: > Hi, >I have a twisted based application based on Python 2.4.3. I also > have one thread in this application. > >I found that my program crashes repeatedly after a random interval > (ranging from 10 min to 3 hr). When I say crash, it is n

Re: Python 3 isinstance

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 8:14 AM, Lambert, David W (S&T) wrote: > Please, why isn't a set permitted as the second argument to isinstance? Care to show us a code sample ? We're not psychic you know... cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 8:11 AM, dpapathanasiou wrote: > I wrote this function to retrieve a list of items from a dictionary. > > The first time it was called, it worked properly. > > But every subsequent call returned the results of the prior call, plus > the results of the current call. > > I wa

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 8:32 AM, dpapathanasiou wrote: (...) > It's not exactly right for what I'm doing, b/c the caller always > expects a list in return. How about this then: def get_prior_versions (item_id, priors=None): """Return a list of all prior item ids starting with this one"""

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 9:27 AM, dpapathanasiou wrote: > Without the "if priors:" line just above the first return statement (a > typo perhaps?), then yes, it would do what I want. Yes sorry it was :) >> a) a global should and need not be used. > > Passing the entire dictionary to every function

Re: executing multiple functions in background simultaneously

2009-01-14 Thread James Mills
Speaking of Threading .. http://codepad.org/dvxwAphE Just a really interesting way of doing this :) cheers James -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

process/thread instances and attributes

2009-01-14 Thread James Mills
Hey all, I have this concept I'm working on and here is the code... Problem is if you run this it doesn't terminate. I believe you can terminate it in the main process by calling a.stop() But I can't find a way for it to self terminate, ie: self.stop() As indicated by the code...

Re: Python 3 isinstance

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 1:03 PM, Lambert, David W (S&T) wrote: > Overly terse. I do mean that this is illegal: > > isinstance(s, {str, bytes}) > > tuples have order, immutability, and the possibility of repeat items. > > A set is most reasonable in a mathematical sense. What's wrong with: >>> a

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 2:50 PM, Russ P. wrote: (..) > One feature of Ada that I always thought was a good idea is the > distinction between functions and procedures, where functions are > guaranteed to not have side effects. But I don't think Ada allows > advanced functional programming such as

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 3:59 PM, Michele Simionato wrote: (...) > It could just be an issue of practicality. Python is an industrial > strength language with libraries for everything and you can use it for > your daily work. There are nice little languages out there that are > however not usable

Re: 2to3 Help?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:01 PM, wrote: > I have Python 3.0. I tried to use the 2to3 program included with the > interpreter to convert some scripts for Python 2.5 to Python 3.0 ones. > When I try to start it form the Python command line, it says it is a > syntax error. > > This was the line of c

Re: 2to3 Help?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:17 PM, wrote: $ 2to3.py testscript.py > File "", line 1 >$ 2to3.py testscript.py >^ > Syntax Error: Invalid Syntax Oh i see... You need to do 2 things: 1) Run 2to3 on the shell not the python interpreter. 2) Learn some basic UNIX. cheers James -- http://

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:20 PM, Michele Simionato wrote: (...) > I would be fine having something like pylint built-in in the language > and running at every change of the source code (unless disabled with a > command line switch). I think this is the only reasonable solution to > get some addit

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:34 PM, Michele Simionato wrote: (...) > There are lots of Python developers (and most of the core developers) > that think the OO community is wrong about enforced encapsulation. > Personally, I think in a few years everybody will realize the mistake > of enforced encaps

Re: 2to3 Help?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:32 PM, wrote: > I tried to run it on the command prompt (I use Windows XP) but it > doesn't work either. I did not realize you were using WIndows :) Normally most shells in the UNIX/Linux world start with a '$'. > I opened the command prompt: > > C:\Documents and Setti

Re: why o/p is different ???

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:34 PM, asit wrote: > I recently faced a peculiar o/p. > > My objective is to remove the command name(my script name) from > sys.argv[0]. > I coded like this If you _really_ want to remove your script_name from sys.argv, then do this: del sys.argv[0] If you're just afte

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-15 Thread James Mills
On Thu, Jan 15, 2009 at 5:05 PM, Russ P. wrote: (...) > Wait a minute. Aren't the guy who just took me to task about the > definition of functional programming? So the definition of functional > programming is written in stone, but the definition of OO programming > is written in smoke? Did anyo

Re: process/thread instances and attributes

2009-01-15 Thread James Mills
On Thu, Jan 15, 2009 at 7:36 PM, Laszlo Nagy wrote: (...) Value won't do obviously :) As there could be an arbitary no. of processes. > What do you want to try with this example? I guess I just am confused as to what belongs to which process (the main or the child) ... I need a clear cut examp

Re: process/thread instances and attributes

2009-01-15 Thread James Mills
After some work ... I've taken Laszlo's suggestion of using Value (shared memory) objects to share state between the -pseudo- Process (manager) object and it's underlying multiprocessing.Process instance (and subsequent process): Here is the code: #!/usr/b

Re: spam on the list - how are things now?

2009-01-15 Thread James Mills
On Fri, Jan 16, 2009 at 1:30 PM, wrote: > We've been running SpamBayes on the news-to-mail gateway on mail.python.org > for a couple weeks now. To me it seems like the level of spam leaking onto > the list has dropped way down but I'd like some feedback from people who > read the python-list@pyt

Re: Injecting a global into a defined function??

2009-01-15 Thread James Mills
On Fri, Jan 16, 2009 at 4:28 AM, Cong Ma wrote: > I'd appreciate your hints on this problem. I'm writing a module in which > several > functions can alter the value of a global variable (I know this sounds evil, > please forgive me...). What I'm trying to do is to eliminate the "global foo" > lin

Re: Injecting a global into a defined function??

2009-01-15 Thread James Mills
On Fri, Jan 16, 2009 at 1:59 PM, Cong Ma wrote: > I've thought of this too, but it turns out those functions are related to each > other very loosely. They do a lot of completely different things independently > and have just one common global variable to share. IMHO it would reduce the > readabil

Re: s = sha1(random()).hexdigest()

2009-01-15 Thread James Mills
On Fri, Jan 16, 2009 at 2:46 PM, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > gert writes: >> s = urandom(10).encode('hex') >> AttributeError: 'bytes' object has no attribute 'encode' > > Oh, Python 3. It's done some different way, someone else will have to > specify. I'm still using 2

  1   2   3   4   5   6   >