Re: PYTHONPATH and eggs

2010-03-03 Thread Jonathan Gardner
x27;ve seen this issue has been discussed elsewhere and flagged as a > problem (e.g. > http://mail.python.org/pipermail/distutils-sig/2009-January/010755.html) > > but I've been unable to find any suggestions for workarounds or > indications whether this will be/has been fixed. > Sounds li

WANTED: A good name for the pair (args, kwargs)

2010-03-04 Thread Jonathan Fine
!= expect: # Something has gone wrong. pass This is part of a test runner. For now I'll use argpair, but if anyone has a better idea, I'll use it. -- Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Evaluate my first python script, please

2010-03-04 Thread Jonathan Gardner
osts.append(hostname) It may be clearer to do set arithmetic as well. > if len(hosts) == 1: >        os.system("ssh -A " + hosts[0]) You probably want one of the os.exec* methods instead, since you aren't going to do anything after this. > else: >        print '\n'.join(hosts) Rather, the idiom is usually: for host in hosts: print host -- Jonathan Gardner [email protected] -- http://mail.python.org/mailman/listinfo/python-list

Re: WANTED: A good name for the pair (args, kwargs)

2010-03-05 Thread Jonathan Fine
Jonathan Fine wrote: Hi We can call a function fn using val = fn(*args, **kwargs) I'm looking for a good name for the pair (args, kwargs). Any suggestions? Here's my use case: def doit(fn , wibble, expect): args, kwargs = wibble actual = fn(*args, **kwargs)

Re: start function in new process

2010-03-05 Thread Jonathan Gardner
def g(): >    pidID = os.fork() >    if pidID == 0: >        # child do something here >        f(2,3,c) You'll need to exit here -- not return. http://docs.python.org/library/os.html#os._exit >    else: >        # parent do something here >        print "Parent > >

Re: NoSQL Movement?

2010-03-12 Thread Jonathan Gardner
On Wed, Mar 3, 2010 at 2:41 PM, Avid Fan wrote: > Jonathan Gardner wrote: >> >> I see it as a sign of maturity with sufficiently scaled software that >> they no longer use an SQL database to manage their data. At some point >> in the project's lifetime, the data is

Re: Need advice on starting a Python group

2010-03-12 Thread Jonathan Gardner
ate whatever code your org has with Python, and manage and maintain that code so others can use it. Finally, advertise. The more people see "Python", the more they will be interested. Coca-cola and Pepsi are really good at this! -- Jonathan Gardner [email protected] -- http://mail.python.org/mailman/listinfo/python-list

Re: NoSQL Movement?

2010-03-13 Thread Jonathan Gardner
require reading as well as writing > remote parts of the disk, so buffering doesn't help avoid every disk > seek. > Plus the fact that your other DB operations slow down under the load. -- Jonathan Gardner [email protected] -- http://mail.python.org/mailman/listinfo/python-list

Re: python to exe

2010-03-14 Thread Jonathan Hartley
On Mar 13, 1:45 pm, [email protected] wrote: > Robin, > > > do you of an alternate compilter it doesn't work (py2exe) on my windows 7 > > box > > I can assure you that Py2exe does work on Windows 7 (my firm develops > commercial Python applications packaged using Py2exe running on Windows > 7), b

Re: NoSQL Movement?

2010-03-14 Thread Jonathan Gardner
On Sun, Mar 14, 2010 at 6:55 AM, D'Arcy J.M. Cain wrote: > On Sat, 13 Mar 2010 23:42:31 -0800 > Jonathan Gardner wrote: >> On Fri, Mar 12, 2010 at 11:23 AM, Paul Rubin wrote: >> > "D'Arcy J.M. Cain" writes: >> >> Just curious, what databas

Re: to pass self or not to pass self

2010-03-16 Thread Jonathan Gardner
gs in the Python language proper, this is probably the most confusing thing for new programmers. Heck, even experienced programmers get tangled up because they project how they think things should work on to the Python model. The second most confusing thing is probably how objects get instantiated.

Re: Classes as namespaces?

2010-03-27 Thread Jonathan Hartley
On Mar 26, 6:26 pm, Luis M. González wrote: > On 26 mar, 11:49, kj wrote: > > > What's the word on using "classes as namespaces"?  E.g. > > > class _cfg(object): > >     spam = 1 > >     jambon = 3 > >     huevos = 2 > > > breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) > > I see no problem. >

"Usability, the Soul of Python"

2010-03-29 Thread Jonathan Hayward
ers programmers. Enjoy. -- Jonathan Hayward, [email protected] An Orthodox Christian author: theology, literature, et cetera. My award-winning collection is available for free reading online: I invite you to visit my main site at http://JonathansCorner.com/ -- http://mail.pyt

Q: We have *args and **kwargs. Woud ***allargs be useful?

2010-04-01 Thread Jonathan Fine
def(*args, **kwargs): 4. When the Args class is used a lot, one might welcome def(***args): # Do something with args. as a shortcut (and minor speedup) for def(*seqargs, **kwargs): args = Args(*seqargs, **kwargs) # Do something with args. I

Re: Q: We have *args and **kwargs. Woud ***allargs be useful?

2010-04-01 Thread Jonathan Fine
> x 3 >>> I don't yet understand what your code is intended to do, but I'm fairly sure you're not wishing to 'monkey-patch' a global namespace of a module. -- Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: unittests with different parameters

2010-11-23 Thread Jonathan Hartley
On Nov 22, 11:38 am, Ulrich Eckhardt wrote: > Hi! > > I'm writing tests and I'm wondering how to achieve a few things most > elegantly with Python's unittest module. > > Let's say I have two flags invert X and invert Y. Now, for testing these, I > would write one test for each combination. What I

Re: is py2exe still active ?

2010-12-08 Thread Jonathan Hartley
t; > Steve Holden           +1 571 484 6266   +1 800 494 3119 > > PyCon 2011 Atlanta March 9-17      http://us.pycon.org/ > > See Python Video!      http://python.mirocommunity.org/ > > Holden Web LLC                http://www.holdenweb.com/ Hey, Yes, they are all Python packages or applications, and yes, PyPI aka The Cheese Shop is a single repository for them. However, they do not share mailing lists or issue trackers. Each project maintains its own bug tracking, etc. Best regards, Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: is py2exe still active ?

2010-12-08 Thread Jonathan Hartley
t; > Steve Holden           +1 571 484 6266   +1 800 494 3119 > > PyCon 2011 Atlanta March 9-17      http://us.pycon.org/ > > See Python Video!      http://python.mirocommunity.org/ > > Holden Web LLC                http://www.holdenweb.com/ Hey, Yes, they are all Python packages or applications, and yes, PyPI aka The Cheese Shop is a single repository for them. However, they do not share mailing lists or issue trackers. Each project maintains its own bug tracking, etc. Best regards, Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Replacing globals in exec by custom class

2010-12-08 Thread Jonathan S
Hi all, I wonder if anyone can explain some weird behaviour in Python. What I'm trying to do is to execute a string of python code through the 'exec' statement. I pass an instance of my Global class, which acts like a dict. By overriding the __getitem__ method, the Global should pretend that a glo

Re: Replacing globals in exec by custom class

2010-12-09 Thread Jonathan S
Thanks for your response! (And sorry about the syntax error, I forgot to test my code after cleaning up some debug statements before posting, the else should have been elif indeed.) It's very interesing, how Python works internally. According to a thread on the Python mailing list in 2002, it seem

Re: continuing development on modules after they're installed

2010-12-10 Thread Jonathan Gardner
are just as trivial as the Unix ones.) Now, there is a link from the lib/python2.6/site-packages files to YourProject. (Or Python2.7 or whatever version you are using.) I'd also look at using Paster to create the package. It gives you a pretty decent setup for straight up Python packages. -- Jonathan Gardner [email protected] -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient python 2-d arrays?

2011-01-18 Thread Jonathan Hartley
On Jan 17, 10:20 pm, Jake Biesinger wrote: > Hi all, > > Using numpy, I can create large 2-dimensional arrays quite easily. > > >>> import numpy > >>> mylist = numpy.zeros((1,2), dtype=numpy.int32) > > Unfortunately, my target audience may not have numpy so I'd prefer not to use > it. > >

Re: Creating a standalone application

2010-04-14 Thread Jonathan Hartley
On Apr 13, 10:42 pm, Lawrence D'Oliveiro wrote: > In message , Luis Quesada wrote: > > > I am getting an "expected string without null bytes" error when using > > cxfreeze for creating a standalone application (in Linux-Ubuntu). > > Why bother? Every decent Linux system will have Python available.

Re: missing dll follow-up

2010-04-15 Thread Jonathan Hartley
Alex Hall wrote: > The vcredist_x86 was, I thought, supposed to give me > the dll, but it does not seem to have done so. The installer puts the DLL in the directory C:\WINDOWS\WinSxS (or at least it does for me, on WinXP) I shall update the py2exe tutorial page to reflect this. Under that dir, th

Re: missing dll follow-up

2010-04-15 Thread Jonathan Hartley
On Apr 15, 12:11 pm, Jonathan Hartley wrote: > Alex Hall wrote: > > The vcredist_x86 was, I thought, supposed to give me > > the dll, but it does not seem to have done so. > > The installer puts the DLL in the directory C:\WINDOWS\WinSxS > (or at least it does for me, on W

Re: missing dll follow-up

2010-04-15 Thread Jonathan Hartley
On Apr 15, 12:11 pm, Jonathan Hartley wrote: > The installer puts the DLL in the directory C:\WINDOWS\WinSxS > (or at least it does for me, on WinXP) I shall update the py2exe > tutorial page to reflect this. Done. Final para of section 5.2.2 now reads: """ The installer

cross-platform coloured text in terminal

2010-04-16 Thread Jonathan Hartley
Hi, It irks me that I know of no simple cross-platform way to print colored terminal text from Python. As I understand it, printing ANSI escape codes (as wrapped nicely by module termcolor and others) works on Macs and *nix, but only works on Windows if one has installed the ANSI.SYS device drive

Re: cross-platform coloured text in terminal

2010-04-16 Thread Jonathan Hartley
On Apr 16, 10:28 am, Jonathan Hartley wrote: > Hi, > > It irks me that I know of no simple cross-platform way to print > colored terminal text from Python. > > As I understand it, printing ANSI escape codes (as wrapped nicely by > module termcolor and others) works on Ma

Re: cross-platform coloured text in terminal

2010-04-17 Thread Jonathan Hartley
On Apr 16, 5:59 pm, Lie Ryan wrote: > On 04/16/10 19:28, Jonathan Hartley wrote: > > > I'm playing with ideas of what API to expose. My favourite one is to > > simply embed ANSI codes in the stream to be printed. Then this will > > work as-is on Mac and *nix. To make

Re: cross-platform coloured text in terminal

2010-04-19 Thread Jonathan Hartley
On Apr 17, 11:52 am, Jonathan Hartley wrote: > On Apr 16, 5:59 pm, Lie Ryan wrote: > > > > > On 04/16/10 19:28, Jonathan Hartley wrote: > > > > I'm playing with ideas of what API to expose. My favourite one is to > > > simply embed ANSI codes

Wanted: Python solution for ordering dependencies

2010-04-24 Thread Jonathan Fine
efile, but that seems to be such a kludge. Does anyone know of an easily available Python solution? -- Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Chris Rebert wrote: On Sat, Apr 24, 2010 at 1:53 PM, Jonathan Fine wrote: Hi I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is processed

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Aahz wrote: In article , Jonathan Fine wrote: I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is processed. I think I could get what

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Makoto Kuwata wrote: On Sun, Apr 25, 2010 at 5:53 AM, Jonathan Fine wrote: I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is processed.

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Eduardo Schettino wrote: On Sun, Apr 25, 2010 at 4:53 AM, Jonathan Fine wrote: Hi I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is pro

Re: ANN: Oktest-0.2.2 - a new-style testing library

2010-04-25 Thread Jonathan Fine
.. plus, ... ( ... f(2, 2) == 5, ... ) ... ) >>> x.run() [WrongValue(5, 4)] >>> y = TestScript( ... dict(f=plus, g=square, h=map), ... ( ... f(2, 2) == 5, ... h(g, (1, 2, 3)) ==

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Eduardo Schettino wrote: On Sun, Apr 25, 2010 at 11:44 PM, Jonathan Fine wrote: Eduardo Schettino wrote: On Sun, Apr 25, 2010 at 4:53 AM, Jonathan Fine wrote: Hi I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possib

Re: if, continuation and indentation

2010-05-28 Thread Jonathan Hartley
On May 27, 1:57 pm, Jean-Michel Pichavant wrote: > HH wrote: > > I have a question about best practices when it comes to line wrapping/ > > continuation and indentation, specifically in the case of an if > > statement. > > > When I write an if statement with many conditions, I prefer to use a > >

Re: if, continuation and indentation

2010-05-28 Thread Jonathan Hartley
On 28/05/2010 11:34, Jean-Michel Pichavant wrote: Jonathan Hartley wrote: On May 27, 1:57 pm, Jean-Michel Pichavant wrote: HH wrote: I have a question about best practices when it comes to line wrapping/ continuation and indentation, specifically in the case of an if statement. When I

Re: Is there any module/utility like 'rsync' in python

2010-06-15 Thread Jonathan Fine
hiral wrote: Hi, Is there any module/utility like 'rsync' in python. Thank you in advance. Not exactly what you asked for, but Mercurial provides a Python interface. You might find this URL a good starting point: http://mercurial.selenic.com/wiki/MercurialApi -- Jonath

Twisted 10.1.0 released

2010-07-04 Thread Jonathan Lange
On behalf of Twisted Matrix Laboratories, I am honored to announce the release of Twisted 10.1.0. Highlights include: * Deferreds now support cancellation * A new "endpoint" interface which can abstractly describe stream transport endpoints such as TCP and SSL * inotify support for Linux, wh

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Jonathan Hartley
attempting to redistribute py2exe versions of their programs (i.e. they have to own a Visual Studio license to legally be able to redistribute the required C runtime) I don't understand enough to know why Visual Studio was chosen instead of MinGW. Can anyone shed any light on that decision? Ma

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Jonathan Hartley
On Jul 7, 8:22 pm, "Martin v. Loewis" wrote: > > I presume this problem would go away if future versions of Python > > itself were compiled on Windows with something like MinGW gcc. Also, > > this would solve the pain of Python developers attempting to > > redistribute py2exe versions of their pro

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread Jonathan Lee
I think there's a combination of dlopen options and gcc command line parameters that invoke this behavior. See the second page of http://www.linuxjournal.com/article/3687 about auto-registration. Personally, though, it never worked for me :/ --Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no platform independent way of clearing a terminal?

2010-07-28 Thread Jonathan Hartley
e to extend it to cover other ANSI codes such as 'clear screen'. It is doubtless riddled with errors and misunderstandings, and I would love any feedback helping me do a better job. Best regards, Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no platform independent way of clearing a terminal?

2010-07-28 Thread Jonathan Hartley
hed there had been a simple cross-platform way to clear the terminal. (this, and printing colored text, was my initial use case for starting 'colorama') Is this a silly desire of mine, or simply an uncommon edge case that therefore isn't really significant? Best regards, Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no platform independent way of clearing a terminal?

2010-07-28 Thread Jonathan Hartley
On Jul 28, 4:45 pm, Jonathan Hartley wrote: > On Jul 28, 8:08 am, Ulrich Eckhardt wrote: > > > > > Daniel Fetchinson wrote: > > > After getting the technicalities out of the way, maybe I should have > > > asked: > > > > Is it only me or oth

Re: Why is there no platform independent way of clearing a terminal?

2010-07-28 Thread Jonathan Hartley
On Jul 28, 5:47 pm, Thomas Jollans wrote: > On 07/28/2010 06:01 PM, Jonathan Hartley wrote: > > > > > Oh, plus, while we're on this subject: > > > Am I right that curses in Python stdlib doesn't work on Windows, and > > there is currently no simple

A new syntax for writing tests

2010-08-04 Thread Jonathan Fine
ef whatever(tb): tb.start('a', {'att': 'value'}) tb.start('b') tb.end('b') tb.end('a') If the test has a set-up and tear-down, this can be handled in the runner, as can the test script raising an expected or unexpected exception. -- Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Feedparser Problem

2009-06-05 Thread Jonathan Nelson
s': [], 'feed': {}, 'version': None} I've checked my firewall settings, and python is allowed. Other python programs can get data from the web. I know that the 'bozo' is for malformed xml. I've searched through both of those rss feeds, and I can't find the argument 'timeout' anywhere in them. Any ideas, thoughts or directions in which I might go? Thanks to all in advance, Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Feedparser Problem

2009-06-05 Thread Jonathan Nelson
Thanks for the responses. I've tried the same script on a Server 2003 install, and Python 2.5 and it ran without a hitch. So, it's either a problem with Python 2.6 or with Windows 7. Thanks for all the responses. You've been great. Best, Jonathan On Jun 5, 7:39 am, Jonatha

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread Jonathan Gardner
On Jul 14, 7:03 am, phonky wrote: > > Now, I do not know yet how the account number scheme looks like. Exactly. The data store knows a lot more than the client (your program) will ever know. The correct answer is to do nothing. Use your data store to generate the IDs for you. The implementations

Re: explode()

2009-07-14 Thread Jonathan Gardner
On Jul 14, 6:56 am, Fred Atkinson wrote: > > Agreed, it doesn't.  But if my hosting provider won't change it, I'm > stuck with it.   > Nowadays you can find hosts that allow you to run FastCGI scripts in any language for dirt cheap. (Hostmonster for instance.) If your host doesn't allow it, it's

Re: does python have a generic object pool like commons-pool in Java

2009-07-15 Thread Jonathan Gardner
On Jul 14, 6:34 pm, Rick Lawson wrote: > Appreciate any help on this. I am porting an app from Java to python > and need generic object pooling with hooks for object initialization / > cleanup and be able to specify an object timeout. > Are you looking for something like a thread pool or a connec

Re: missing 'xor' Boolean operator

2009-07-15 Thread Jonathan Gardner
On Jul 14, 4:48 pm, Ethan Furman wrote: > > A whole family of supers.  :) > You should pick up Lisp. The whole concept of a binary operator doesn't exist over there. All the things binary operators can do, Lisp does with 0, 1, 2, or more arguments. [1]> (+) 0 [2]> (+ 1) 1 [3]> (+ 1 2) 3 [4]> (+

Re: Python Essential Reference, 4th Edition - Now Available!

2009-07-20 Thread Jonathan Corbet
ty of new library modules. And here I am still using my old, dog-eared second edition... Any chance of getting a copy of the 4th for an LWN review? Thanks, jon -- Jonathan Corbet / LWN.net / [email protected] -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-blocking read with popen subprocess

2009-07-30 Thread Jonathan Gardner
On Jul 30, 5:24 pm, Dhanesh wrote: > > how can I we have a non blocking read ? See http://docs.python.org/library/popen2.html#flow-control-issues Note well: In the non-blocking world, you have to use select() or poll () to get your job done. You may want to look at "communicate" (http://docs.py

Re: heapq "key" arguments

2009-07-31 Thread Jonathan Gardner
On Jul 31, 10:44 am, Joshua Bronson wrote: > Say I want to maintain a heap of (x, y) pairs sorted only by > first coordinate. Without being able to pass key=itemgetter(0), won't > heapifying a list of such pairs unnecessarily compare both > coordinates? It will compare the second value only if th

Re: Generate a new object each time a name is imported

2009-08-02 Thread Jonathan Gardner
On Aug 2, 12:35 am, Steven D'Aprano wrote: > > I'm looking for a way to hide the generation of objects from the caller, > so I could do something like this: > > from Module import factory() as a  # a == "Object #1" > from Module import factory() as b  # b == "Object #2" > Explicit is better than

Do anyone here use Python *embedded* in a database?

2009-08-05 Thread Jonathan Fine
kes a connection to a database. If you have used embed, you might have consulted a page such as: http://www.postgresql.org/docs/8.3/interactive/plpython-funcs.html -- Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Do anyone here use Python *embedded* in a database?

2009-08-05 Thread Jonathan Fine
Jon Clements wrote: On 5 Aug, 13:17, Jonathan Fine wrote: Hi I'm writing a talk that compares embed and extend, and wondered if anyone here ever used the Python *embedded* in a database server. http://twistedmatrix.com/users/glyph/rant/extendit.html Web frameworks (such as Django

Re: unique-ifying a list

2009-08-07 Thread Jonathan Gardner
On Aug 7, 1:53 pm, kj wrote: > Suppose that x is some list.  To produce a version of the list with > duplicate elements removed one could, I suppose, do this: > >     x = list(set(x)) > > but I expect that this will not preserve the original order of > elements. > > I suppose that I could write so

Re: syntax checker in python

2009-08-07 Thread Jonathan Gardner
On Aug 7, 1:39 pm, horos11 wrote: > ps - I just realized that it isn't enough to do: > > python -c 'import /path/to/script' > > since that actually executes any statement inside of the script > (wheras all I want to do is check syntax) > > So - let me reprhase that - exactly how can you do a synta

Re: Plotting Quadratic Functions, pygame

2009-08-12 Thread Jonathan Gardner
Before we get into fixing your code, let's talk about style. A lot of bugs are solved when you fix the style, and the remaining bugs are much easier to find and fix. (Comments inline) On Aug 12, 2:27 pm, Senad Ibraimoski -student-Mathematical Institute Belgrade wrote: > Hello, I'm a new guy to t

Re: Converting DD MM YYYY into YYYY-MM-DD?

2009-08-17 Thread Jonathan Gardner
On Aug 17, 3:26 pm, Gilles Ganault wrote: > Hello, > >         I need to convert DD MM dates into the MySQL-friendly > -MM-DD, and translate the month name from literal French to its > numeric equivalent (eg. "Janvier" into "01"). > > Here's an example: > > SELECT dateinscription, datecon

Re: Converting DD MM YYYY into YYYY-MM-DD?

2009-08-17 Thread Jonathan Gardner
On Aug 17, 3:26 pm, Gilles Ganault wrote: >         I need to convert DD MM dates into the MySQL-friendly > -MM-DD, and translate the month name from literal French to its > numeric equivalent (eg. "Janvier" into "01"). > > Here's an example: > > SELECT dateinscription, dateconnexion FROM

Re: Strongly typed list

2009-08-17 Thread Jonathan Gardner
On Aug 17, 2:19 pm, هاني الموصلي wrote: > Please could you lead me to a way or a good IDE that makes developing > huge projects in python more easier than what i found.Now i am using > eclips. Actually it is very hard to remember all my classes methods > and attributes or copy and paste them each

Re: Converting DD MM YYYY into YYYY-MM-DD?

2009-08-17 Thread Jonathan Gardner
On Aug 17, 5:20 pm, Ben Finney wrote: > > Instead, you should generate the map based on the standard library (in > this case, the underlying C standard library) locale database > http://docs.python.org/library/locale.html?highlight=locale%20date#lo...>: > Does Windows support POSIX locales? --

Re: Converting DD MM YYYY into YYYY-MM-DD?

2009-08-17 Thread Jonathan Gardner
On Aug 17, 7:06 pm, Ben Finney wrote: > Jonathan Gardner writes: > > Unfortunately, there isn't any string to date parsers in the built- > > ins. > > Fortunately, Python 2.5 or later has the ‘datetime.strptime’ function. > Hate to weasel out of this one, but the la

Re: Converting DD MM YYYY into YYYY-MM-DD?

2009-08-17 Thread Jonathan Gardner
On Aug 17, 5:18 pm, "Rami Chowdhury" wrote: > > >>> import locale > >>> locale.setlocale(locale.LC_ALL, 'FR') locale is nice when you only have a single thread. Webservers aren't single threaded. You can't serve up one page for one locale and then another in another locale without seeing very, v

Re: Parallelization in Python 2.6

2009-08-18 Thread Jonathan Gardner
On Aug 18, 11:19 am, Robert Dailey wrote: > I'm looking for a way to parallelize my python script without using > typical threading primitives. For example, C++ has pthreads and TBB to > break things into "tasks". I would like to see something like this for > python. So, if I have a very linear sc

Re: NOOB: Developing using python on two different computers

2009-08-19 Thread Jonathan Gardner
On Aug 19, 6:50 am, Smeagol wrote: > Hi there, > > Occasionally I have to develop on two different computers, and I was > wondering if there was a way to copy the python "environment" from one > to the other? > > Access to the data is trivial (networked database) but various > packages etc exist o

Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Fine
, it is simply syntactic sugar. It allows you to see, up front, what is going to happen. I think, once I get used to it, I'll get to like it. The way to read @apply def name(): # code is that we are defining 'name' to be the return value of the effectively a

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Fine
ode cleaner and don't plan on moving to 3.x any time soon (come on in! the water's great!), go for it :) Thank you for your comments, Alex. And particularly for telling me that apply() is no longer a builtin for Python 3. -- Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Gardner
On Aug 21, 6:36 am, Jonathan Fine wrote: >     �...@apply >      def tags(): >          value = [] >          # complicated code >          return value > Is this different from: tags = [] # complicated code I can see the argument that you are cleaning up a lot of intermedi

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Gardner
On Aug 21, 9:09 am, alex23 wrote: > On Aug 21, 11:36 pm, Jonathan Fine wrote: > > class ColourThing(object): >     @apply >     def rgb(): >         def fset(self, rgb): >             self.r, self.g, self.b = rgb >         def fget(self): >             ret

Re: Using 'apply' as a decorator, to define constants

2009-08-22 Thread Jonathan Fine
Jonathan Gardner wrote: On Aug 21, 9:09 am, alex23 wrote: On Aug 21, 11:36 pm, Jonathan Fine wrote: class ColourThing(object): @apply def rgb(): def fset(self, rgb): self.r, self.g, self.b = rgb def fget(self): return (self.r, self.g, self.b

Re: Using 'apply' as a decorator, to define constants

2009-08-22 Thread Jonathan Fine
y)''' def fset(rgb): self.r, self.g, self.b = rgb return locals() -- Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Using 'apply' as a decorator, to define constants

2009-08-22 Thread Jonathan Fine
Steven D'Aprano wrote: On Sat, 22 Aug 2009 10:51:27 +0100, Jonathan Fine wrote: Steven D'Aprano wrote: There's a standard idiom for that, using the property() built-in, for Python 2.6 or better. Here's an example including a getter, setter, deleter and doc strin

Re: Does Class implements Interface?

2009-08-27 Thread Jonathan Gardner
On Aug 27, 6:16 am, "Emanuele D'Arrigo" wrote: > Greetings everybody, > > let's say I have a Class C and I'd like to verify if it implements > Interface I. If I is available to me as a class object I can use > issubclass(C, I) and I can at least verify that I is a superclass of > C. There are a co

Re: Learning Python advanced features

2009-08-27 Thread Jonathan Gardner
On Aug 27, 5:13 am, jvpic wrote: > Hi, > > Learning Python, I understand the mechanism of : closure, __new__, > descriptors, decorators and __metaclass__, but I interrogate myself on > the interest of those technics ? > > May somebody explain me the interest ? > I assume you are asking, "Why do t

Re: Does Class implements Interface?

2009-08-27 Thread Jonathan Gardner
On Aug 27, 3:09 pm, "Emanuele D'Arrigo" wrote: > > Apologies, my fault, No apology is necessary. > I didn't explain that humans are out of the loop > entirely. It's only at runtime that the program obtains the class > object that might or might not conform to an expected interface. In > fact the

Re: Does Class implements Interface?

2009-08-27 Thread Jonathan Gardner
On Aug 27, 3:09 pm, "Emanuele D'Arrigo" wrote: > On Aug 27, 9:42 pm, Jonathan Gardner > wrote: > > > Have you heard of duck typing? > > Yes. > > I was just wondering then if this has been somewhat dealt with and has > been wrapped in a neat package,

Re: Logging contents of IRC channel

2009-08-31 Thread Jonathan Gardner
On Aug 31, 10:23 am, devaru wrote: > I am new to Python. I want to log the activities in an IRC channel. > Any pointers regarding this would be of great help. How are you going to plug into the chat server to obtain the data? How will you store the data? The in between parts are really easy. --

Re: Printing the name of a variable

2010-09-10 Thread Jonathan Hartley
On Sep 9, 9:11 pm, Albert Hopkins wrote: > On Thu, 2010-09-09 at 12:43 -0700, Stephen Boulet wrote: > > Does an arbitrary variable carry an attribute describing the text in > > its name? I'm looking for something along the lines of: > > > x = 10 > > print x.name > > >>> 'x' > > > Perhaps the x.__g

Re: Hide DOS console for .pyc file

2010-09-13 Thread Jonathan Hartley
On Sep 11, 11:32 am, Lawrence D'Oliveiro wrote: > In message , Peter Otten wrote: > > > Lawrence D'Oliveiro wrote: > > >> In message > >> <[email protected]>, Muddy > >> Coder wrote: > > >>> For a quick testing purpose, I deliver .pyc files to my cust

Re: Class-level variables - a scoping issue

2010-10-10 Thread Jonathan Gardner
On Oct 9, 10:30 pm, John Nagle wrote: >     Here's an obscure bit of Python semantics which > is close to being a bug: > >  >>> class t(object) : > ...     classvar = 1 > ... > ...     def fn1(self) : > ...         print("fn1: classvar = %d" % (self.classvar,)) > ...         self.classvar = 2 > ..

Re: Class-level variables - a scoping issue

2010-10-12 Thread Jonathan Gardner
On Oct 10, 12:07 pm, John Nagle wrote: >      (If you want default values for an instance, you define them > in __init__, not as class-level attributes.) > I beg to differ. I've seen plenty of code where defaults are set at the class level. It makes for some rather nice code. I'm thinking of lxm

Re: using optparser

2010-10-16 Thread Jonathan Gardner
On Oct 16, 7:59 pm, jimgardener wrote: > hi > I have a program which I call  findmatch that expects these arguments > 1.a person name > 2.a group name > 3.an integer > 4.a float value > > I thought I would allow user to call this program either using options > or using positional arguments in a pr

Re: OO and game design questions

2010-10-20 Thread Jonathan Hartley
On Oct 18, 8:28 am, dex wrote: > I'm building a turn based RPG game as a hobby. The design is becoming > increasingly complicated and confusing, and I think I may have > tendency to over-engineer simple things. Can anybody please check my > problems-solutions and point me to more elegant solution?

Re: OO and game design questions

2010-10-20 Thread Jonathan Hartley
On Oct 20, 11:25 am, Jonathan Hartley wrote: > On Oct 18, 8:28 am, dex wrote: > > > > > I'm building a turn based RPG game as a hobby. The design is becoming > > increasingly complicated and confusing, and I think I may have > > tendency to over-engineer simp

Re: OO and game design questions

2010-10-21 Thread Jonathan Hartley
On Oct 20, 12:11 pm, dex wrote: > On Oct 20, 12:25 pm, Jonathan Hartley wrote: > > > > > On Oct 18, 8:28 am, dex wrote: > > > > I'm building a turn based RPG game as a hobby. The design is becoming > > > increasingly complicated and confusing, a

Re: OO and game design questions

2010-10-21 Thread Jonathan Hartley
On Oct 20, 12:11 pm, dex wrote: > On Oct 20, 12:25 pm, Jonathan Hartley wrote: > > > > > On Oct 18, 8:28 am, dex wrote: > > > > I'm building a turn based RPG game as a hobby. The design is becoming > > > increasingly complicated and confusing, a

Re: OO and game design questions

2010-10-21 Thread Jonathan Hartley
On Oct 20, 12:11 pm, dex wrote: > On Oct 20, 12:25 pm, Jonathan Hartley wrote: > > > > > On Oct 18, 8:28 am, dex wrote: > > > > I'm building a turn based RPG game as a hobby. The design is becoming > > > increasingly complicated and confusing, a

Re: playful coding problems for 10 year olds

2010-11-02 Thread Jonathan Hartley
On Nov 1, 8:31 pm, Daniel Fetchinson wrote: > Hi folks, > > My niece is interested in programming and python looks like a good > choice (she already wrote a couple of lines :)) She is 10 and I > thought it would be good to have a bunch of playful coding problems > for her, stuff that she could cod

Re: Ways of accessing this mailing list?

2010-11-11 Thread Jonathan Hartley
ind *this* list (comp.lang.python) for ages, despite scrutinising possible aliases. For anyone else in the same boat, you are looking for gmane.comp.python.general. Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: "Edit with IDLE" doesn't work any more ?

2017-07-15 Thread jonathan . blanck89
Am Freitag, 28. April 2017 14:48:22 UTC+2 schrieb Yip, Kin: > Hi, > > I've finally known why By chance, I went to the installation directory > : C:\Program Files\Python36\Lib\tkinter > > to check on files. I did "EDIT with IDLE" on any files there. It all works > ! Then, I went bac

Re: crash while using PyCharm / Python3

2016-03-21 Thread Jonathan N. Little
lem:_Need_to_purge_-fglrx> -- Take care, Jonathan --- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com -- https://mail.python.org/mailman/listinfo/python-list

Re: crash while using PyCharm / Python3

2016-03-21 Thread Jonathan N. Little
Adam wrote: "Adam" wrote in message news:[email protected]... "Jonathan N. Little" wrote in message news:[email protected]... Adam wrote: There ought to be a way to just reinstall the graphics subsystem rather than an all-or-none installation

Re: crash while using PyCharm / Python3

2016-03-21 Thread Jonathan N. Little
" sdb1 "14.04-root" sdb5 "new-home" So from a live session when I mount both drives it is easy to keep things straight when I copy my profiles from old drive on sda to new drive with newer version of Ubuntu on sdb... -- Take care, Jonathan ---

<    1   2   3   4   5   6   7   >