ANN: cclib 0.7 released

2007-03-22 Thread baoilleach
cclib 0.7 is now available for download from http://cclib.sf.net.

cclib is an open source library, written in Python, for parsing and
interpreting the results of computational chemistry packages. It
currently parses output files from ADF, GAMESS (US), GAMESS-UK,
Gaussian, Jaguar and PC GAMESS.

The main new features in this release are:

* a Jaguar parser
* cclib now extracts the Gaussian basis, the MP-corrected energies,
and the Cartesian displacement vectors
* Charge Decomposition Analysis, Fragment analysis

For more details, see http://cclib.sf.net/wiki/index.php/Changelog

Among other data, cclib extracts:

* coordinates
* atomic orbital information
* molecular orbital information
* information on vibrational modes
* the results of a TD-DFT calculation

(For a complete list see http://cclib.sf.net/wiki/index.php/Parsed_Data).

cclib also provides some calculation methods for interpreting some
electronic
properties of molecules using analyses such as:

* Mulliken population analysis
* Overlap population analysis
* Calculation of Mayer's bond orders.

For information on how to use cclib, see
   http://cclib.sf.net/wiki/index.php/Using_cclib.

If you need help, find a bug, want new features or have any questions,
please
send an email to our mailing list:
   [EMAIL PROTECTED]

Regards,
   The cclib development team

-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: Technical Answer - Protecting code in python

2007-03-22 Thread Steven D'Aprano
On Wed, 21 Mar 2007 20:59:57 -0400, Bart Willems wrote:

 Or the consultant wants to be sure that the two dimwitted nimcumpoops at 
 the office who /think/ they can write code don't screw up the script 
 when they're trying to 'fix' or 'improve' something. And blame the 
 consultant if the script all of a sudden stops working 'we did not do 
 anything. It just stopped working all of a sudden'.
 Or he doesn't want to expose the passwords needed to logon to the 
 database server. Or whatever.
 
 So, there are reasons enough why someone wants to render his code 
 immutable and/or unreadable *to some extent*.

And that's what I've been asking. How to protect the code depends on what
you are trying to protect it from. Why is that so hard to understand?

In the above scenarios, one solution is:

chmod a-w script.py

If they don't have write permission, they can't improve it by adding
bugs. If they take the time and effort to give themselves write
permission, then they have accepted responsibility for breaking it.


 The OP clearly states that he does not want a discussion as to why to 
 protect the code.

The OP might not want such a discussion, but without it, any answers he
gets are sure to be bad answers except by accident.



 All he wants is something that turns 'readable, 
 changeable python' into 'unreadable, immutable python'.

chown scriptuser script.py  # a unique user
chmod a-rwx script.py
chmod u+rx script.py

I believe that fully meets the functional requirements. Where shall I send
the invoice?


-- 
Steven D'Aprano 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Technical Answer - Protecting code in python

2007-03-22 Thread flit
I didn´t reply to the last D´Aprano reply just to avoid this kind of
social war.
And yes, I know that if I want 100% security I should not distribute
my code. And there is a better way that is not doing any code to be
more secure and bug-free (now I am using irony).
And no, I am not supporter of software patents, RIAA and DRM.

And Mr. Willems understood very well my problem and my condition. And
others too in the beginning of the post.
But look...after mr D´Aprano enters it starts this social warfare.

So where is the troll?

In fact I think the heroes series was based in this thread (Hiros read
it and come back in time)
Because there is some people who have special DNAs that give powers to
see beyond their problems and environments, so they can read the post,
understand and give technical details, understanding this is not
comp.lang.python.social-activism-political-be-open-not-evil

About trolls:

No way I will do this question only to say to others:
Look python can´t do this like  does..
or
Look now I will active the pet-people-living-in-welfare-trying-to-be-
political in the list and they will join and sing songs about the
revolution..

if you do a search in this group for this problem you will see more
political whining than answers in this type of questions...

Just look this post!! Seriously read one by one Begining ok.. 2
ok ,3 ok , 4 ok .. and bang..!!!

Going back in the beginning I said :

 So PLEASE, don't try to convince me about the social / economical /
open source / give to all / be open / all people are honest until
prove contrary / dance with the rabbits... 

So who is failing to acknowledge the question? AND AGAIN someone will
search for protecting python code and will see the same whining and
political threads...
I think the python community is great, and I love the python language,
if you search for superflit in this group you will see that I love
python and the community, I am a newbie, but I am not imposing my
beliefs I am just saying that my reality is a little different and I
need a answer for a particular problem.
That is the reason because I always recommend people to travel out of
their CONTINENT, and stay more than 5 months living in another
culture.
I can elaborate a more intelectual answer but sorry. I have to work
at 6:00 am to pay my bills, and if I get unemployed there is no
welfare, nothing , nada, zero.
I believe in reincarnation, so next time I will aim better :)
For me this thread is closed, and I think this is the most crazy
thread in this list.
Thank you all, for the technical answers, and sorry if I insult anyone
directly or indirectly ( I am a political incorrect person)
That´s all folks..finito





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Technical Answer - Protecting code in python

2007-03-22 Thread Steven D'Aprano
On Wed, 21 Mar 2007 22:59:46 -0700, flit wrote:

 Going back in the beginning I said :
 
  So PLEASE, don't try to convince me about the social / economical /
 open source / give to all / be open / all people are honest until
 prove contrary / dance with the rabbits... 

I have done NONE of that.

I've just pointed out, time and time again, that you haven't asked a
meaningful question.

Even after all these posts, still won't tell us what you are trying to
protect against. People copying your program? Competitors infringing your
patents? Your corrupt and bad government (your words) infringing your
moral rights as an author? Your customer editing your program and breaking
it? Who knows? I don't. I wonder whether even you do.

You keep asking for a technical solution, even if a technical solution
is not appropriate, but you won't tell us what the problem is. Tell us the
threat you want to protect against, and we'll suggest meaningful solutions.


-- 
Steven D'Aprano 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Technical Answer - Protecting code in python

2007-03-22 Thread Steven D'Aprano
On Thu, 22 Mar 2007 09:11:51 +1100, Ben Finney wrote:

 Steven D'Aprano [EMAIL PROTECTED] writes:
 
 Is your program valuable? Is it worth money? Then the 90% of script
 kiddies will just wait three days, and download the program off the
 Internet after the real hackers have broken your protection.
 
 The real hackers wouldn't be doing that.
 
 The crackers, however, might.

I quote Bruce Schneier:

[quote]
For years I have refused to play the semantic hacker vs. cracker game.
There are good hackers and bad hackers, just as there are good
electricians and bad electricians. Hacker is a mindset and a skill set;
what you do with it is a different issue.
[end quote]

See his essay on What is a hacker here:
http://www.schneier.com/blog/archives/2006/09/what_is_a_hacke.html

In addition, virtually nobody outside of the IT hacker subculture knows
what you're talking about if you talk about crackers. Out network was
brought down by a biscuit???



-- 
Steven D'Aprano 

-- 
http://mail.python.org/mailman/listinfo/python-list


Color Segmentation w/ PIL?

2007-03-22 Thread MooMaster
I'm trying to write a Digital Image Processing program using the PIL
library, and upon consultation of the Handbook I see that it seems to
have built in functions to run Edge Detection (in the ImageFilter
module), but I don't see anything about Segmentation. Are there any
built-in tools to do this operation? Has anyone done this operation
with PIL in the past that can lead me in the right direction?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Garbage collection

2007-03-22 Thread Steve Holden
Alex Martelli wrote:
 Tom Wright [EMAIL PROTECTED] wrote:
 
 real programs.  I can't help thinking that there are some situations where
 you need a lot of memory for a short time though, and it would be nice to
 be able to use it briefly and then hand most of it back.  Still, I see the
 practical difficulties with doing this.
 
 What I do in those cases:
 a. fork
 b. do the memory-hogging work in the child process
 c. meanwhile the parent just waits
 d. the child sends back to the parent the small results
 e. the child terminates
 f. the parent proceeds merrily
 
 I learned this architectural-pattern a long, long time ago, around the
 time when fork first got implemented via copy-on-write pages... 
 
Yup, it's easier to be pragmatic and find the real solution to your 
problem than it is to try and mould reality to your idea of what the 
solution should be ...

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Steve Holden
Terry Reedy wrote:
 Mark T [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 | This is interesting:
 |
 |  class Test(object):
 | ...   def __getattribute__(self,n):
 | ... print 'reading',n
 | ... return object.__getattribute__(self,n)
 | ...   def __setattr__(self,n,v):
 | ... print 'writing',n,v
 | ... return object.__setattr__(self,n,v)
 | ...
 |  x=Test()
 |  x.a=1; x.b=2; x.c=3
 | writing a 1
 | writing b 2
 | writing c 3
 |  x.a=x.b=x.c
 | reading c
 | writing a 3
 | writing b 3
 | 
 |
 | I wouldn't have expected a to be assigned first in a right-to-left 
 parsing
 | order.  The result is the same in any case.
 
 The assignment order is specified in the language reference.

Where? I'm looking at

   http://docs.python.org/ref/assignment.html

right now.

 But many never read and those who do can forget.
 And even if the coder reads and remembers, a code reader may not have.
 Which is why I suggested multiple statements in explicit order when it 
 really matters.
 
The current docs define

a, b = c, d

and

a = b, c, d

and

a, b, c = d

as valid assignments, but I can't find the part where

a = b = c

is defined. Help me out here. It looks as though the real syntax should 
be something like

assignment_stmt ::= (target_list =)+ expression_list |
 (target_list =)+ assignment_stmt

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Anton Vredegoor
Steven D. Arnold wrote:

 Neosynapse is seeking a senior software developer located in or  

Subtract ten points from your credibility for writing senior here.

 willing to relocate to the Northern VA area to join a project  
 building one of the largest grid computing data platforms in the  
 world.  Skill and experience required for this engagement include:

Another 10 points minus for claiming to be the largest (biggest, 
industry leader etc.). Are you looking for a developer or is this just 
an ad for your company?

 * at least 7 years experience in professional software development;

Minus 20 points for using the term professional. Open source is cool.

 * at least 3 years of Python software development experience;

OK. You can ask for that. As long as you're not blind when someone shows 
you some code. I mean some people can't see code until it's connected to 
some 'job'.

 * proven experience with design, implementation, debugging and  
 documentation of large projects;

Hmm. Why, may I ask? Can you even code? Who are you anyway?

 * past experience with the development of networking client and  
 server software;

You really seem to know what you want, eh?

 * experience using SQL databases in the development of software  
 applications;

Experience, experience, experience. Why don't you just re-hire the one 
you just fired because he wouldn't say yes to your absurd demands? I 
mean after he made a honest guesstimate of the time frame necessary for 
the job and you pinned him down to the minute?

 * excellent written and oral communication skills, including the  
 ability to clearly explain design choices and discuss alternatives  
 with colleagues and managers.

Yeah.

 The following skills are desirable but not mandatory:
 * experience using SAN file systems;
 * experience with general web software development;
 * experience writing applications that leverage Oracle databases;
 * experience writing and integrating C modules with Python;
 * experience with Ruby or Ruby on Rails.

* endure stupid boss messing with the creative process.

 You must be able to function independently as you will work from home  
 a significant amount of time on this project.  Limited travel to PA,  
 NJ, and CO will be required.  The initial phase of this project will  
 last 6 months, with follow-on work planned for approximately 3 years.

Says you. It could be anything from 3 months to ten years, depending on 
how often you change your mind.

 If interested and qualified for this position, please submit your  
 detailed resume, contact and rate requirements to [EMAIL PROTECTED]  
 with the subject line PY-5.  Principals only.

Go away with that resume  Why do you think you have a right to my 
personal info when you're not giving any? By the way, I'm in Europe, 
there's more than just US you know.

A.

/rant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regexp problem with `('

2007-03-22 Thread Steve Holden
Zeng Nan wrote:
 On Thu, Mar 22, 2007 at 01:26:22AM -0700, Johny wrote:
 I have  the following text

 titleGoods Item  146 (174459989)  - OurWebSite/title

 from which I need to extract
 `Goods Item  146 '

 Can anyone help with regexp?
 Thank you for help
 L.
 
 (Goods\s+Item\s+146\s+)
 
 
[snigger]

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mastering Python

2007-03-22 Thread Michael Bentley

   For future reference, and I hope you don't mind the lesson, the past
 tense of bind is bound (I can't state it as a firm rule, but many
 *ind words seem to go *ound: bind, find, wind [as in wrap, not blowing
 in the...], grind - bound, found, wound [not to confuse with an
 injury], ground [not to confuse with dirt]... But mind - minded G)


blind - blound  # couldn't resist yet another counterexample ;-)






-- 
http://mail.python.org/mailman/listinfo/python-list


How to use unix_md5_crypt from Perl in Python?

2007-03-22 Thread Nico Grubert
Dear list members,

I have a Perl script which crypts a password using a clearteaxt password 
and a username.

Example:
   username = '[EMAIL PROTECTED]'
   password = 'root'

The crypted password is: 'roK20XGbWEsSM'

The crypted password always starts with the first 2 characters of the 
username (here: 'ro' from '[EMAIL PROTECTED]').

The Perl script contains this code and I am wondering how I can do this 
in Python:
#
my $CryptedPw = '';
# md5 pw
if ($Self-{ConfigObject}-Get('AuthModule::DB::CryptType') 
 $Self-{ConfigObject}-Get('AuthModule::DB::CryptType') eq 'md5') {
 $CryptedPw = unix_md5_crypt($Pw, $Param{UserLogin});
}
# crypt pw
else {
 # crypt given pw (unfortunately there is a mod_perl2 bug
 # on RH8 - check if
 # crypt() is working correctly) :-/
 if (crypt('root', '[EMAIL PROTECTED]') eq 'roK20XGbWEsSM') {
 $CryptedPw = crypt($Pw, $Param{UserLogin});
 }
 else {
 $Self-{LogObject}-Log(
 Priority = 'notice',
 Message = The crypt() of your mod_perl(2) is not working 
correctly! Update mod_perl!,
 );
 my $TempUser = quotemeta($Param{UserLogin});
 my $TempPw = quotemeta($Pw);
 my $CMD = perl -e \print crypt('$TempPw', '$TempUser');\;
 open (IO,  $CMD | ) || print STDERR Can't open $CMD: $!;
 while (IO) {
 $CryptedPw .= $_;
 }
 close (IO);
 chomp $CryptedPw;
 }
}
#


What do I have to do in Python to create the crypted password 
'roK20XGbWEsSM' by using '[EMAIL PROTECTED]' for username and 'root' for 
password?

I tried:
  username = '[EMAIL PROTECTED]'
  password = 'root'
  import crypt
  crypt.crypt(username, password)
'roowueH.vq6VM'
 

This creates 'roowueH.vq6VM' but not 'roK20XGbWEsSM'. :-(

Thanks in advance,
Nico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Steve Holden
Mark T wrote:
 Alex Martelli [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 John Nagle [EMAIL PROTECTED] wrote:

 Marcin Ciura wrote:

 Neither would I. I must have expressed myself not clearly enough.
 Currently
 x = y = z
 is roughly equivalent to
 x = z
 y = z
 I propose to change it to
 y = z
 x = z
 Actually, it is equivalent to

   y = z
   x = y
 Not really:

 class chatty(object):
 ...   def __init__(self): self.__dict__['__hide'] = {}
 ...   def __setattr__(self, name, value):
 ... print 'sa', name, value
 ... self.__dict__['__hide'][name] = value
 ...   def __getattr__(self, name):
 ... print 'ga', name
 ... return self.__dict__['__hide'].get(name)
 ...
 c = chatty()
 x = c.zop = 23
 sa zop 23
 As you can see, there is no read-access to c.zop, which plays the role
 of y there.


 Alex
 
 This is interesting:
 
 class Test(object):
 ...   def __getattribute__(self,n):
 ... print 'reading',n
 ... return object.__getattribute__(self,n)
 ...   def __setattr__(self,n,v):
 ... print 'writing',n,v
 ... return object.__setattr__(self,n,v)
 ...
 x=Test()
 x.a=1; x.b=2; x.c=3
 writing a 1
 writing b 2
 writing c 3
 x.a=x.b=x.c
 reading c
 writing a 3
 writing b 3
 
 I wouldn't have expected a to be assigned first in a right-to-left parsing 
 order.  The result is the same in any case.
 
It would be nice if your confusion could have been avoided by reading 
the reference manual, but unfortunately the current syntax definition 
doesn't seem to even acknowledge the possibility of multiple assignments 
such as the one under discussion!

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Duncan Booth
Virgil Dupras [EMAIL PROTECTED] wrote:

 I think I see what Marcin means. The 'node' is changed too fast in the
 chain, and next is assigned to 'nextnode' instead of being assigned to
 node.

I can see why Marcin was confused. Many other languages assignment is an 
expression, so a=b=c is simply a=(b=c). In Python it isn't an expression, 
the chained assignment is a specific part of the syntax, so (as with 
chained comparisons) the semantics may be surprising to the uninitiated.

As a matter of interest do PyLint or PyChecker check for this situation 
(chained assignment where the target of an assignment is also a 
subexpression of a later assignment)?

Also it may be worth noting that unpacking has a similar behaviour:

   node, node.next = nextnode, nextnode

has the same result as the chained assignment: the RHS is a tuple and is 
fully evaluated before the assignment, but the LHS is not a tuple and the 
assignment happens strictly left to right with each assignment fully 
completed before proceeding to the next one.

-- 
http://mail.python.org/mailman/listinfo/python-list


Regexp problem with `('

2007-03-22 Thread Johny
I have  the following text

titleGoods Item  146 (174459989)  - OurWebSite/title

from which I need to extract
`Goods Item  146 '

Can anyone help with regexp?
Thank you for help
L.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why brackets commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-22 Thread Laurent Pointal
Dennis Lee Bieber a écrit :
 On Thu, 22 Mar 2007 03:27:37 +1100, Steven D'Aprano
 [EMAIL PROTECTED] declaimed the following in
 comp.lang.python:
 
 So what should a b c d be? 

 (a, b, c, d)
 a(b, c, d)
 a(b, (c, d))
 a(b(c, d))
 a(b(c(d)))

 Have I missed anything? Which is the right way? Who can tell?

   a(b)(c)(d)
 or, explicit,
   ((a(b))(c))(d)
 
 G

(Yeah ((Lisp) (is back)))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Swig-user] How to receive a FILE* from Python under MinGW?

2007-03-22 Thread Giovanni Bajo
On 22/03/2007 3.46, Carl Douglas wrote:

 Hi Giovanni,
 
 I was wondering if gccmrt can be used with older 3.x versions of GCC?
 
 Thanks

I think so, but I have not tried it. You just need to copy gccmrt to the bin 
directory, and then copy libmsvcrt.a into libmsvcr60.a, and libmsvcrtd.a 
into libmsvcr60d.a. After that, it should just works.

Let me know if it works for you, so that I can report results on the webpage.
-- 
Giovanni Bajo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regexp problem with `('

2007-03-22 Thread Zeng Nan
On Thu, Mar 22, 2007 at 01:26:22AM -0700, Johny wrote:
 I have  the following text
 
 titleGoods Item  146 (174459989)  - OurWebSite/title
 
 from which I need to extract
 `Goods Item  146 '
 
 Can anyone help with regexp?
 Thank you for help
 L.

(Goods\s+Item\s+146\s+)

-- 
Zeng Nan   

MY BLOG: http://zengnan.blogspot.com
Public Key: http://pgp.mit.edu/ | www.keyserver.net

~~~
In Lexington, Kentucky, it's illegal to carry an ice cream cone in your
pocket.

~~~


pgp46CeY9IZzI.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to receive a FILE* from Python under MinGW?

2007-03-22 Thread Giovanni Bajo
On 22/03/2007 3.13, John Pye wrote:

 I suggest people to try my GCC 4.1.2 binary installer for Windows which fully
 integrates with Python and has scripts in place to solve the MSVCR71.DLL
 problem. It was announced on this very list a few days ago:

 http://www.develer.com/oss/GccWinBinaries
 
 Hi Giovanni,
 
 Thanks very much for that suggestion. It looks like you have done some
 good work on addressing this problem.
 
 I wonder if you might be able to expand on what those 'serious
 problems' with GCC 4.x on the Windows platform are?

Have a look here:
http://www.mingw.org/MinGWiki/index.php/GccStatus

 Also, can you comment on how one might use your compiler bundle with
 MSYS? In particular, I like to run SCons from an MSYS prompt. Assuming
 I don't want to kill my old MinGW and Cygwin installations, how do you
 recommend that one proceeds to set up a working GCC 4 environment on
 Windows? (I haven't downloaded it just yet; I'm on Linux today!)

I personally don't use MSYS so I don't know exactly. I use SCons too, and I 
simply run it from the normal command prompt.

I *believe* it's sufficient to unpack MSYS somewhere (you can either unpack it 
*over* the directory where you installed my GCC package, or somewhere else, I 
believe it works either way); since the GCC binaries are added to the system 
PATH by the installer, you should able to run it anyway. You can try by simply 
invoking gcc -v at the MSYS prompt and see if it's picking up the right 
version of GCC.

I would appreciate if you give some feedback about this. I would like to 
incorporate your findings on the webpage.
-- 
Giovanni Bajo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Steve Holden
Duncan Booth wrote:
 Virgil Dupras [EMAIL PROTECTED] wrote:
 
 I think I see what Marcin means. The 'node' is changed too fast in the
 chain, and next is assigned to 'nextnode' instead of being assigned to
 node.
 
 I can see why Marcin was confused. Many other languages assignment is an 
 expression, so a=b=c is simply a=(b=c). In Python it isn't an expression, 
 the chained assignment is a specific part of the syntax, so (as with 
 chained comparisons) the semantics may be surprising to the uninitiated.
 
 As a matter of interest do PyLint or PyChecker check for this situation 
 (chained assignment where the target of an assignment is also a 
 subexpression of a later assignment)?
 
Where's the published syntax for chained assignment?

 Also it may be worth noting that unpacking has a similar behaviour:
 
node, node.next = nextnode, nextnode
 
 has the same result as the chained assignment: the RHS is a tuple and is 
 fully evaluated before the assignment, but the LHS is not a tuple and the 
 assignment happens strictly left to right with each assignment fully 
 completed before proceeding to the next one.
 
Well that is explained (albeit badly) in the reference manual:

An assignment statement evaluates the expression list (remember that 
this can be a single expression or a comma-separated list, the latter 
yielding a tuple) and assigns the single resulting object to each of the 
target lists, from left to right.

That wording appears to be a rather bad mix of factoids from unpacking 
and chained assignment. Is it just me, or does this whole section need a 
rewrite?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Python Oracle 10g odbc blob insertion problem

2007-03-22 Thread Godzilla
Dear all,

I cannot find a solution for my problem with inserting a blob object
(4000 in length) into an ORACLE database via ODBC.


I have tried the two ways of inserting the blob object (a zip file):


1)
fp = open(c:/test/test.zip, r+b)
data = fp.read()
s = odbc.odbc(cs)
qry = s.cursor()
qry.execute(Insert into tBlob (data) values ('%s') %
data.encode('hex'))


return the error: Input String Too Long Limit: 4096


2)
qry.execute(Insert into tBlob (data) values (?),
data.encode('hex'))


does not return error, but it does not insert the record correctly.


Any help will be fully appreciated...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Anton Vredegoor
Steve Holden wrote:

 /rant

 Feel better now?

Yes! But *now* I'm afraid it will have negative consequences for my 
future employability. However if it will lead to adjusting the kind of 
submissions at http://www.python.org/community/jobs/
it was probably worth it.

A.

'thanks for asking'
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Oracle 10g odbc blob insertion problem

2007-03-22 Thread Steve Holden
Godzilla wrote:
 Dear all,
 
 I cannot find a solution for my problem with inserting a blob object
 (4000 in length) into an ORACLE database via ODBC.
 
 
 I have tried the two ways of inserting the blob object (a zip file):
 
 
 1)
 fp = open(c:/test/test.zip, r+b)
 data = fp.read()
 s = odbc.odbc(cs)
 qry = s.cursor()
 qry.execute(Insert into tBlob (data) values ('%s') %
 data.encode('hex'))
 
 
 return the error: Input String Too Long Limit: 4096
 
 
 2)
 qry.execute(Insert into tBlob (data) values (?),
 data.encode('hex'))
 
 
 does not return error, but it does not insert the record correctly.
 
 
 Any help will be fully appreciated...
 
Try, just on the off chance:

qry.execute(Insert into tBlob (data) values (?),
 (data.encode('hex'), ))


The second argument to execute should always be a tuple. And be aware 
that the odbc module hasn't had much maintenance lately.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Steve Holden
Anton Vredegoor wrote:
 Steven D. Arnold wrote:
 
[...]
 /rant
 
Feel better now?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regexp problem with `('

2007-03-22 Thread Bruno Desthuilliers
Johny a écrit :
 I have  the following text
 
 titleGoods Item  146 (174459989)  - OurWebSite/title
 
 from which I need to extract
 `Goods Item  146 '
 
 Can anyone help with regexp?

Sure : the documentation is here:
http://docs.python.org/lib/module-re.html

And there's a nice tutorial here:
http://www.amk.ca/python/howto/regex/

Read all this, try to solve your problem, and come back with what you've 
done so far if you need more help.

 Thank you for help

You're welcome.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to use unix_md5_crypt from Perl in Python?

2007-03-22 Thread Paul Rubin
Nico Grubert [EMAIL PROTECTED] writes:
 Example:
username = '[EMAIL PROTECTED]'
password = 'root'
 
 The crypted password is: 'roK20XGbWEsSM'

that looks like you want crypt(3), not md5.  See:

   http://docs.python.org/lib/module-crypt.html

Sample session:

 import crypt
 print crypt.crypt('root','ro')
roK20XGbWEsSM
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-22 Thread Jim Burton
On 21 Mar, 19:11, Lew [EMAIL PROTECTED] wrote:
 Dr. Who wrote:
  Don't Feed The Trolls :-)

 But, but - you fed me!?

[blah]

 We could put up a contest - whoever finds and corrects the most errors in the
 post wins. Ties broken by the quality of the correct explanations. Incorrect
 explanations count against the entry.

 -- Lew

Or you could stop feeding the trolls.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why brackets commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-22 Thread Sebastian Kaliszewski
dmitrey wrote:
 if you want
 result = func1(func2(arg))
 you should use
 result = func1 (func2 arg)

This is in conflict with current meanig, Ergo it breaks old code

rgds
\SK
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: interpreting glyph outlines from ttfquery?

2007-03-22 Thread Wojciech Muła
swiftset wrote:
 I'm try to convert a glyph into a format I can easily numerically
 manipulate. So far I've figured out how to use ttfquery to get a list
 that represents the outline of a contour in a glyph:
 
 from ttfquery import describe, glyphquery, glyph
 f = describe.openFont(/usr/share/fonts/truetype/freefont/
 FreeSans.ttf)
 n = glyphquery.glyphName(f, 'D')
 g = glyph.Glyph(n)
 c = g.calculateContours(f)
 o = glyph.decomposeOutline(c[1])
 
 o looks like:
 
 [array([182,  82],'s'),
 (354, 82),
 (420.29, 90.014),
 (474.91, 114.0), ...,
 array([182,  82],'s'),
 array([182,  82],'s')]
 
 Is this a polyline?

decomposeOutline docstring confirms -- it's a polyline.  I think 
elements marked with 's' starts new subpath.

w.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Garbage collection

2007-03-22 Thread Alex Martelli
Tom Wright [EMAIL PROTECTED] wrote:

 real programs.  I can't help thinking that there are some situations where
 you need a lot of memory for a short time though, and it would be nice to
 be able to use it briefly and then hand most of it back.  Still, I see the
 practical difficulties with doing this.

What I do in those cases:
a. fork
b. do the memory-hogging work in the child process
c. meanwhile the parent just waits
d. the child sends back to the parent the small results
e. the child terminates
f. the parent proceeds merrily

I learned this architectural-pattern a long, long time ago, around the
time when fork first got implemented via copy-on-write pages... 


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Oracle 10g odbc blob insertion problem

2007-03-22 Thread Steve Holden
Godzilla wrote:
 Dear all,
 
 I cannot find a solution for my problem with inserting a blob object
 (4000 in length) into an ORACLE database via ODBC.
 
 
 I have tried the two ways of inserting the blob object (a zip file):
 
 
 1)
 fp = open(c:/test/test.zip, r+b)
 data = fp.read()
 s = odbc.odbc(cs)
 qry = s.cursor()
 qry.execute(Insert into tBlob (data) values ('%s') %
 data.encode('hex'))
 
 
 return the error: Input String Too Long Limit: 4096
 
 
 2)
 qry.execute(Insert into tBlob (data) values (?),
 data.encode('hex'))
 
 
 does not return error, but it does not insert the record correctly.
 
 
 Any help will be fully appreciated...
 
I would certainly recommend that you think about using the cxOracle 
package rather than relying on odbc. Most Orcale users do, with evident 
satisfaction.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Oracle 10g odbc blob insertion problem

2007-03-22 Thread Paul Boddie
On 22 Mar, 10:21, Godzilla [EMAIL PROTECTED] wrote:

 I cannot find a solution for my problem with inserting a blob object
 (4000 in length) into an ORACLE database via ODBC.

This brings back happy memories with Oracle 9i and JDBC.

 I have tried the two ways of inserting the blob object (a zip file):

 1)
 fp = open(c:/test/test.zip, r+b)
 data = fp.read()
 s = odbc.odbc(cs)
 qry = s.cursor()
 qry.execute(Insert into tBlob (data) values ('%s') %
 data.encode('hex'))

 return the error: Input String Too Long Limit: 4096

 2)
 qry.execute(Insert into tBlob (data) values (?),
 data.encode('hex'))

 does not return error, but it does not insert the record correctly.

 Any help will be fully appreciated...

If I recall correctly, JDBC provided an API to stream the contents
into the column. That is, you needed to provide an instance of one of
the mutually incompatible Java stream classes (I don't remember which
one) when setting the value, and then the database would suck up the
contents. It's quite possible that a similar mechanism involving file-
like objects exists in the different Python modules for Oracle,
although I haven't checked.

Paul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python-URL! - weekly Python news and links (Mar 22)

2007-03-22 Thread Bruno Desthuilliers
Cameron Laird a écrit :
 This is the first time you've received Python-URL! in 2007.  No,
 that's not the fault of your mail server; we've just been on sabbatical.
 Now we're back.  

Great ! I was a bit worried...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python-URL! - weekly Python news and links (Mar 22)

2007-03-22 Thread Tim Golden
Bruno Desthuilliers wrote:
 Cameron Laird a écrit :
 This is the first time you've received Python-URL! in 2007.  No,
 that's not the fault of your mail server; we've just been on sabbatical.
 Now we're back.  
 
 Great ! I was a bit worried...
 

Seconded; I've always looked forward to the Python-URL and
I was a bit afeared that it had run out of steam. Good
to see it back... and thanks for keeping it up!

TJG
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-22 Thread Markus E Leypold

Lew [EMAIL PROTECTED] writes:

 Xah Lee wrote:
 In a functional language, a function can be specified by its name and

 Are you sure you know what a functional language is?

 parameter specs. For example:
 f(3)
 f(3, [9,2])
 f(some string)

 This is not really typical syntax for a functional language. LISP,
 for example, has the function name as an element of a list. (Some
 might argue that LISP isn't exactly a functional language.)


And nobody really cares, since syntax doesn't make a functional language 
anyways ...

Regards -- Markus
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Oracle 10g odbc blob insertion problem

2007-03-22 Thread Godzilla
On Mar 22, 10:56 pm, Steve Holden [EMAIL PROTECTED] wrote:
 Godzilla wrote:
  Dear all,

  I cannot find a solution for my problem with inserting a blob object
  (4000 in length) into an ORACLE database via ODBC.

  I have tried the two ways of inserting the blob object (a zip file):

  1)
  fp = open(c:/test/test.zip, r+b)
  data = fp.read()
  s = odbc.odbc(cs)
  qry = s.cursor()
  qry.execute(Insert into tBlob (data) values ('%s') %
  data.encode('hex'))

  return the error: Input String Too Long Limit: 4096

  2)
  qry.execute(Insert into tBlob (data) values (?),
  data.encode('hex'))

  does not return error, but it does not insert the record correctly.

  Any help will be fully appreciated...

 I would certainly recommend that you think about using the cxOracle
 package rather than relying on odbc. Most Orcale users do, with evident
 satisfaction.

 regards
   Steve
 --
 Steve Holden   +44 150 684 7255  +1 800 494 3119
 Holden Web LLC/Ltd  http://www.holdenweb.com
 Skype: holdenwebhttp://del.icio.us/steve.holden
 Recent Ramblings  http://holdenweb.blogspot.com- Hide quoted text -

 - Show quoted text -

Thanks guys for all your help.

Steve, I think I've tried what you have suggested without any luck as
well... The statement works fine, but what inserted is not correct...
it seems like only the symbol '?' was inserted into the blob field...

I will try the suggested cxOracle library in place of odbc as a
trial... but I think since 95% of the code is using odbc, it would be
hard to convince the team to chance to the new library... anyway, I
will let you know how it goes.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-22 Thread Lew
Jim Burton wrote:
 Or you could stop feeding the trolls.

People need to stop saying that. The original post was a detailed if incorrect 
exposition of Java information. How in the world do you rate that trollish?

I have absolutely no reason to rate the OP as a troll or their post as trollish.

-- Lew
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-22 Thread Sherm Pendley
Lew [EMAIL PROTECTED] writes:

 Jim Burton wrote:
 Or you could stop feeding the trolls.

 Does not apply. The OP was not being trollish

You obviously don't know Xah. He's been doing this for years, cross-
posting to various language groups trying to start an argument between
them. He even brags about being a troll on his web site.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fine grain logging cotrol

2007-03-22 Thread Steve Holden
Eric S. Johansson wrote:
 I need to to be able to conditionally log based on the method the log 
 statement is in and one other factor like a log level.  in order to do 
 so, I need to be able to automatically find out the name of the method 
 and its class but I haven't found out how to do that yet.
 
 for example,
 
 class catus(Felis):
def Siamese_cat( yowl, purr, demand_food):
 
  ...
  log(state of litter box %s% litter_box.smell, level = 1)
 
 
 If the table of methods logged contains catus.Siamese_cat, then I 
 would expect to see the output of the log statements in a log file.  If 
 not then I wouldn't see anything in the log.
 
 Has somebody done this already?  Is it even possible to do without 
 manually adding the class and method information for every log statement?
 
 a related question is using signals for reloading configurations etc.  I 
 have to find any good examples of how to use signals to cause a 
 long-running process to reload external data.  Any good pointers?
 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


fine grain logging cotrol

2007-03-22 Thread Eric S. Johansson
I need to to be able to conditionally log based on the method the log 
statement is in and one other factor like a log level.  in order to do 
so, I need to be able to automatically find out the name of the method 
and its class but I haven't found out how to do that yet.

for example,

class catus(Felis):
   def Siamese_cat( yowl, purr, demand_food):

 ...
 log(state of litter box %s% litter_box.smell, level = 1)


If the table of methods logged contains catus.Siamese_cat, then I 
would expect to see the output of the log statements in a log file.  If 
not then I wouldn't see anything in the log.

Has somebody done this already?  Is it even possible to do without 
manually adding the class and method information for every log statement?

a related question is using signals for reloading configurations etc.  I 
have to find any good examples of how to use signals to cause a 
long-running process to reload external data.  Any good pointers?


--- eric




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Removing a particular index from a list

2007-03-22 Thread Steve Holden
Srikanth wrote:
 Hi,
 
 list.remove(item) removes the first item from the list, but how do I
 say to remove a particular index from a list without using it's value?
 
 Let's say I have 4 items in my list as
 
 li = [sri, s, srikanth, s]
 
 And if I want to remove the last item (s), how do I remove it?
 li.remove(-1) doesn't do it. This is my problem.
 
   li = [sri, s, srikanth, s]
   del li[-1]
   li
['sri', 's', 'srikanth']
  

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Removing a particular index from a list

2007-03-22 Thread Cyril Cheneson
 li = [sri, s, srikanth, s]

 And if I want to remove the last item (s), how do I remove it?
 li.remove(-1) doesn't do it. This is my problem.

 Thanks,
 Srikanth


li.pop() will remove the last element

Cyril
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Removing a particular index from a list

2007-03-22 Thread Peter Otten
Srikanth wrote:

 list.remove(item) removes the first item from the list, but how do I
 say to remove a particular index from a list without using it's value?
 
 Let's say I have 4 items in my list as
 
 li = [sri, s, srikanth, s]
 
 And if I want to remove the last item (s), how do I remove it?
 li.remove(-1) doesn't do it. 

del li[-1]

 This is my problem. 

This, or not reading the tutorial.

http://docs.python.org/tut/node7.html#SECTION00720

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Removing a particular index from a list

2007-03-22 Thread Steve Holden
Peter Otten wrote:
 Srikanth wrote:
 
 list.remove(item) removes the first item from the list, but how do I
 say to remove a particular index from a list without using it's value?

 Let's say I have 4 items in my list as

 li = [sri, s, srikanth, s]
 And if I want to remove the last item (s), how do I remove it?
 li.remove(-1) doesn't do it. 
 
 del li[-1]
 
 This is my problem. 
 
 This, or not reading the tutorial.
 
No, that's OUR problem :-)
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Removing a particular index from a list

2007-03-22 Thread Srikanth
Thanks Steve, Cyril and Peter.


 This, or not reading the tutorial.

 http://docs.python.org/tut/node7.html#SECTION00720

 Peter

I read this 2 months ago and I expected it to be a method of list, but
I sound like I am making an excuse. Thanks a lot.

Regards,
Srikanth

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Duncan Booth
Steve Holden [EMAIL PROTECTED] wrote:

 Help me out here. It looks as though the real syntax should 
 be something like
 
 assignment_stmt   ::=   (target_list =)+ expression_list |
  (target_list =)+ assignment_stmt

That is precisely the point. If it was:

assignment_stmt   ::=   (target_list =) expression_list |
 (target_list =) assignment_stmt

(i.e. removing the '+' which your eyes jumped over)
then the actual assignments would have to apply right to left with each 
assignment giving the result for the next one.

But since it is:

assignment_stmt   ::=   (target_list =)+ expression_list

the repeated target lists may be expected, and are indeed defined, to 
assign left to right.
-- 
http://mail.python.org/mailman/listinfo/python-list


Removing a particular index from a list

2007-03-22 Thread Srikanth
Hi,

list.remove(item) removes the first item from the list, but how do I
say to remove a particular index from a list without using it's value?

Let's say I have 4 items in my list as

 li = [sri, s, srikanth, s]

And if I want to remove the last item (s), how do I remove it?
li.remove(-1) doesn't do it. This is my problem.

Thanks,
Srikanth

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Removing a particular index from a list

2007-03-22 Thread Peter Otten
Steve Holden wrote:

 Peter Otten wrote:
 Srikanth wrote:
 
 list.remove(item) removes the first item from the list, but how do I
 say to remove a particular index from a list without using it's value?

 Let's say I have 4 items in my list as

 li = [sri, s, srikanth, s]
 And if I want to remove the last item (s), how do I remove it?
 li.remove(-1) doesn't do it.
 
 del li[-1]
 
 This is my problem.
 
 This, or not reading the tutorial.
 
 No, that's OUR problem :-)

And the fact that it's our /self-inflicted/ problem makes it all the more
severe :-)

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fine grain logging cotrol

2007-03-22 Thread Peter Otten
Eric S. Johansson wrote:

 I need to to be able to conditionally log based on the method the log
 statement is in and one other factor like a log level.  in order to do
 so, I need to be able to automatically find out the name of the method
 and its class but I haven't found out how to do that yet.
 
 for example,
 
 class catus(Felis):
def Siamese_cat( yowl, purr, demand_food):
 
  ...
  log(state of litter box %s% litter_box.smell, level = 1)
 
 
 If the table of methods logged contains catus.Siamese_cat, then I
 would expect to see the output of the log statements in a log file.  If
 not then I wouldn't see anything in the log.
 
 Has somebody done this already?  Is it even possible to do without
 manually adding the class and method information for every log statement?
 
 a related question is using signals for reloading configurations etc.  I
 have to find any good examples of how to use signals to cause a
 long-running process to reload external data.  Any good pointers?

Instead of rolling your own, use the logging package which can handle
everything but the class info out of the box (levels are spelt as method
names info(), warn() etc.).

import logging

class LoggedType(type):
def __new__(mcl, name, bases, classdict):
classdict[logger] = logging.getLogger(name)
return type.__new__(mcl, name, bases, classdict)

class Felis:
__metaclass__ = LoggedType
def alpha(self):
self.logger.info(felis-alpha)

class Catus(Felis):
def alpha(self):
self.logger.info(catus-alpha)
def beta(self):
self.logger.info(catus-beta)

if __name__ == __main__:
logging.basicConfig(format=%(name)s.%(funcName)s: %(message)s,
level=logging.INFO)
f = Felis()
f.alpha()
c = Catus()
c.alpha()
c.beta()

If the metaclass bothers you, here's a simpler alternative:

class Felis(object):
logger = logging.getLogger(Felis)
def alpha(self):
self.logger.info(felis-alpha)

class Catus(Felis):
logger = logging.getLogger(Catus)
def alpha(self):
self.logger.info(catus-alpha)
def beta(self):
self.logger.info(catus-beta)

Peter


-- 
http://mail.python.org/mailman/listinfo/python-list


My MVC critique

2007-03-22 Thread scott . w . white
Looking at different MVC frameworks from many langauges from PHP to
Python, I've concluded that the explosion of MVC frameworks is mainly
due to undisciplined  unexperienced programmers.

Nobody would argue about the separation of the layers because this is
not the problem I have with it, if anything most implementations
emphasis separation at the wrong places.  The end solutions end up
looking very mickey mouse.

It's been long asserted starting with Smalltalk there there be a
separation of layers with an application starting with the view (what
the user sees), the controller (which controls the flow of the
application) and the model (the representation of the data).

What MVC does not emphasis is the separation of the data access layer,
one of the most important pieces of an application.  So what is done
with this?  For many the DAL is either encapsulated within the model
or some toolkit that generates the SQL for them, this may lead to
decreased overall security of a database and inefficient queries.

The catalyst for MVC frameworks on the web has been the slew of poorly
written applications mostly in PHP  Perl , this has driven many
programmers looking for control  consistency.  However this need is
short sighted when people find a magical bullet MVC Framework, and do
not place emphasis on minimization  reusability of code.  Therefore
you end up with the same paradigm as before, just crappy applications
separated out into pieces.

No doubt there should be separation of layers, but there also has to
be a real dialogue about programming as a discipline  science, not as
a craft of gluing popsicle sticks together.

There should be more discussion of architecture before a project
starts and more code reviews and discussions in project teams.  Also
one off projects (putting one programming on an island giving them a
compiler/interpreter) is a great way to get a crappy application.

That being said, I presently don't use one, but I'm still holding out
for an MVC framework that works for me and provides me power,
flexibility and is well documented.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread skip
 Anton == Anton Vredegoor [EMAIL PROTECTED] writes:

Anton Steve Holden wrote:
 Feel better now?

Anton Yes! But *now* I'm afraid it will have negative consequences for
Anton my future employability. However if it will lead to adjusting the
Anton kind of submissions at http://www.python.org/community/jobs/ it
Anton was probably worth it.

I think the steady increase in the number of active listings over the past
couple years bodes well for the job prospects of Python programmers as a
whole.  There are currently 99 job postings on the job board dating back to
mid-December.  A year ago there were about 60, a year before that, about 40.
A number of those companies seem to be fairly enlightened about the use of
open source software (search for open).  You can't expect the world to
completely change overnight.  Most companies probably still funnel external
job postings through their HR departments.  As a result, a certain amount of
boilerplate text and corporate puffery is bound to turn up in many postings.
Be thankful they at least found the job board or comp.lang.python and aren't
just trying to recruit through traditional channels.  You'd probably never
see job postings for the Space Telescope Science Institute or The World Wide
Workshop for Children's Media Technology and Learning if they only appeared
in the Washington Post or New York Times.

Skip
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Garbage collection

2007-03-22 Thread Alex Martelli
Steve Holden [EMAIL PROTECTED] wrote:
   ...
  a. fork
  b. do the memory-hogging work in the child process
  c. meanwhile the parent just waits
  d. the child sends back to the parent the small results
  e. the child terminates
  f. the parent proceeds merrily
  
  I learned this architectural-pattern a long, long time ago, around the
  time when fork first got implemented via copy-on-write pages... 
  
 Yup, it's easier to be pragmatic and find the real solution to your 
 problem than it is to try and mould reality to your idea of what the 
 solution should be ...

That's why all progress is due to the unreasonable man, hm?-)


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-22 Thread jim burton
On 22 Mar, 12:45, Lew [EMAIL PROTECTED] wrote:
 Jim Burton wrote:
  Or you could stop feeding the trolls.

 People need to stop saying that. The original post was a detailed if incorrect
 exposition of Java information. How in the world do you rate that trollish?

 I have absolutely no reason to rate the OP as a troll or their post as 
 trollish.

 -- Lew

Oh, in that case welcome to usenet. Take a while to settle in. There's
this guy here called Xah and he is a troll.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to receive a FILE* from Python under MinGW?

2007-03-22 Thread John Pye
On Mar 22, 7:23 pm, Giovanni Bajo [EMAIL PROTECTED] wrote:
 I personally don't use MSYS so I don't know exactly. I use SCons too, and I
 simply run it from the normal command prompt.

 I *believe* it's sufficient to unpack MSYS somewhere (you can either unpack it
 *over* the directory where you installed my GCC package, or somewhere else, I
 believe it works either way); since the GCC binaries are added to the system
 PATH by the installer, you should able to run it anyway. You can try by simply
 invoking gcc -v at the MSYS prompt and see if it's picking up the right
 version of GCC.

 I would appreciate if you give some feedback about this. I would like to
 incorporate your findings on the webpage.

Hi Giovanni

I downloaded your package and installed it in c:/mingw1. It complained
that it could not detect Python, although I have Python 2.4 installed
on my system (did you check HKCU as well as HKLM, perhaps?)

I note that the gccmrt utility does not work from MSYS. You will need
to provide a shell-script equivalent version, in order for that to be
useful for MSYS users. So I opened a cmd prompt and ran the command,
then restarted my MSYS session. There is also a need to be able to
query the *current state* of the gccmrt option.

Next I built my code. It all compiled OK, all the way through to my
NSIS bundle. So that was nice. It includes gfortran, flex, bison, SWIG/
Python and Tcl/Tk linkage: a bit of a coup.

BUT when I try to run my program, I get a windows error msgbox,
python.exe - Entry Point Not Found: The procedure entry point _ctype
could not be located in the dynamic link library msvcr71.dll.

I don't know what the cause of that missing symbol could be, unless it
has something to do with the fact that I am linking with -lgfortran.

As well as the python module that fails to load (above) I also have a
Tcl/Tk based executable which crashes on launch. Also seems to be
something with msvcr71, but I can't tell for sure.

Have you got any ideas?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: My MVC critique

2007-03-22 Thread Michael Bentley

On Mar 22, 2007, at 9:29 AM, [EMAIL PROTECTED] wrote:
 mickey mouse

Well, at least you spelled Mickey Mouse right... :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Steve Holden
Duncan Booth wrote:
 Steve Holden [EMAIL PROTECTED] wrote:
 
 Help me out here. It looks as though the real syntax should 
 be something like

 assignment_stmt   ::=   (target_list =)+ expression_list |
  (target_list =)+ assignment_stmt
 
 That is precisely the point. If it was:
 
 assignment_stmt   ::=   (target_list =) expression_list |
  (target_list =) assignment_stmt
 
 (i.e. removing the '+' which your eyes jumped over)
 then the actual assignments would have to apply right to left with each 
 assignment giving the result for the next one.
 
 But since it is:
 
 assignment_stmt   ::=   (target_list =)+ expression_list
 
 the repeated target lists may be expected, and are indeed defined, to 
 assign left to right.

Thanks, I see the plus sign now and appreciate that it indicates one or 
more of, so the syntax is correct. But syntax doesn't imply semantics, 
so a left-recursive or right-recursive syntax formulation wouldn't 
require any change to the semantics of assignment.

In other words,

assignment_stmt   ::=   (target_list =) expression_list |
  (target_list =) assignment_stmt

and

assignment_stmt   ::=   (target_list =) assignment_stmt |
  (target_list =) expression_list

are entirely equivalent, and neither imply any order of execution. I'm 
sure you understand that syntax only specifies what's legal, not how it 
should be interpreted.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-22 Thread Slartibartfast

jim burton [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On 22 Mar, 12:45, Lew [EMAIL PROTECTED] wrote:
 Jim Burton wrote:
  Or you could stop feeding the trolls.

 People need to stop saying that. The original post was a detailed if 
 incorrect
 exposition of Java information. How in the world do you rate that 
 trollish?

 I have absolutely no reason to rate the OP as a troll or their post as 
 trollish.

 -- Lew

 Oh, in that case welcome to usenet. Take a while to settle in. There's
 this guy here called Xah and he is a troll.


Why oh why does anyone even bother to respond to Xah Lee? See the true Xah 
at:

http://node60091.multiply.com/photos/album/1

WARNING: Nudity!!! Not family- or work-friendly!!!


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Steve Holden
Duncan Booth wrote:
 Steve Holden [EMAIL PROTECTED] wrote:
 
 As a matter of interest do PyLint or PyChecker check for this situation 
 (chained assignment where the target of an assignment is also a 
 subexpression of a later assignment)?

 Where's the published syntax for chained assignment?
 
 http://docs.python.org/ref/assignment.html
 
 More specifically, since you seem to have missed it, it's the '+' in the 
 line:
 
 assignment_stmt   ::= (target_list =)+ expression_list
 
 And then the clear statement assigns the single resulting object to each 
 of the target lists, from left to right.

Got it, thanks. See my further remarks in my reply to your last.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fine grain logging cotrol

2007-03-22 Thread Eric S. Johansson
Peter Otten wrote:
 Eric S. Johansson wrote:
 
 I need to to be able to conditionally log based on the method the log
 statement is in and one other factor like a log level.  in order to do
 so, I need to be able to automatically find out the name of the method
 and its class but I haven't found out how to do that yet.

 for example,

 class catus(Felis):
def Siamese_cat( yowl, purr, demand_food):

  ...
  log(state of litter box %s% litter_box.smell, level = 1)


 If the table of methods logged contains catus.Siamese_cat, then I
 would expect to see the output of the log statements in a log file.  If
 not then I wouldn't see anything in the log.

 Has somebody done this already?  Is it even possible to do without
 manually adding the class and method information for every log statement?

 a related question is using signals for reloading configurations etc.  I
 have to find any good examples of how to use signals to cause a
 long-running process to reload external data.  Any good pointers?
 
 Instead of rolling your own, use the logging package which can handle
 everything but the class info out of the box (levels are spelt as method
 names info(), warn() etc.).

I was planning on using logging.  I've been using syslog for too long
 
 import logging
 
 class LoggedType(type):
 def __new__(mcl, name, bases, classdict):
 classdict[logger] = logging.getLogger(name)
 return type.__new__(mcl, name, bases, classdict)

__new__ is new to me.  took a look at 
http://www.python.org/download/releases/2.2.3/descrintro/#__new__ which 
give me some clue but not enough.  what I get is that in call 
initialization, you add an entry to the class dict (adds new method??). 
I see that name, bases, or classdict are part of the normal class 
construction process and refer to the class under construction.  I'm 
guessing mcl comes from __metaclass__ and defaults to type?

the getLogger creates a logging channel so there is one channel per 
class?  but what selects the class for output or is that a derived 
logger class I need to create?

also, how could one automatically determine the method doing the logging?

 
 class Felis:
 __metaclass__ = LoggedType

needed in every top level class?

 def alpha(self):
 self.logger.info(felis-alpha)
 
 class Catus(Felis):
 def alpha(self):
 self.logger.info(catus-alpha)
 def beta(self):
 self.logger.info(catus-beta)
 
 if __name__ == __main__:
 logging.basicConfig(format=%(name)s.%(funcName)s: %(message)s,
 level=logging.INFO)
 f = Felis()
 f.alpha()
 c = Catus()
 c.alpha()
 c.beta()


 
 If the metaclass bothers you, here's a simpler alternative:

simpler to implement but more error prone.  I like the metaclass model. 
  now if one could fill in the class and method name automatically, life 
would be good.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: parsing tables with beautiful soup?

2007-03-22 Thread Duncan Booth
cjl [EMAIL PROTECTED] wrote:

 This works:
 
 for row in soup.find(table,{class: class_name}):
  for cell in row:
   print cell.contents[0]
 
 Is there a better way to do this?
 

It may work for the page you are testing against, but it wouldn't work if 
your page contained valid HTML. You are assuming that the TR elements are 
direct children of the TABLE, but HTML requires that the TR elements appear 
inside THEAD, TBODY or TFOOT elements, so if anyone ever corrects the html 
your code will break.

Something like this (untested) ought to work and be reasonably robust:

table = soup.find(table,{class: class_name})
for row in table.findAll(tr):
for cell in row.findAll(td):
print cell.findAll(text=True)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: interpreting glyph outlines from ttfquery?

2007-03-22 Thread Mike C. Fletcher
Wojciech Muła wrote:
 swiftset wrote:
   
 I'm try to convert a glyph into a format I can easily numerically
 manipulate. So far I've figured out how to use ttfquery to get a list
 that represents the outline of a contour in a glyph:

 from ttfquery import describe, glyphquery, glyph
 f = describe.openFont(/usr/share/fonts/truetype/freefont/
 FreeSans.ttf)
 n = glyphquery.glyphName(f, 'D')
 g = glyph.Glyph(n)
 c = g.calculateContours(f)
 o = glyph.decomposeOutline(c[1])

 o looks like:

 [array([182,  82],'s'),
 (354, 82),
 (420.29, 90.014),
 (474.91, 114.0), ...,
 array([182,  82],'s'),
 array([182,  82],'s')]

 Is this a polyline?
 

 decomposeOutline docstring confirms -- it's a polyline.  I think 
 elements marked with 's' starts new subpath.

 w.
   
Examples of rendering self.contours and self.outlines (created by 
self.compile on the Glyph) using OpenGL operations are in the toolsfont 
module in OpenGLContext:

http://pyopengl.cvs.sourceforge.net/pyopengl/OpenGLContext/scenegraph/text/toolsfont.py?view=markup

The outlines are simple 2D line-loops, the things with 's' are array 
objects (not start coordinates), you can convert the whole thing to a 
consistent array with numpy.array (or Numeric.array). That is, the 's' 
is just an artefact of how the calculation was done, the values are all 
2-element coordinates, some as Python tuples, some as 2-element 
Numeric/numpy short arrays.

HTH,
Mike

-- 

  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com

-- 
http://mail.python.org/mailman/listinfo/python-list

Been a while...

2007-03-22 Thread John Salerno
Hi guys. It's been a while since I've used Python, so I got a little 
rusty, but I really want to start using it again, just out of habit and 
for fun. Can anyone suggest a book or a website with little projects I 
could work on to keep me busy?

(I do have Beginning Python with the 10 projects in the back, but those 
might be a little too involved for me right now.)

Thanks!
John
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Duncan Booth
Steve Holden [EMAIL PROTECTED] wrote:



 In other words,
 
 assignment_stmt   ::=   (target_list =) expression_list |
   (target_list =) assignment_stmt
 
 and
 
 assignment_stmt   ::=   (target_list =) assignment_stmt |
   (target_list =) expression_list
 
 are entirely equivalent

I'm not quite sure what you are getting at. An assigment_stmt and an 
expression_list are not ambiguous so those two productions are identical 
(not just equivalent). Perhaps you are thinking of productions like:

m_expr ::= u_expr | m_expr * u_expr  

which will match the same input, but could produce a different parser 
output than:

m_expr ::= u_expr | u_expr * m_expr  


 I'm sure you understand that syntax only specifies what's legal, not how
 it should be interpreted.

I agree that the syntax does not mandate how it should be interpreted,
but it does lead to expectations.

If the expression_stmt is hidden from the outer assignment_stmt by an inner 
one then it is reasonable to expect that the inner production will be 
completely evaluated before the outer assignment happens. i.e. right to 
left.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Been a while...

2007-03-22 Thread Michael Bentley

On Mar 22, 2007, at 10:34 AM, John Salerno wrote:

 Hi guys. It's been a while since I've used Python, so I got a little
 rusty, but I really want to start using it again, just out of habit  
 and
 for fun. Can anyone suggest a book or a website with little projects I
 could work on to keep me busy?

http://www.pythonchallenge.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Question regarding __new__

2007-03-22 Thread Frank Benkstein
Hi,

the behaviour I always observed when creating instances by calling the
class A is that '__init__' is always only called when the object
returned by A.__new__ is an instance of A. This can be observed by the
following code:

class A(object):
def __new__(cls, *args, **kwds):
print A.__new__, args, kwds
return object.__new__(B, *args, **kwds)
def __init__(cls, *args, **kwds):
print A.__init__, args, kwds

class B(object):
def __new__(cls, *args, **kwds):
print B.__new__, args, kwds
return object.__new__(cls, *args, **kwds)
def __init__(cls, *args, **kwds):
print B.__init__, args, kwds

Interactively A() then gives:

 A()
A.__new__ () {}
__main__.B object at 0xb7bed0ec

Yet [1] says: [...] some rules for __new__: [...] If you return an
object of a different class, its __init__ method will be called.

Am I missing something? Is this documented somewhere else? Also it
would be nice if someone could point me to the function that implements
this in C. I didn't find anything in object.c or typeobject.c.

Best regards
Frank Benkstein.

[1] http://www.python.org/download/releases/2.2/descrintro/#__new__

-- 
GPG (Mail): 7093 7A43 CC40 463A 5564  599B 88F6 D625 BE63 866F
GPG (XMPP): 2243 DBBA F234 7C5A 6D71  3983 9F28 4D03 7110 6D51


signature.asc
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/env python 2.4?

2007-03-22 Thread starGaming
On Mar 21, 11:11 pm, Sander Steffann [EMAIL PROTECTED] wrote:
 Hi,

 Op 21-mrt-2007, om 20:41 heeft [EMAIL PROTECTED] het volgende
 geschreven:



  On Mar 21, 11:07 am, Jon Ribbens [EMAIL PROTECTED] wrote:
  In article [EMAIL PROTECTED], Stargaming wrote:
  from sys import version_info
  if version_info[0]  2 or version_info[1]  4:
   raise RuntimeError(You need at least python2.4 to run this
  script)

  That'll fail when the major version number is increased (i.e.
  Python 3.0).

  You want:

if sys.hexversion  0x020400f0:
  ... error ...

  Yes, it was intended to be and 'and' instead of an 'or'.

 If you make it an 'and' it will not raise the exception on version
 like 1.5 or 2.3... If you realy want to use version_info, you'll have
 to do something like:

 if version_info[0]  2 or (version_info[0] == 2 and version_info[1] 
 4):
 raise RuntimeError

 - Sander


I don't see any problem with::

if version_info[0] = 2 and version_info[1]  4:
raise RuntimeError()

Huh?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Ziga Seilnacht
John Nagle wrote:

 That's fascinating.  Is that a documented feature of the language,
 or a quirk of the CPython interpreter?

Its a documented feature of the language. From the Reference Manual:

An assignment statement evaluates the expression list (remember that
this can be a single expression or a comma-separated list, the latter
yielding a tuple) and assigns the single resulting object to each of
the target lists, from left to right.

See: http://docs.python.org/ref/assignment.html

Ziga


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regexp problem with `('

2007-03-22 Thread Paul McGuire
On Mar 22, 3:26 am, Johny [EMAIL PROTECTED] wrote:
 I have  the following text

 titleGoods Item  146 (174459989)  - OurWebSite/title

 from which I need to extract
 `Goods Item  146 '

 Can anyone help with regexp?
 Thank you for help
 L.
Here's the immediate answer to your question.


import re
src = titleGoods Item  146 (174459989)  - OurWebSite/title
pattern = rtitle(.*)\(
re.search(pattern,src).groups()[0]


I post it this way so that you can relate the re to your specific
question, and then maybe apply this to whatever else you are scraping
from this web page.

Please don't follow up with a post asking how to extract 45,Rubber
chicken from trtd45/tdtdRubber chicken/td/tr.  At this
point, you should try a little experimentation on your own.

-- Paul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regexp problem with `('

2007-03-22 Thread John Nagle
Johny wrote:
 I have  the following text
 
 titleGoods Item  146 (174459989)  - OurWebSite/title
 
 from which I need to extract
 `Goods Item  146 '
 
 Can anyone help with regexp?
 Thank you for help
 L.

In general, parsing HTML with regular expressions is a bad idea.
Usually, you use something like BeautifulSoup to parse the HTML,
extract the desired field, like the contents of title, then
work on that.

If you try to do this line by line with regular expressions,
it will fail when the line breaks aren't where you expect.  If
you try to do a whole document with regular expressions, other
material such as content in comments can be misrecognized.

 Try something like this:

# Regular expression to extract group before (N)
kreextractitem = re.compile(r'^(.*)\(\d+\))
pagetree = BeautifulSoup.BeautifulSoup(stringcontaininghtml)
titleitem = pagetree.find({'title':True, 'TITLE':True})
if titleitem :
titletext =  .join(atag.findAll(text=True, recursive=True))   
#   Text of TITLE item is now in titletext as a string.
groups = kreextractitem.search(titletext)
if groups :
goodsitem = groups.group(1).strip() 
# goodsitem now contains everything before ()


This approach will work no matter where the line breaks are in the original
HTML.

John Nagle
-- 
http://mail.python.org/mailman/listinfo/python-list


challenge ?

2007-03-22 Thread alain
I have a problem I wonder if it has been solved before.
I have a dictionnary and I want the values in the dictionnary to be
annotated with the rank that would be obtained by sorting the values

def annotate_with_rank(my_dict):

return my_annotated_dict

In other words, any value a_value would become a 2-tuple
(a_value,rank_of_a_value)

I seek an elegant solution.

Alain

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: #!/usr/bin/env python 2.4?

2007-03-22 Thread Jon Ribbens
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote:
 I don't see any problem with::
 
 if version_info[0] = 2 and version_info[1]  4:
 raise RuntimeError()

What if the version number is 1.5?
-- 
http://mail.python.org/mailman/listinfo/python-list


State of the Art Software Development Practices

2007-03-22 Thread dant262
Dan Turk
Colorado State University
26 Rockwell Hall
Fort Collins, CO 80523-1277
USA

March 22, 2007




My name is Dan Turk, and I am a faculty member in the Department of
Computer Information Systems at Colorado State University.  My
colleague, Leo Vijayasarathy, and I are conducting a study to better
understand the use of agile software development processes, methods,
and techniques, and the benefits and limitations associated with their
use.  About 2 years ago we performed a similar survey.  However, while
that survey was targeted solely at people who had already been
frequent users of agile processes, the current survey looks to draw
data from a larger segment of developers and has been updated for that
purpose.

Please consider participating in this study by completing a brief
survey posted at http://www.business.colostate.edu/leov/research/agile/start.cfm
.

A summary of the results will be posted to this group at the
conclusion of this study.

Your responses will be entirely anonymous and confidential.  The
survey does not collect any identifying information and cannot be
tracked to the person completing it.   General information about your
title and years of experience are requested only to build a profile of
the survey respondents.

Your participation in this study is voluntary.  There are no known
risks associated with taking part in it.  You may stop participating
at any time without penalty or loss of benefits to which you are
otherwise entitled.  If you have questions regarding your rights as a
volunteer in this research, please contact Janell Meldrem, Senior
Human Research Administrator, (970) 491-1563,
[EMAIL PROTECTED]

Thank you in advance for completing the survey and your contribution
to this research.   If you have any questions about the study or the
survey, please call me at 970-491-0467 or email me at
[EMAIL PROTECTED]

Sincerely,

Dan Turk, Ph.D.
Associate Professor of Computer Information Systems

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread John Nagle
Mark T wrote:
 
 Alex Martelli [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 
 John Nagle [EMAIL PROTECTED] wrote:

 Marcin Ciura wrote:

  Neither would I. I must have expressed myself not clearly enough.
  Currently
  x = y = z
  is roughly equivalent to
  x = z
  y = z
  I propose to change it to
  y = z
  x = z

 Actually, it is equivalent to

   y = z
   x = y


 Not really:

 class chatty(object):

 ...   def __init__(self): self.__dict__['__hide'] = {}
 ...   def __setattr__(self, name, value):
 ... print 'sa', name, value
 ... self.__dict__['__hide'][name] = value
 ...   def __getattr__(self, name):
 ... print 'ga', name
 ... return self.__dict__['__hide'].get(name)
 ...

 c = chatty()
 x = c.zop = 23

 sa zop 23



 As you can see, there is no read-access to c.zop, which plays the role
 of y there.


 Alex
 
 
 This is interesting:
 
 class Test(object):
 
 ...   def __getattribute__(self,n):
 ... print 'reading',n
 ... return object.__getattribute__(self,n)
 ...   def __setattr__(self,n,v):
 ... print 'writing',n,v
 ... return object.__setattr__(self,n,v)
 ...
 
 x=Test()
 x.a=1; x.b=2; x.c=3
 
 writing a 1
 writing b 2
 writing c 3
 
 x.a=x.b=x.c
 
 reading c
 writing a 3
 writing b 3
 

 
 I wouldn't have expected a to be assigned first in a right-to-left 
 parsing order.  The result is the same in any case.
 
 -Mark T.

That's fascinating.  Is that a documented feature of the language,
or a quirk of the CPython interpreter?

John Nagle
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why brackets commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-22 Thread Bart Willems
dmitrey wrote:
 1st still is shorter by 1 char; considering majority of people use
 space after comma  number of parameters can be big it yileds
 foo bar baz bar2 bar3 bar4
 vs
 foo(bar, baz, bar2, bar3, bar4)

I think most readers already agree on the ambiguities part. Now, for the 
length of the code...
I agree that in you example the first syntax yields a full /five/ spaces 
less than the second syntax. However, it ignores the fact that if you 
are creating functions with that many arguments, you are probably doing 
something wrong. Can't those arguments be provided as a list?
Let's see what is shorter:

foo bar baz bar2 bar3 bar4
or
foo *bars

Not to mention that it might (or might not) be a good idea to wrap the 
function in some kind of class where you can specify a whole bunch of 
attributes, so that you do not have to call a function with that many 
arguments to start with.

Regards,
Bart
-- 
http://mail.python.org/mailman/listinfo/python-list


ZSI, SOAP and .NET web services - problem

2007-03-22 Thread Jaroslaw Zabiello
I try to connect to web services (written in C#/.NET) with latest ZSI
2.0rc3 library. It just does not work.

from ZSI.ServiceProxy import ServiceProxy 
wsdl = 'http://192.168.0.103/NewWebServices/TemplateInsert.asmx?wsdl' 
print ServiceProxy(wsdl, tracefile=sys.stdout) 

C:\opt\Python25\lib\site-packages\zsi-2.0_rc3-py2.5.egg\ZSI\wstools\WSDLTools.py,
line 1116, in getAddressBinding 
WSDLError: No address binding found in port. 

This pythonic library must be stupid, because I have no problem to connect
with... Ruby:

require 'soap/wsdlDriver'
require 'rexml/document'
wsdl = 'http://192.168.0.103/NewWebServices/TemplateInsert.asmx?wsdl'
soap = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
#soap.wiredump_file_base = 'soapresult'
p soap.templateInsert('')

It is a shame why Python still has so poor SOAP implementation. Ruby has
SOAP in *standard library*, Python - not. Even PHP5 has very good SOAP
library built in. 

I tried to use different library - SOAPpy, but I couldn't. It requires
fpconst library which cannot be installed because its server does not
respond at all. What a shit...

Why nobody wants to add SOAP to standard Python library? XML-RPC was added
and it works without any problems.

-- 
Jarosław Zabiełło
http://blog.zabiello.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Printing __doc__

2007-03-22 Thread Bart Ogryczak
On Mar 21, 8:47 pm, gtb [EMAIL PROTECTED] wrote:
 Greetings,

 Don't know the daily limit for dumb questions so I will ask one or
 more.

 In a function I can use the statement n =
 sys._getframe().f_code.co_name to get the name of the current
 function. Given that I can get the name how can I print the __doc__
 string? I cant use the following, it will tell me to bugger off as the
 string has no such attribute.

 def spam(self):
 n = sys._getframe().f_code.co_name
 print n.__doc__  #Wrong
 print __doc__ #No good either
 #

print eval(n+'.__doc__')




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Anton Vredegoor
[EMAIL PROTECTED] wrote:

 I think the steady increase in the number of active listings over the
  past couple years bodes well for the job prospects of Python 
 programmers as a whole.  There are currently 99 job postings on the 
 job board dating back to mid-December.  A year ago there were about 
 60, a year before that, about 40.

Agreed. There's now probably even room on the job market for those who
don't belong to the select elite of early adopters. We might even root
out the professionalist attitude and address the problem of tying people
to their resumes.

 A number of those companies seem to be fairly enlightened about the 
 use of open source software (search for open).  You can't expect 
 the world to completely change overnight.

If I never speak up there's little chance my ideas will get noticed.
But there's probably some better format possible for my message.

 Most companies probably still funnel external job postings through 
 their HR departments.  As a result, a certain amount of boilerplate 
 text and corporate puffery is bound to turn up in many postings. Be 
 thankful they at least found the job board or comp.lang.python and 
 aren't just trying to recruit through traditional channels.

Actually, I like people posting their jobs on an unmoderated forum. How
else would it be possible to try and get applicants and employers to
compare their ideas? I mean, not everyone is able to visit expensive
high-profile hiring fests like pycon.

 You'd probably never see job postings for the Space Telescope Science
  Institute or The World Wide Workshop for Children's Media Technology
  and Learning if they only appeared in the Washington Post or New
 York Times.

Sure. But my whole problem is that while I'd be immensely useful in a 
space telescope science institute or a genome database research 
institute or in an artists educational institute or in a psychological 
statistics institute or in a computer science or mathematics institute 
etc. there is no way people can see that, because they're thinking in 
resumes, job experience and formal education instead of in just asking 
themselves what needs to be done and can he do it. You know, like duck 
typing :-) From what I get around the 'net I gather the problem is a bit 
less pronounced in the US though.

A.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Technical Answer - Protecting code in python

2007-03-22 Thread Thomas Heller
Bart Willems schrieb:
 Aaah, *now* we're getting somewhere... :-)
 
 All he wants is something that turns 'readable, 
 changeable python' into 'unreadable, immutable python'.
 
 chown scriptuser script.py  # a unique user
 chmod a-rwx script.py
 chmod u+rx script.py
 
 I believe that fully meets the functional requirements. Where shall I send
 the invoice?
 
 If it works on the target machine - I am under the assumption that the 
 client is some kind of government office - more likely to run Windows 
 than it is to run unix/linux/etc.
 
 Who has a similar solution for windows?

python -m py_compile script.py
del script.py

Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Technical Answer - Protecting code in python

2007-03-22 Thread Bart Willems
Aaah, *now* we're getting somewhere... :-)

 All he wants is something that turns 'readable, 
 changeable python' into 'unreadable, immutable python'.
 
 chown scriptuser script.py  # a unique user
 chmod a-rwx script.py
 chmod u+rx script.py
 
 I believe that fully meets the functional requirements. Where shall I send
 the invoice?

If it works on the target machine - I am under the assumption that the 
client is some kind of government office - more likely to run Windows 
than it is to run unix/linux/etc.

Who has a similar solution for windows?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: challenge ?

2007-03-22 Thread Frank Benkstein
Hi,

On 22 Mar 2007 09:41:43 -0700
alain [EMAIL PROTECTED] wrote:

 I have a problem I wonder if it has been solved before.
 I have a dictionnary and I want the values in the dictionnary to be
 annotated with the rank that would be obtained by sorting the values
 
 def annotate_with_rank(my_dict):
   
   return my_annotated_dict
 
 In other words, any value a_value would become a 2-tuple
 (a_value,rank_of_a_value)
 
 I seek an elegant solution.

In your specification of the problem it is unclear what should be done
with duplicate values. My solution assigns every value a different
rank (starting from 0) such that the highest rank is len(my_dict) - 1.

def annotate_with_rank(my_dict):
items = my_dict.items()
items.sort(key = lambda (k, v): v)
return dict((k, (i, v)) for i, (k, v) in enumerate(items))

Best regards,
Frank Benkstein.


-- 
GPG (Mail): 7093 7A43 CC40 463A 5564  599B 88F6 D625 BE63 866F
GPG (XMPP): 2243 DBBA F234 7C5A 6D71  3983 9F28 4D03 7110 6D51


signature.asc
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Kamaelia Google's Summer of Code 2007

2007-03-22 Thread Michael
Hi,


We're (BBC Research) participating in Google's Summer of Code as a mentor
organisation again, and I thought it worth spreading some extra publicity
where I think there might be some interested people. (I perhaps should've
sent this sooner!) 

* What's Google Summer of Code? (I suspect most people here know :)

Essentially Google are paying students to work on open source projects and
being mentored in those projects, producing useful code and learning useful
skills. Google's aim is to increase the number of people bitten by the
open source bug :-)

* How is BBC Research/ Kamaelia involved?

Like last year we're a mentor organisation, Kamaelia is the open source
project that project applications are invited for. It's aim is to make
highly concurrent systems natural to create and simple to maintain. (given
a choice of forces the we choose the latter) We seem to be having some
success in this and have a number of systems we've built using Kamaelia. 

Kamaelia is primarily focussed around building networked, multimedia
systems, tools and applications, since that's generally our problem domain,
however Kamaelia is a generic component framework  toolset.

Our project ideas and guidance page is here:
   * http://kamaelia.sourceforge.net/SummerOfCode2007

However, we're also interested other ideas beyond that, especially systems
that use Kamaelia that can act as exemplars. To give an idea of potential
scope, a list of components can be found here:
   * http://kamaelia.sourceforge.net/Components

* Who can Apply ?

You need to be a student now, or in september enrolled at a university
degree course or similar level of institution/degree.

* When is the deadline ?

Monday midnight.

* Url?

http://code.google.com/soc/

Please feel free to forward this to any students or student groups you would
find this interesting ! :-)

Regards,


Michael.
--
Michael Sparks, Senior Research Engineer, BBC Research, Technology Group
[EMAIL PROTECTED], Kamaelia Project Lead, http://kamaelia.sf.net/


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-22 Thread Nigel Wade
Lew wrote:

 Jim Burton wrote:
 Or you could stop feeding the trolls.
 
 People need to stop saying that. The original post was a detailed if 
 incorrect 
 exposition of Java information. How in the world do you rate that trollish?

a) Xah's posting history.
b) the cross-posting
c) the advocacy of the contents

 
 I have absolutely no reason to rate the OP as a troll or their post as
trollish.
 

In time you will learn...

It wasn't even a good troll. To be a good troll the message actually needs to be
interesting enough to get people to read it. 


-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK 
E-mail :[EMAIL PROTECTED] 
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Been a while...

2007-03-22 Thread kyosohma
On Mar 22, 11:21 am, Michael Bentley [EMAIL PROTECTED]
wrote:
 On Mar 22, 2007, at 10:34 AM, John Salerno wrote:

  Hi guys. It's been a while since I've used Python, so I got a little
  rusty, but I really want to start using it again, just out of habit
  and
  for fun. Can anyone suggest a book or a website with little projects I
  could work on to keep me busy?

 http://www.pythonchallenge.com

Python Programming: An Introduction to Computer Science by Zelle has
lots of little homework assignments at the end of each chapter. That
would probably keep you busy and up-to-snuff.

Mike

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: challenge ?

2007-03-22 Thread Raymond Hettinger
On Mar 22, 9:41 am, alain [EMAIL PROTECTED] wrote:
 I have a problem I wonder if it has been solved before.
 I have a dictionnary and I want the values in the dictionnary to be
 annotated with the rank that would be obtained by sorting the values

 def annotate_with_rank(my_dict):
 
 return my_annotated_dict

 In other words, any value a_value would become a 2-tuple
 (a_value,rank_of_a_value)

Try this:

 from operator import itemgetter
 my_dict = dict(a=10, b=5, c=8, d=12)
 for rank, (key, value) in enumerate(sorted(my_dict.items(), 
 key=itemgetter(1))):
... my_dict[key] = (value, rank)
 my_dict
{'a': (10, 2), 'c': (8, 1), 'b': (5, 0), 'd': (12, 3)}

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Erik Johnson

Virgil Dupras [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
   class Node:
   ... pass
   ...
   node = Node()
   nextnode = Node()
   backup_node = node
   node = node.next = nextnode
   node.next is node
   True
   hasattr(backup_node,'next')
   False


Well, I think I am thoroughly confused now. I am a lot less experienced
that most of the people posting in this thread, so perhaps that is to be
expected, but I actually thought I understood Python fairly well. Maybe I am
fooling myself...

  Let me rename some variables in the code above to something a little
easier to follow:

 class Node: pass
...
 n1 = Node()
 n2 = Node()
 n3 = n1

At this point I beleive I've got the same thing above, just with different
reference names.  Namely, I have two objects, and three references, the
first and third reference now both referring to the first object, the second
reference referring to the second object:

 n1
__main__.Node instance at 0x7ff1d20c
 n2
__main__.Node instance at 0x7ff1d10c
 n3
__main__.Node instance at 0x7ff1d20c

The discussion is about multiple assignments. Virgil's example should be
equivalent to:

n1 = n1.next = n2

If assignment were left to right, (i.e., n1 = n1.next, followed by
n1.next = n2), then I would expect to get an attribute error because n1
hasn't had the 'next' attribute attached to it yet.  That's not what
happens, so the other interpretation is that the statement above is
equivalent to: n1.next = n2; n1= n1.next (except that n1.next is only
evaluated once, but that doesn't matter here). Right?  That is, first object
'n1' gets a new attribute, the value of which is a reference to object n2,
and then, the name 'n1' is rebound to be a reference to object n2 (note that
the object n1 was previously referencing should still be available via name
'n3', and being a mutable object, the new attribute should be visible via
'n3', right?

I didn't yet execute the statement above (I just typed it in this
post) - let's first check the objects and attributes for what we have prior
to this confusing statement:

 n1
__main__.Node instance at 0x7ff1d20c
 n2
__main__.Node instance at 0x7ff1d10c
 n3
__main__.Node instance at 0x7ff1d20c
 dir(n1)
['__doc__', '__module__']
 dir(n2)
['__doc__', '__module__']
 dir(n3)
['__doc__', '__module__']

Right... no suprises there. Let's execute that funky statement...

 n1 = n1.next = n2


We would expect n1 to reference n2 now (my object at ...d10c), which it
does:

 n1
__main__.Node instance at 0x7ff1d10c

And we would expect n3 to still be referencing the object at ...d20c, which
it also still does:

 n3
__main__.Node instance at 0x7ff1d20c

And we would expect  (or I should say I would expect) n3 to now have a
'next' attribute:

 dir(n3)
['__doc__', '__module__']

It doesn't, which is what Virgil previously pointed out. I'm not quite
following the whole discussion (nor the syntax diagrams), so sorry if this
was already explined - could someone try again: why is it that n3 here
doesn't get the 'next' attribute?

Now here's the part that totally floors me: what would you expect to be
the attributes on n2 (the object on the far-right of the multi-way
assignment statement)? We've made no assigment statements to anything about
n2. They should be the same as before, right?

 dir(n2)
['__doc__', '__module__', 'next']
 n2.next
__main__.Node instance at 0x7ff1d10c
 n2
__main__.Node instance at 0x7ff1d10c


 DUH I'm about speechless... Is it just me being dense, or is there some
obvious reason why one would expect this?


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: challenge ?

2007-03-22 Thread Frank Benkstein
Hi, again,

On Thu, 22 Mar 2007 18:11:46 +0100
Frank Benkstein [EMAIL PROTECTED] wrote:

 On 22 Mar 2007 09:41:43 -0700
 alain [EMAIL PROTECTED] wrote:
 
  I have a problem I wonder if it has been solved before.
  I have a dictionnary and I want the values in the dictionnary to be
  annotated with the rank that would be obtained by sorting the values
  
  def annotate_with_rank(my_dict):
  
  return my_annotated_dict
  
  In other words, any value a_value would become a 2-tuple
  (a_value,rank_of_a_value)
  
  I seek an elegant solution.
 
 In your specification of the problem it is unclear what should be done
 with duplicate values. My solution assigns every value a different
 rank (starting from 0) such that the highest rank is len(my_dict) - 1.

The two other possibilities were to still make len(my_dict) ranks but
assign equal values an equal rank. That would mean that some ranks are
untaken. Or, lastly, to make only as much ranks as there are unique
values.
 
 def annotate_with_rank(my_dict):
 items = my_dict.items()
 items.sort(key = lambda (k, v): v)
 return dict((k, (i, v)) for i, (k, v) in enumerate(items))

def annotate_with_rank_2(my_dict):
values = my_dict.values()
values.sort()
return dict((k, (values.index(v), v)) for k, v in my_dict.iteritems())

def annotate_with_rank_3(my_dict):
values = list(set(my_dict.itervalues()))
values.sort()
return dict((k, (values.index(v), v)) for k, v in my_dict.iteritems())

Best regards,
Frank Benkstein.

-- 
GPG (Mail): 7093 7A43 CC40 463A 5564  599B 88F6 D625 BE63 866F
GPG (XMPP): 2243 DBBA F234 7C5A 6D71  3983 9F28 4D03 7110 6D51


signature.asc
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: flattening/rolling up/aggregating a large sorted text file

2007-03-22 Thread Eddie Corns
[EMAIL PROTECTED] writes:

Hi,

Given a large ascii file (delimited or fixed width) with one ID field
and dimensions/measures fields, sorted by dimensions, I'd like to
flatten or rollup the file by creating new columns: one for each
combination of dimension level, and summing up measures over all
records for a given ID.

If the wheel has already been invented, great, please point me in the
right direction. If not, please share some pointers on how to think
about this problem in order to write efficient code.

Is a hash with dimension level combinations a good approach, with
values reset at each new ID level?

I know mysql, Oracle etc will do this , but they all have a cap on #
of columns allowed. SAS will allow unlimited columns, but I don't own
SAS.

Thanks.


ID,color,shape,msr1
--
001, blue, square,  4
001, red , circle,5
001, red,  circle,6


ID, blue_circle, blue_square, red_circle, red_square
--
001,0,4,11,0
002 ...

Something like:

import sys
from sets import Set

ids  = {}
keys = Set()

for line in sys.stdin:
ID,COL,SHAPE,VAL = [s.strip() for s in line.split(',')]
ids.setdefault(ID,{})
key = '%s_%s'%(COL,SHAPE)
ids[ID].setdefault(key,0)
ids[ID][key] += int(VAL)
keys.add(key)

print 'id',',',','.join([str(key) for key in keys])
for id,cols in ids.items():
print id,',', ', '.join([str(cols.get(k,0)) for k in keys])


Doesn't keep all possible keys just those that are actually used.
Needs to sort() things here and there.

Incidentally I don't think you could do it in SQL at all in this way but you
could do it in a more vertical fashion (eg
001, red, circle, 11
001, blue, square, 4
002, red, rhombus, 99) etc.

Eddie
-- 
http://mail.python.org/mailman/listinfo/python-list


Problem with time

2007-03-22 Thread ian
Hi,

i have a problem with time in python.

1) i got 2 values from mysql db (fields are time type)
2) python get it as type 'datetime.timedelta' (why timedelta???)
3) i need to compare 2 fields with actual time ... EG:
if ArrOutputsAuto[i].TimeFrom = GNow and ArrOutputsAuto[i].TimeTo = GNow:

i need actual time, and 2 fields from DB in datetime.time type (correct me
if i'm wrong) so i can do my test if time= ...

I think i can grab time from DB in string and parse it in
datetime.time(x,x,x) but its not very optimized

Any idea ?

Thanks


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ZSI, SOAP and .NET web services - problem

2007-03-22 Thread Laszlo Nagy

 I tried to use different library - SOAPpy, but I couldn't. It requires
 fpconst library which cannot be installed because its server does not
 respond at all. What a shit...
   
I concur! When I tried to use ZSI the first time, it turned out it has 
no support for attachments. Next time I it turned out that it requires 
PyXML, which has no support and cannot be installed for Window + Python 
2.5. Then I needed to use WSSE login, and then I wanted to authenticate 
with x509. Too many problems. SOAP support for Python is bad indeed.

 Why nobody wants to add SOAP to standard Python library? XML-RPC was added
 and it works without any problems

Unfortunately, cursing won't help. It would be the best to join the ZSI 
group - it is where we can help. However, it is an interesting question. 
Ruby has smaller community, how could they implement a standard SOAP lib?

My personal opinion is that SOAP is a piece of shit itself. It is 
hampered from the beginning. If you are interested why, read this:

http://wanderingbarque.com/nonintersecting/2006/11/15/the-s-stands-for-simple/ 


XML-RPC is a fantastic, often undervalued protocol. You can create a 
new, secure XML-RPC server in Python within 5 minutes. You can write a 
client for it within one minue. It is REALLY simple. I'm using it 
continuously.

In contrast, SOAP is overcomplicated and anything but simple. No one 
should create new web services using SOAP. We have enough problems with 
the existing ones. :-(

Despite SOAP is even not a finished standard, big software companies are 
pushing the technology, can someone explain why? Is it because it only 
works correctly with Java and .NET? I guess the reasons are quite 
financial. :-(

  Laszlo



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: parsing tables with beautiful soup?

2007-03-22 Thread cjl
DB:

Thank you, that worked perfectly.

-CJL

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with time

2007-03-22 Thread Michael Bentley

 1) i got 2 values from mysql db (fields are time type)
 2) python get it as type 'datetime.timedelta' (why timedelta???)
 3) i need to compare 2 fields with actual time ... EG:
 if ArrOutputsAuto[i].TimeFrom = GNow and ArrOutputsAuto[i].TimeTo  
 = GNow:

 i need actual time, and 2 fields from DB in datetime.time type  
 (correct me
 if i'm wrong) so i can do my test if time= ...

 I think i can grab time from DB in string and parse it in
 datetime.time(x,x,x) but its not very optimized

 Any idea ?

Just a guess, really.  Is it perchance a timedelta from the epoch?   
If so, comparison should be easy.


-- 
http://mail.python.org/mailman/listinfo/python-list


testing

2007-03-22 Thread anita_group1
This is a test.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Anton Vredegoor
Michael Bentley wrote:

 Perhaps it is different where you live, but here you can put on your  
 resume relevant things that aren't paying jobs.  Otherwise nobody  
 would ever get their first job, right?

Sure you can. But around here if one has been unemployed for a while 
it's nearly impossible to get hired ever again. It doesn't matter how 
many years programming Python one puts on the resume. Unpaid activities 
are just not *visible*. So HRM people keep asking questions like 'But 
what have you been doing?' In the end I just started my own company, and 
while I'm not always employed as a freelancer I can at least now say I'm 
running my own business.

The basic problem however is that it's just not anyones business whether 
one has been walking through the country making pictures or doing some 
desk job. All that should matter is can he do the job and is he 
motivated. Asking a person who he *is* (resume) is not Pythonic!

Especially if one never reads the output.

A.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Michael Bentley

On Mar 22, 2007, at 12:07 PM, Anton Vredegoor wrote:

 Agreed. There's now probably even room on the job market for those who
 don't belong to the select elite of early adopters. We might even root
 out the professionalist attitude and address the problem of tying  
 people
 to their resumes.

Perhaps it is different where you live, but here you can put on your  
resume relevant things that aren't paying jobs.  Otherwise nobody  
would ever get their first job, right?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Erik Johnson
Actually, after studying this a bit more:
http://docs.python.org/ref/assignment.html

I guess that makes sense. Sorry if I muddied the water for anyone else in my
boat:

n1 = n1.next = n2

The first thing that happens is the expression list is evaluated which is
the thing on the far right, n2. That is a simple object reference which is
then assigned to each of the target lists, left to right, of which there are
two: n1 and n1.next.

So, first, n1 is assigned the same value n2 has.

Next, n1.next is assigned n2 (The object n1 refers to, which is also now n2,
is assigned a new attribute, that value of which is n2).

So, yeah... as Terry Reedy said: better to be explicit about what you want
to happen first and not mash them together into one line.

That would be... how do you say... Pythonic?

(God, I feel so much better now. LOL)


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: challenge ?

2007-03-22 Thread Paul Rubin
alain [EMAIL PROTECTED] writes:
 def annotate_with_rank(my_dict):
   
   return my_annotated_dict
 
 In other words, any value a_value would become a 2-tuple
 (a_value,rank_of_a_value)
 
 I seek an elegant solution.

Untested:

   def annotate_with_rank(my_dict):
s = sorted( ((v,i),k) for i,(k,v) in enumerate(my_dict.iteritems()))
return dict((k,v) for (v,k) in s)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why brackets commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-22 Thread Steve Holden
Bart Willems wrote:
 dmitrey wrote:
 1st still is shorter by 1 char; considering majority of people use
 space after comma  number of parameters can be big it yileds
 foo bar baz bar2 bar3 bar4
 vs
 foo(bar, baz, bar2, bar3, bar4)
 
 I think most readers already agree on the ambiguities part. Now, for the 
 length of the code...
 I agree that in you example the first syntax yields a full /five/ spaces 
 less than the second syntax. However, it ignores the fact that if you 
 are creating functions with that many arguments, you are probably doing 
 something wrong. Can't those arguments be provided as a list?

I'm in danger of getting short-tempered on c.l.py for the first time in 
a long time. If you think that five arguments is an excessive number for 
a function then you live in a world of toy programs.

 Let's see what is shorter:
 
 foo bar baz bar2 bar3 bar4
 or
 foo *bars
 
 Not to mention that it might (or might not) be a good idea to wrap the 
 function in some kind of class where you can specify a whole bunch of 
 attributes, so that you do not have to call a function with that many 
 arguments to start with.

Right, I think I have to assume that you're taking the piss.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings   http://holdenweb.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why brackets commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-22 Thread Paul Rubin
Steve Holden [EMAIL PROTECTED] writes:
  I agree that in you example the first syntax yields a full /five/
  spaces less than the second syntax. However, it ignores the fact
  that if you are creating functions with that many arguments, you are
  probably doing something wrong. Can't those arguments be provided as
  a list?
 
 I'm in danger of getting short-tempered on c.l.py for the first time
 in a long time. If you think that five arguments is an excessive
 number for a function then you live in a world of toy programs.

There's no need for functions of more than one argument.  Even in
existing Python syntax, instead of

   def f(a,b,c,d,e): ...

you could say

   def f((a,b,c,d,e)): ...

and receive a,b,c,d,e in a single tuple.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Michael Bentley

On Mar 22, 2007, at 1:00 PM, Anton Vredegoor wrote:

 So HRM people keep asking questions like 'But
 what have you been doing?' In the end I just started my own  
 company, and
 while I'm not always employed as a freelancer I can at least now  
 say I'm
 running my own business.

Yeah, I've decided to stay out of the statutory employee role myself  
-- and my resume looks fine.

Or at least it looks good up until the time I made that decision ;-)

I'm doing just fine with freelance work. I work when I want and I  
don't have to deal with people who think they can judge my ability to  
accomplish a goal by asking how much X do you have? (where X is  
some skill, language, toolkit, whatever)  That how much X do you  
have question always made me grit my teeth.

obtw, thanks for my new signature :-)

-Michael
---
Asking a person who he *is* ... is not Pythonic!  --Anton Vredegoor




-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] Python courses this Spring

2007-03-22 Thread wesley chun
I'll be giving a variety of Python courses this Spring.  Daytime
courses are for visitors and locals who need Python training in the
shortest amount of time possible via consecutive workdays.  Python is
certainly gaining momentum as our February course filled up
completely!  Although I had planned on scheduling the same set to be
taught in November, it is likely that these May daytime sessions are
the last ones of 2007.

In contrast, I'm experimenting with a *weekly evening* course in
Silicon Valley designed mainly for locals.  It represents a viable
alternative to those who cannot take time off during the week as well
as being more budget-friendly, as I am partnering with a local
community college (Foothill) to offer this course.  Class takes place
on the main campus and you must register through the college to
attend.

For more information, such as cost and other course details, see the
corresponding websites below. Contact me privately if you have any
more questions.

cheers,
-wesley

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Core Python Programming, Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

DAYTIME
===
- (Intensive) Introduction to Python (Mon-Wed, May 14-16)
- Advanced Python Programming (Wed-Fri, May 16-18)
- Advanced Python (short course; Thu-Fri, May 17-18)
- Core Python (Intro+Advanced combo; Mon-Fri, May 14-18)

These courses run daily 9a-5p and will take place in San Bruno right
near the San Francisco International Airport at the:

Staybridge Suites - San Francisco Airport
1350 Huntington Ave
San Bruno, CA  94066 USA
http://www.ichotelsgroup.com/h/d/sb/1/en/hd/sfobr

Discounts are available for students and teachers, as well as multiple
registrations from those working at the same company.  For more info
and registration, go to http://cyberwebconsulting.com (click on
Python Training)

LOCALS: free parking and 101/280/380 access, BART across the street
and CalTrain down the road (San Bruno stations)

VISITORS: free hotel shuttle to/from the San Francisco airport, lots
of free food and wireless, 2-bedroom suites w/private baths and a
common work/living area available for traveling coworkers, and of
course, The City by the Bay
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

EVENING
===
- Intermediate Python Programming (Tues, Apr 10-Jun 26)

This course will cover the same topics as the advanced course above as
well as critical portions of the intensive introductory course. It
will be held once a week on Tuesday evenings from 6-9:40p.

Foothill College
12345 El Monte Road
Los Altos Hills, CA  94022 USA
(right off 280, just south of Stanford)

http://www.foothill.edu/schedule/schedule.php
search for CIS 68L for Spring Quarter 2007
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   >