Re: Can somebody give me an advice about what to learn?

2012-10-03 Thread Steven D'Aprano
On Wed, 03 Oct 2012 21:47:33 -0700, Chris Rebert wrote: > On Wed, Oct 3, 2012 at 11:31 AM, Wolfgang Keller > wrote: >>> I'm really new to Usenet/Newsgroups, but... I'd like to learn some new >>> programming language, because I learnt a bit of Perl though its OOP is >>> ugly. So, after searching a

Re: How to execute commands on a windows machine from a Linux machine

2012-10-03 Thread Andrew Berg
On 2012.10.04 00:13, Shambhu Rajak wrote: > Here i have two questions, > > 1. I want to write a framework for Linux machine that can execute > commands on windows machine: > > How to create a persistent shell between Linux and Windows machine. > > 2. I require to extract windows dis

How to execute commands on a windows machine from a Linux machine

2012-10-03 Thread Shambhu Rajak
Here i have two questions, 1. I want to write a framework for Linux machine that can execute commands on windows machine: How to create a persistent shell between Linux and Windows machine. 2. I require to extract windows disk management features, for eg: Number of drives on that wi

Re: Can somebody give me an advice about what to learn?

2012-10-03 Thread Chris Rebert
On Wed, Oct 3, 2012 at 11:31 AM, Wolfgang Keller wrote: >> I'm really new to Usenet/Newsgroups, but... I'd like to learn some >> new programming language, because I learnt a bit of Perl though its >> OOP is ugly. So, after searching a bit, I found Python and Ruby, and >> both of they are cute. So,

Re: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-03 Thread Chris Rebert
On Wed, Oct 3, 2012 at 8:21 PM, Ian Kelly wrote: > On Wed, Oct 3, 2012 at 8:04 PM, Steven D'Aprano > wrote: >> On Wed, 03 Oct 2012 14:13:10 -0700, Piotr Dobrogost wrote: >> >>> Why is pylauncher in Python 3.3 being installed in Windows folder and >>> not in Program Files folder? Installing into W

Re: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-03 Thread Ian Kelly
On Wed, Oct 3, 2012 at 8:04 PM, Steven D'Aprano wrote: > On Wed, 03 Oct 2012 14:13:10 -0700, Piotr Dobrogost wrote: > >> Why is pylauncher in Python 3.3 being installed in Windows folder and >> not in Program Files folder? Installing into Windows folder was maybe >> acceptable 10 years ago but not

Re: + in regular expression

2012-10-03 Thread Ian Kelly
On Wed, Oct 3, 2012 at 9:01 PM, contro opinion wrote: > why the "\s{6}+" is not a regular pattern? Use a group: "(?:\s{6})+" -- http://mail.python.org/mailman/listinfo/python-list

final question: logging to stdout and updating files

2012-10-03 Thread Littlefield, Tyler
pHello all: I've seen frameworks like django reload files when it detects that they've been changed; how hard would it be to make my engine reload files that it detects were changed? I'm also curious how hard it would be to build in some error recovery. For example right now when an exception

+ in regular expression

2012-10-03 Thread contro opinion
>>> str=" gg" >>> x1=re.match("\s+",str) >>> x1 <_sre.SRE_Match object at 0xb7354db0> >>> x2=re.match("\s{6}",str) >>> x2 <_sre.SRE_Match object at 0xb7337f38> >>> x3=re.match("\s{6}+",str) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/re.py", line 13

Re: fastest data structure for retrieving objects identified by (x,y) tuple?

2012-10-03 Thread Steven D'Aprano
On Thu, 04 Oct 2012 01:58:16 +, Steven D'Aprano wrote: > adict: 24712 > alist: 23127324 [...] > So in this situation, a list of lists uses about 100 times > more memory than a dict, but look-ups are about 6% faster. Correction: about 1000 times more memory. Sorry for the typo. -- Steven -

Re: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-03 Thread Steven D'Aprano
On Wed, 03 Oct 2012 14:13:10 -0700, Piotr Dobrogost wrote: > Why is pylauncher in Python 3.3 being installed in Windows folder and > not in Program Files folder? Installing into Windows folder was maybe > acceptable 10 years ago but not now... Read the PEP: http://www.python.org/dev/peps/pep-039

Re: fastest data structure for retrieving objects identified by (x,y) tuple?

2012-10-03 Thread Steven D'Aprano
On Wed, 03 Oct 2012 18:30:24 -0400, Benjamin Jessup wrote: > I have a group of objects identified by unique (x,y) pairs and I want to > find out an object's "neighbors" in a matrix of size 2400 x 2400. [...] > There is either a neighbor, or a null value. I always know the (x,y) > pair to check the

Re: fastest data structure for retrieving objects identified by (x, y) tuple?

2012-10-03 Thread Joshua Landau
On 3 October 2012 23:30, Benjamin Jessup wrote: > I have a group of objects identified by unique (x,y) pairs and I want to > find out an object's "neighbors" in a matrix of size 2400 x 2400. ># >#obj# # # ># ># # #obj# 3 x 3 Exa

Re: Combinations of lists

2012-10-03 Thread Joshua Landau
On 3 October 2012 21:15, Steen Lysgaard wrote: > Hi, > > thanks for your interest. Sorry for not being completely clear, yes > the length of m will always be half of the length of h. > (Please don't top post ) I have a solution to this, then. It'

fastest data structure for retrieving objects identified by (x,y) tuple?

2012-10-03 Thread Benjamin Jessup
I have a group of objects identified by unique (x,y) pairs and I want to find out an object's "neighbors" in a matrix of size 2400 x 2400. # #obj# # # # # # #obj# 3 x 3 Example # # # # # ##

Re: design question:game skill system

2012-10-03 Thread Littlefield, Tyler
I just wanted to say thanks to all the people that provided input, both aonand off list. It gave me a good direction to head in. Thanks again. On 10/2/2012 2:34 PM, Ian Kelly wrote: On Tue, Oct 2, 2012 at 2:00 PM, Littlefield, Tyler wrote: Hello all: I'm looking at a skill/perk system, where t

Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-03 Thread Piotr Dobrogost
Why is pylauncher in Python 3.3 being installed in Windows folder and not in Program Files folder? Installing into Windows folder was maybe acceptable 10 years ago but not now... -- http://mail.python.org/mailman/listinfo/python-list

Re: Emulating C++ namespaces with ChainMap and metaclass trickery

2012-10-03 Thread Mark Adam
On Wed, Oct 3, 2012 at 1:26 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > C++ namespaces are useful for encapsulating related objects within a > single file, subdividing the global namespace without using classes. > Python has modules, but they come in separate files. > > Us

Re: Combinations of lists

2012-10-03 Thread 88888 Dihedral
Oscar Benjamin於 2012年10月4日星期四UTC+8上午4時29分51秒寫道: > Oscar wrote: > > >>> def uniquecombinations(h, m): > > >>> for ha in submultisets(h, len(h)//2): > > >>> hb = list(h) > > >>> for c in ha: > > >>> hb.remove(c) > > >>> yield [m[0] + a for a in ha] + [m[1

Re: Combinations of lists

2012-10-03 Thread Oscar Benjamin
Oscar wrote: >>> def uniquecombinations(h, m): >>> for ha in submultisets(h, len(h)//2): >>> hb = list(h) >>> for c in ha: >>> hb.remove(c) >>> yield [m[0] + a for a in ha] + [m[1] + b for b in hb] >>> >>> h = ['A', 'A', 'B', 'B'] >>> m = ['a', 'b'] >>> >>> f

Re: Combinations of lists

2012-10-03 Thread Steen Lysgaard
Hi, thanks for your interest. Sorry for not being completely clear, yes the length of m will always be half of the length of h. /Steen 2012/10/3 Joshua Landau : > On 3 October 2012 20:20, Oscar Benjamin wrote: >> >> On 3 October 2012 15:26, Steen Lysgaard wrote: >> > Hi, >> > >> > I am looking

Re: Combinations of lists

2012-10-03 Thread Joshua Landau
On 3 October 2012 20:20, Oscar Benjamin wrote: > On 3 October 2012 15:26, Steen Lysgaard wrote: > > Hi, > > > > I am looking for a clever way to compute all combinations of two lists. > Look > > at this example: > > > > h = ['A','A','B','B'] > > m = ['a','b'] > > > > the resulting combinations s

Re: Combinations of lists

2012-10-03 Thread Oscar Benjamin
On 3 October 2012 15:26, Steen Lysgaard wrote: > Hi, > > I am looking for a clever way to compute all combinations of two lists. Look > at this example: > > h = ['A','A','B','B'] > m = ['a','b'] > > the resulting combinations should be of the same length as h and each > element in m can be used tw

Re: Combinations of lists

2012-10-03 Thread Joshua Landau
On 3 October 2012 15:26, Steen Lysgaard wrote: > Hi, > > I am looking for a clever way to compute all combinations of two lists. > Look at this example: > > h = ['A','A','B','B'] > m = ['a','b'] > > the resulting combinations should be of the same length as h and each > element in m can be used t

Re: Can somebody give me an advice about what to learn?

2012-10-03 Thread Wolfgang Keller
> I'm really new to Usenet/Newsgroups, but... I'd like to learn some > new programming language, because I learnt a bit of Perl though its > OOP is ugly. So, after searching a bit, I found Python and Ruby, and > both of they are cute. So, assuming you'll say me "learn python", why > should I learn

Emulating C++ namespaces with ChainMap and metaclass trickery

2012-10-03 Thread Steven D'Aprano
C++ namespaces are useful for encapsulating related objects within a single file, subdividing the global namespace without using classes. Python has modules, but they come in separate files. Using Python 3.3's ChainMap type, and some metaclass trickery, I abuse the class keyword to (almost) emu

Need Data Architect/Technical Business Analyst For 6months at San Rafael, CA

2012-10-03 Thread ram dev
Good Day, urgent Requirement : San Rafael, CA 6 months As a member of the Market Intelligence team, the Data Architect/Technical Business Analyst will be tasked with assessing current state business process and corresponding data flows, understanding Marketing business objectives, and identify

Re: Can somebody give me an advice about what to learn?

2012-10-03 Thread Hans Mulder
On 1/10/12 00:14:29, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> you can't, for instance, retain a "socket connection object" across >> that sort of reload. > > Yeah, that's a problem. There's nothing fundamental about a TCP > connection endpoint which precludes it being ser

Re: Experimental Python-based shell

2012-10-03 Thread Jonathan Hayward
I am open to suggestions and patches. I don't think the syntax strange, though: it offers a clear and distinct way to differentiate Python and shell commands, and shell commands can access Python variables when specified. And it is a simple rule, without footnotes needed. On Wed, Oct 3, 2012 at 11

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Daniel Klein
On Wednesday, October 3, 2012 5:40:12 PM UTC+1, Daniel Klein wrote: > Thank you Steven! That was PRECISELY what I was looking for. (And kwpolska!) -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Daniel Klein
Thank you Steven! That was PRECISELY what I was looking for. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Steven D'Aprano
On Wed, 03 Oct 2012 09:23:03 -0700, Daniel Klein wrote: > So ideally I would tell the script which language I'm currently > importing and based on that it would write to the appropriate text > fields. But I don't know how to abstract this: > > tempmes.polish = row[1] > > Well, I do. Like this: >

Re: Are ABCs an anti-pattern?

2012-10-03 Thread Demian Brecht
> > > ABCs were added (fairly recently) in 3.0 for the reasons given in > http://python.org/dev/peps/**pep-3119/ > It was expected that it would take awhile for them to see good, pythonic > uses. We obviously did okay without them up to 2.7. > I read the PEP b

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Kwpolska
On Wed, Oct 3, 2012 at 6:23 PM, Daniel Klein wrote: > tempmes.polish = row[1] > > Well, I do. Like this: > > eval("tempmes." + language + " = row[1]") > > But... eval is evil, no? There's got to be a better way? > -- > http://mail.python.org/mailman/listinfo/python-list Easy. tempmes = myissue.n

Re: Experimental Python-based shell

2012-10-03 Thread Amirouche Boubekki
2012/10/3 Jonathan Hayward > The chief benefit besides the searching, so far, is that you can use Py3k > mixed with shell commands as the scripting language--so script in Python > instead of bash. > > When using Python for scripting, Python lines are indented by an extra tab > (or four spaces) wh

Re: Combinations of lists

2012-10-03 Thread Manuel Pégourié-Gonnard
Steven D'Aprano scripsit : > On Wed, 03 Oct 2012 16:26:43 +0200, Steen Lysgaard wrote: > >> This is achieved by the code below, this however needs to go through all >> possible combinations (faculty of len(h)) and rule out duplicates as >> they occur and this is too much if for example len(h) is 1

Help me abstract this (and stop me from using eval)

2012-10-03 Thread Daniel Klein
Hi! I've got import scripts for a bunch of csv files into an sqlite database. I have one csv file per language. I don't write directly to the sqlite db; this is a django app and I'm creating items in my django models. My script (scripts, unfortunately) work just fine, but it feels beyond stupi

Re: Combinations of lists

2012-10-03 Thread Steven D'Aprano
On Wed, 03 Oct 2012 16:26:43 +0200, Steen Lysgaard wrote: > Hi, > > I am looking for a clever way to compute all combinations of two lists. > Look at this example: > > h = ['A','A','B','B'] > m = ['a','b'] > > the resulting combinations should be of the same length as h and each > element in m

Re: Experimental Python-based shell

2012-10-03 Thread Jonathan Hayward
The chief benefit besides the searching, so far, is that you can use Py3k mixed with shell commands as the scripting language--so script in Python instead of bash. When using Python for scripting, Python lines are indented by an extra tab (or four spaces) while shell-like commands are not indented

Re: Combinations of lists

2012-10-03 Thread Alain Ketterlin
Steen Lysgaard writes: > I am looking for a clever way to compute all combinations of two > lists. Look at this example: > > h = ['A','A','B','B'] > m = ['a','b'] > > the resulting combinations should be of the same length as h and each > element in m can be used twice. The sought after result us

Combinations of lists

2012-10-03 Thread Steen Lysgaard
Hi, I am looking for a clever way to compute all combinations of two lists. Look at this example: h = ['A','A','B','B'] m = ['a','b'] the resulting combinations should be of the same length as h and each element in m can be used twice. The sought after result using h and m from above is:

Re: Experimental Python-based shell

2012-10-03 Thread Amirouche Boubekki
Héllo, 2012/10/3 Jonathan Hayward > I've made an experimental Python-based Unix/Linux shell at: > > http://JonathansCorner.com/cjsh/ > > An experimental Unix/Linux command line shell, implemented in Python 3, > that takes advantage of some more recent concepts in terms of usability and > searchi

Re: Experimental Python-based shell

2012-10-03 Thread Jorgen Grahn
On Tue, 2012-10-02, Jonathan Hayward wrote: > I've made an experimental Python-based Unix/Linux shell at: > > http://JonathansCorner.com/cjsh/ > > An experimental Unix/Linux command line shell, implemented in Python > 3, that takes advantage of some more recent concepts in terms of > usability and

Re: unit testing class hierarchies

2012-10-03 Thread Oscar Benjamin
On 3 October 2012 02:20, Steven D'Aprano wrote: > > But surely, regardless of where that functionality is defined, you still > need to test that both D1 and D2 exhibit the correct behaviour? Otherwise > D2 (say) may break that functionality and your tests won't notice. > > Given a class hierarchy

Re: design question:game skill system

2012-10-03 Thread Jean-Michel Pichavant
- Original Message - > Hello all: > I'm looking at a skill/perk system, where the player builds up his > char > by using perk points to add abilities. > Each perk is under a category, and generally costs go up as you > increase > the perk. > So I'm trying to figure something out; first, I

Re: local variable 'a' referenced b

2012-10-03 Thread Demian Brecht
> > One problem with short examples is they mask the reason for the code to > be structured that way. > > Couldn't agree more (I don't think I've ever written a nested function outside a closure). I made the assumption that the OP wasn't asking about closures based on his code samples. In hindsight