Re: python source code -> win/dos executable (on linux)

2010-06-29 Thread Lawrence D'Oliveiro
In message <[email protected]>, superpollo 
wrote:

> Lawrence D'Oliveiro ha scritto:
>> 
>> Is it really such a hassle to install things on Windows?
> 
> no, but it *IS* to explain it to dumb users... :-(

Can’t you create an installation package that specifies Python and all the 
other necessary dependencies, so the Windows package-management system will 
automatically pull the right versions in when the user does the 
installation?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.system: string encoding

2010-06-29 Thread Lawrence D'Oliveiro
In message , Peter Kleiweg 
wrote:

> How do I set the string encoding for os.system to anything other then
> UTF-8?

Works for me (on Debian Unstable):

l...@theon:~> echo $LC_ALL
en_NZ.utf8
l...@theon:~> python3.1
Python 3.1.2 (r312:79147, May  8 2010, 13:27:06) 
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system('echo \N{EURO SIGN}')
€
0
>>> '\N{EURO SIGN}'
'€'
>>> 

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


Re: 回复: I wander which is better? JSP or Pytho n? And is there a place for JSP?

2010-06-29 Thread 戴清灏
Sorry for having delayed to reply.
Your response really inspired me.
I am a sophomore student in China,My major is computer network.
Since so,besides I really love web development,I should focus more
attention on Python as it means a lot to web applications.
Python is so laconic that it makes me feeling reading a poem instead of codes.
Thanks
Roger
From a college in China
:)

2010/6/28, Chris Rebert :
>> -- 原始邮件 --
>> 发件人: "Chris Rebert";
>> 发送时间: 2010年6月28日(星期一) 中午1:09
>> 收件人: "Roger";
>> 主题: Re: I wander which is better? JSP or Python? And is there a place for
>> JSP?
>>
>> On Sun, Jun 27, 2010 at 9:49 PM, Roger  wrote:
>> > As I plan to study JSP, I find it extremly complicated and a part of
>> > J2EE.
>> > I did not attend to get the whole of J2EE.
>> > I hope anybody can describe the future of JSP.
>> > Is there a place for JSP?
>>
>> This is python-list/comp.lang.python; we discuss the **Python**
>> programming language and related topics here. Your question is about
>> **Java** and has nothing to do with Python.
>
> 2010/6/27 rogerdai16 
> Subject: I wander which is better? JSP or Python? And is there a place for
> JSP?
>> Oh, sorry.
>> I was just to make a comparison between Python and JSP.Will Python take the 
>> place of JSP?
>
> Ah, my apologies, I neglected to notice your post's Subject, which is
> where you establish the relation to Python. (I hate it when people put
> critical info in the Subject but don't explicitly mention this in the
> message body...)
>
> You're asking for a very apples-and-oranges comparison. Python is an
> entire general-purpose programming language (as is Java), whereas JSP
> is (approximately) a Java web templating technology, something much
> more specific.
>
> So, could Python /itself/ replace JSP? No, of course not; like I said,
> apples and oranges.
> Python Server Pages (http://en.wikipedia.org/wiki/Python_Server_Pages
> ) vs. JSP would be a more apt comparison. However, PSP per se doesn't
> seem to be used much. Also, drop-in replacing JSP with PSP or similar
> would involve extra complexity in trying to integrate the two
> languages together, and thus probably not be worth the trouble
> (although Jython might remedy this somewhat).
>
> So, zooming out further in order to move towards more sensible
> comparisons: Can Python replace Java in web applications? Yes, surely.
> Many significant, successful web applications have been written in
> Python using various Python web frameworks (e.g. Django), which often
> include their own Python-based templating system. Is it a good idea to
> port something from Java to Python just for the sake of using Python?
> Probably not; if it ain't broke, don't fix it (though that's not to
> say don't refactor it).
>
> Zooming out even further, hopefully to the level of question you meant
> to ask: Could/Will Python displace Java (and thus JSP) for web
> programming?
> Who can say? It would be something of a religious debate.
> In the abstract, yes, I think it could; the requisite mature,
> well-designed web frameworks are already extant. Over time, they might
> attract more newbies than Java frameworks (although I am admittedly
> only guessing here based on Java stereotypes).
> Realistically, no, it won't, except perhaps in the extreme long run
> (Java has too much momentum); but we Pythonistas are having enough fun
> doing our own web stuff in Python-land that we don't need to try and
> be hyper-competitive and actively usurp Java's existing niche in the
> web application ecosystem.
>
> Cheers,
> Chris
> --
> I hope this thorough answer sufficiently compensates for my improperly
> bitey initial response.
> http://blog.rebertia.com
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python dynamic attribute creation

2010-06-29 Thread Bruno Desthuilliers

Aahz a écrit :

In article <[email protected]>,
Bruno Desthuilliers   wrote:

Aahz a écrit :

In article <[email protected]>,
Bruno Desthuilliers   wrote:
Python has no pretention at "elegance". 

That's not true at all.  More precisely, I would agree with you if the
emphasis is on "pretention" but not if the emphasis is on elegance;

Python Zen, #9 (or #8 if you're a TrueHacker !-))


...and this implies that Python has no focus on elegance because...?


Nope, that was an answer about where the emphasis was in my previous 
statement. I don't mean Python don't care about or is devoid of 
elegance, just that it's not the primary concern - hence the "has no 
pretention at" part.

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


Re: [ANN] optphart (alpha2)

2010-06-29 Thread Steven D'Aprano
On Mon, 28 Jun 2010 22:41:17 -0700, rantingrick wrote:

> """
> I am pleased to announce optphart (alpha2)!


I'm not sure this counts as a project worthy of an official release 
announcement and a version number, it's more of a recipe. Perhaps you 
should put it on the ActiveState cookbook?

http://code.activestate.com/recipes/langs/python/



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


Re: Python as a scripting language. Alternative to bash script?

2010-06-29 Thread Jorgen Grahn
On Mon, 2010-06-28, John Nagle wrote:
> On 6/28/2010 7:58 AM, Benjamin Kaplan wrote:
>> How does a program return anything other than an exit code?
>
> Ah, yes, the second biggest design mistake in UNIX.
>
> Programs have "argv" and "argc", plus environment variables,
> going in.  So, going in, there are essentially subroutine parameters.
> But all that comes back is an exit code. They should have had
> something similar coming back, with arguments to "exit()" returning
> the results.  Then the "many small intercommunicating programs"
> concept would have worked much better.

Like others said, you have standard output. sys.stdout for data,
sys.stderr for human-readable errors and warnings, and the exit code
for machine-readable errors.

> C was like that once.  In the 1970s, all you could return was
> an "int" or a "float".  But that got fixed.

Huh? The C we have today cannot return a float, and not even a full int.
0 and 1 work, small integers up to 255 are likely to work, but beyond
that common systems (Unix) will chop off the high bits.

/Jorgen

-- 
  // Jorgen GrahnO  o   .
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python as a scripting language. Alternative to bash script?

2010-06-29 Thread Jorgen Grahn
On Mon, 2010-06-28, Dave Pawson wrote:
> I've a fairly long bash script and I'm wondering
> how easy it would be to port to Python.
>
> Main queries are:
> Ease of calling out to bash to use something like imageMagick or Java?
> Ease of grabbing return parameters? E.g. convert can return both
> height and width of an image. Can this be returned to the Python program?
> Can Python access the exit status of a program?
>
> I'd prefer the advantages of using Python, just wondering if I got
> so far with the port then found it wouldn't do something?

As other remarked, bash has advantages, too.

Personally, if my main job is chaining other non-trivial programs into
pipelines and sequences, I don't hesitate to use Bourne shell or bash.
Perl is for heavier text processing, and Python for problems with more
elaborate data types.

Note the distinction Bourne shell/bash. If you can get away with it,
use bash for medium/large-sized scripts. Many people try to avoid
bash-specific syntax, but they miss out on lots of things that make
programs maintainable, like local variables.

/Jorgen

-- 
  // Jorgen GrahnO  o   .
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python as a scripting language. Alternative to bash script?

2010-06-29 Thread eric dexter
On Jun 28, 5:48 am, Dave Pawson  wrote:
> I've a fairly long bash script and I'm wondering
> how easy it would be to port to Python.
>
> Main queries are:
> Ease of calling out to bash to use something like imageMagick or Java?
> Ease of grabbing return parameters? E.g. convert can return both
> height and width of an image. Can this be returned to the Python program?
> Can Python access the exit status of a program?
>
> I'd prefer the advantages of using Python, just wondering if I got
> so far with the port then found it wouldn't do something?
>
> Has anyone made this comparison please?
>
> TIA
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.http://www.dpawson.co.uk

You do have a couple of couple of python scriting programs that are
like bash.  I don't know if they are worth using though (you would
have to look them up I don't recall the names right now)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why are String Formatted Queries Considered So Magical?

2010-06-29 Thread Nobody
On Tue, 29 Jun 2010 12:30:36 +1200, Lawrence D'Oliveiro wrote:

>> Seriously, almost every other kind of library uses a binary API. What
>> makes databases so special that they need a string-command based API?
> 
> HTML is also effectively a string-based API.

HTML is a data format. The sane way to construct or manipulate HTML is via
the DOM, not string operations.

> And what about regular expressions?

What about them? As the saying goes:

Some people, when confronted with a problem, think
"I know, I'll use regular expressions."
Now they have two problems.

They have some uses, e.g. defining tokens[1]. Using them to match more
complex constructs is error-prone and should generally be avoided unless
you're going to manually verify the result. Oh, and you should never
generate regexps dynamically; that way madness lies.

[1] Assuming that the language's tokens can be described by a regular
grammar. This isn't always the case, e.g. you can't tokenise PostScript
using regexps, as string literals can contain nested parentheses.

> And all the functionality available through the subprocess 
> module and its predecessors?

The main reason why everyone recommends subprocess over its predecessors
is that it allows you to bypass the shell, which is one of the most
common sources of the type of error being discussed in this thread.

IOW, rather than having to construct a shell command which (hopefully)
will pass the desired arguments to the child, you just pass the desired
arguments to the child directly, without involving the shell.

> The reality is, embedding one language within another is a fact of life. I 
> think it’s important for programmers to be able to deal correctly with it.

That depends upon what you mean by "embedding". The correct way to use
code written in one language from code written in another is to make the
first accept parameters and make the second pass them, not to have the
second (try to) generate the former dynamically.

Sometimes dynamic code generation is inevitable (e.g. if you're writing a
compiler, you probably need to generate assembler or C code), but it's not
to be done lightly, and it's unwise to take shortcuts (e.g. ad-hoc string
substitutions).

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


Re: Python dynamic attribute creation

2010-06-29 Thread Andre Alexander Bell
On 06/25/2010 03:15 PM, WANG Cong wrote:
> 1) Modifying a class attribute is metaprogramming, and this is modifying
> a class, i.e. adding a new attribute to it, thus this should belong
> to metaprogramming. (I know, strictly speaking, maybe my definition of
> "metaprogramming" here is incorrect, I _do_ welcome someone could
> correct me if I am really wrong, but that is not the main point here,
> please don't go off-topic.)

We should define meta programming a little more. First attempt:

Programming is the art of writing down instructions such that when
executed accordingly will do what has been pre-specified.

Meta programming is the art of writing down instructions such that when
executed accordingly will program instructions that when executed
accordingly will do what has been pre-specified.

>From this definition I would argue that a dynamic attribute assignement
is _not_ meta programming. It is just modifying an object.

> 2) Metaprogramming should be distinguished with non-meta programming,
> like templates in C++, it is obvious to see if you are using template
> metaprogramming in C++.

In my opinion meta programming is programming. It's just changing the
view a little bit such that the program itself is nothing but data.

> 3) Thus, allowing dynamic attribute creation by assignment _by default_
> is not a good design for me. It is not obvious at all to see if I am
> doing metaprogramming at a first glance.

As said previously I don't think one should differentiate between meta
programming and programming within the language, since the former is
nothing different than the latter.

> 4) Also, this will _somewhat_ violate the OOP princples, in OOP,
> this is and should be implemented by inherence.

This is another point. Whether or not a language allows dynamic or
static meta programming is completely orthogonal to whether or not it is
a pure OO language.

Python is not pure OO as others already did explain. You may still use
it in pure OO style.

If you would like to write your program in a complete OO style than
adding an attribute (may as well be a method) from external

class Sample(object):
pass

s = Sample()
s.a = 1

has to be completely omitted. The same goes for adding attributes within
some method of that particular class.

class Sample(object):
def addsomething(self):
self.a = 1

s = Sample()
s.addsomething()

This would have to be omitted as well.

In a complete OO style _no_ further attributes or methods are allowed to
be added beyond the declaration of the class. Where is this declaration
in Python? You might argue it is the __init__ method and that only there
attributes should be added. This is. however, only a convention in Python.

Variable instantiation is dynamic in Python. That is the variable is
declared upon assignment.

If you fire up an interactive session and write

a = 1

then this declares the variable a and assigns a value to that variable.

> 5) This could hide errors silently, for example, when I do:
> 
 test.typo = "blah"

Yes. Such a typo would not be detected.

> 1) Disallow dynamic attribute creations by assignments _by default_,
> thus I expect an error when I do:

So far I only did tell you _how_ it is in Python. If I understand your
question about the design of the language correctly than you would like
Python to detect the typo. Let's for the moment assume that the
declaration would be decoupled from assigning a value.

The first thing that would have to change is that in a class declaration
we would have to specify at least the names of the attributes and
methods. E.g.

class Sample(object):
var a
def __init__(self):
self.a = 1

s = Sample()
s.b = 1
-> Exception

This however would furthermore change the way you would have to write a
function and a method due to possible internal variables

def somefunc():
var a
var b
a = 1
b = 2
return a+b

As soon as you would need a variable you would always first have to
declare that variable and then assign a value.

Even on the interactive shell you would have to do so:

>>> var a
>>> a = 1
>>> b = 2
-> Exception

Why would this declaration be necessary on the shell and in the
function/method? Declaring a variable means adding that variable to the
namespace, i.e. the underlying dictionary. There is one in each object,
the locals() of a function or even the __dict__ of a module.

The downside of this is that Python has no such thing as a variable
without a value. Still you would need such a thing for this approach

>>> var a
>>> a
-> should raise an variable 'unset' exception

The underlying dictionary would need the ability to store keys (variable
names) without values.

This approach increases the code length considerably, just to catch the
typos.

Keep in mind that the module you are writing in is just an object as is
any function or method. So using local variables therein you are doing
exactly what you want to abandon from the OOP part.

Regards

Andre
-- 
htt

Re: N00b question: matching stuff with variables.

2010-06-29 Thread Sion Arrowsmith
Stephen Hansen   wrote:
>On 6/28/10 10:29 AM, Ken D'Ambrosio wrote:
>> for line in file:
>> match = re.search((seek)",(.*),(.*)", line) # Stuck here
> [ ... ]
> name, foo, bar = line.split(",")
> if seek in name:
> # do something with foo and bar
>
>That'll return True if the word 'seek' appears in the first field of 
>what appears to be the comma-delimited line.

If the file input is comma-delimited, then the OP might very well
want a look at the csv module. Something like:

for line in reader(file):
if line[0] == seek:
# first field matches, do something with line[-1] and line[-2]
# -- I'm not quite sure what the semantics of a pair of greedy
# (.*)s would be

-- 
\S

   under construction

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


Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom ?Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread Gone Fishin'
> Now is the time to pay back by defending the CONSTITUTION and first
> step is spreading the INCONTROVERTIBLE EVIDENCE of the CRIME and the
> CRIMINALS.

You're right. 

Now please stop posting here. You're not converting anyone, you're alienating 
them. 

I'll meet you in the constitutional and 911 forums where we can discuss it in 
detail. 

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


Re: Why are String Formatted Queries Considered So Magical?

2010-06-29 Thread Duncan Booth
Owen Jacobson  wrote:

> However, not every programming language has 
> the kind of structural flexibility to do that well: a library similar 
> to SQLalchemy would be incredibly clunky (if it worked at all) in, 
say, 
> Java or C#, and it'd be nearly impossible to pull off in C.

I guess you've never used LINQ in C# then?

Microsoft did a pretty impressive job with LINQ: they provided a set of 
methods that may be used to query SQL databases and the same methods 
also work on any other sequence-like types. They also produced a DSL 
that compiles into the LINQ method calls which means that those who 
prefer SQL syntax can use it to process non-SQL data.

A LINQ expression produces a generator that allows you to iterate over 
the result set (and you can re-use the generator so that if it depends 
on the values of other variables or attributes each time you iterate you 
get a different set of results).

When you use LINQ on a SQL database internally it generates the correct 
SQL to produce the result set on the SQL server, when you use it on an 
array or other such sequence it uses generic functions compiled for the 
appropriate data types. In order to be able to do this they changed the 
language to allow expressions to compile either to executable code or to 
a parse tree. For example:

var participants =
Competition.GetParticipants()
.Where(participant=> participant.Score > 80)
.OrderByDescending(participant => participant.Score)
.Select(participant => new { participant.Id,
 Name=participant.Name });

If this is operating on a database table the Where method is overloaded 
to accept a parse tree as its argument and it can then use that to 
generate SQL, but for .Net objects the Where method simply uses the 
lambda expression as a callable delegate.

(example cribbed from 
http://geekswithblogs.net/shahed/archive/2008/01/28/118992.aspx)

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pydev 1.5.8 Released

2010-06-29 Thread Fabio Zadrozny
On Tue, Jun 29, 2010 at 12:37 AM, ejosvp  wrote:
> On 28 jun, 22:35, ejosvp  wrote:
>> I have a problem with pydev 1.5.8
>>
>> An error has occurred. See error log for more details.
>> com.aptana.editor.common.CommonEditorPlugin.getThemeManager()Lcom/
>> aptana/editor/common/theme/IThemeManager;
>>
>> I seek the file and that file does not exist

Hi,

Thanks for the report. I'll fix that and make a new release later
today. The problem is that I stopped changes in pydev and started
testing locally on June 21st and the new Aptana release from June 24th
is not totally backward compatible -- and unfortunately no one saw
that issue with the nightly build before the release either :(

Cheers,

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


Re: dynamically modify help text

2010-06-29 Thread Thomas Jollans
On 06/29/2010 02:37 AM, Ben Finney wrote:
> Brian Blais  writes:
> 
>> On Jun 28, 2010, at 14:25 , Chris Rebert wrote:
>>> __doc__ is normally defined on classes, e.g. `A`, not instances,
>>> e.g. `a`. help() looks for __doc__ accordingly.
>>
>> so that gets back to my original question: can I change this text at
>> runtime.  Doesn't look like I can, because it is defined for classes
>> rather than instances.  Am I thinking about this correctly?
> 
> Classes are objects. You can change the ‘__doc__’ attribute of a class
> object the same as you'd change it for any other object::
> 
> A.__doc__ = "new docstring"
> 

No, you can't. Well, yeah, you can. But you can't. But you can. Ahrgh

I want Python 2.x to go away. It's so inconsistent and silly.

% python2.6
Python 2.6.5+ (release26-maint, Jun 28 2010, 19:46:36)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class OLD: pass
...
>>> class NEW(object): pass
...
>>> OLD.__doc__ = "foo"
>>> NEW.__doc__ = "bar"
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute '__doc__' of 'type' objects is not writable
>>>

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


Re: validate string representation of a timedelta

2010-06-29 Thread Thomas Jollans
On 06/29/2010 03:41 AM, CM wrote:
> I'm looking for a good way to check whether a certain string is
> valid.  It is a string representation of a Python timedelta object,
> like this:  '0:00:03.695000'
> 
> (But the first place, the hours, could also be double digits)
> 
> In trying to figure out how to validate that, I saw this page which
> creates a parseTimeDelta(s) function, which takes that kind of string
> and returns a timedelta object:
> 
> http://kbyanc.blogspot.com/2007/08/python-reconstructing-timedeltas-from.html
> (and I agree that this sort of function should come standard with
> datetime)
> 
> I modified the code to accept microseconds, too, and I can use it now
> by trying to parse my candidate string and if it throws an exception,
> rejecting that string as invalid.  It works fine on strings that are
> not even close to my format, like '0 min'. But it doesn't throw an
> exception on something like:  '0:00:03.695000extrajunk'
> 
> I'd like it to be pickier than that with the validation and only
> accept strings which are truly string representations of timedelta
> objects.  But I have not learned regex yet, so am not sure how to
> modify parseTimeDetla so it wouldn't work with
> '0:00:03.695000extrajunk'.
> 
> My question:  is there a simple way to modify the parseTimeDelta so
> that it will work ONLY with a string that would be the string
> representation of a timedelta object?

If you want the end of the regexp to correspond to the end of the
string, add a "$" at the end of the regexp.

>
> Alternately, is there an easier/more Pythonic approach to validate
> this kind of string?
>


Or you could do something along the lines of:

shrs, smins, ssecs = s.split(':')
# convert, do things.

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


Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread [email protected]
On Jun 26, 12:16 pm, nanothermite911fbibustards
 wrote:

  Let's talk about thermite.

  Do you know anything about thermite? It's a powdered mixture of a
metal oxide and another pure metal that, when raised to a specific
minimum temperature, allows the metal to "steal" the oxygen from the
metal oxide, evolving heat. Example, iron oxide loses its oxygen to
aluminum, yielding aluminum oxide and metallic iron, plus heat.

  Do you know what temperature it must be brought to in order to
ignite it?

  How do you propose the alleged "nanothermite" supposedly spread
around the towers was raised to that temperature *simultaneously*?

  Do you know what amount of heat (not temperature) a given mass of
thermite can produce?

  What amount of heat could the particles of your alleged
"nanothermite" produce? Remember, each particle burns only as long as
the oxide component can provide oxygen to the pure metal component of
the thermite.


  Mark L. Fergerson
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why are String Formatted Queries Considered So Magical?

2010-06-29 Thread Roy Smith
Nobody  wrote:

> > And what about regular expressions?
> 
> What about them? As the saying goes:
> 
>   Some people, when confronted with a problem, think
>   "I know, I'll use regular expressions."
>   Now they have two problems.

That's silly.  RE is a good tool.  Like all good tools, it is the right 
tool for some jobs and the wrong tool for others.

I've noticed over the years a significant anti-RE sentiment in the 
Python community.  One reason, I suppose, is because Python gives you 
some good string manipulation tools, i.e. split(), startswith(), 
endswith(), and the 'in' operator, which cover many of the common RE use 
cases.  But there are still plenty of times when a RE is the best tool 
and it's worth investing the effort to learn how to use them effectively.

One tool that Python gives you which makes RE a pleasure is raw strings.  
Getting rid of all those extra backslashes really helps improve 
readability.

Another great feature is VERBOSE.  I've written some truly complicated 
REs using that, and still been able to figure out what they meant the 
next day :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: More MySQL Stuff

2010-06-29 Thread Victor Subervi
On Mon, Jun 28, 2010 at 2:24 PM, Emile van Sebille  wrote:

> On 6/28/2010 9:10 AM Victor Subervi said...
>
>> Any other suggestions?
>>
>
>
> http://www.databaseanswers.org/tutorial4_db_schema/index.htm


Thanks. Good tutorial.
beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: N00b question: matching stuff with variables.

2010-06-29 Thread Stephen Hansen

On 6/29/10 2:51 AM, Sion Arrowsmith wrote:

Stephen Hansen  wrote:

On 6/28/10 10:29 AM, Ken D'Ambrosio wrote:

for line in file:
 match = re.search((seek)",(.*),(.*)", line) # Stuck here

[ ... ]
 name, foo, bar = line.split(",")
 if seek in name:
 # do something with foo and bar

That'll return True if the word 'seek' appears in the first field of
what appears to be the comma-delimited line.


If the file input is comma-delimited, then the OP might very well
want a look at the csv module. Something like:

for line in reader(file):
 if line[0] == seek:
 # first field matches, do something with line[-1] and line[-2]
 # -- I'm not quite sure what the semantics of a pair of greedy
 # (.*)s would be



True: but I've personally never seent he point of the csv module unless 
we're talking about a more complicated csv format, such as one with 
quoting in fields. I don't know if that's what the OP is working with, 
but good point: csv might be a good approach if this is more complicated 
format then just a line with a couple commas.


--

   ... Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

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


Re: Why are String Formatted Queries Considered So Magical?

2010-06-29 Thread Stephen Hansen

On 6/29/10 5:41 AM, Roy Smith wrote:

Nobody  wrote:


And what about regular expressions?


What about them? As the saying goes:

Some people, when confronted with a problem, think
"I know, I'll use regular expressions."
Now they have two problems.


That's silly.  RE is a good tool.  Like all good tools, it is the right
tool for some jobs and the wrong tool for others.


There's nothing silly about it.

It is an exaggeration though: but it does represent a good thing to keep 
in mind.


Yes, re is a tool -- and a useful one at that. But its also a tool which 
/seems/ like an omnitool capable of tackling everything.


Regular expressions are a complicated mini-language well suited towards 
extensive use in a unix type environment where you want to embed certain 
logic of 'what to operate on' into many different commands that aren't 
languages at all -- and perl embraced it to make it perl's answer to 
text problems. Which is fine.


In Python, certainly it has its uses: many of them in fact, and in many 
it really is the best solution.


Its not just that its the right tool for some jobs and the wrong tool 
for others, or that -- as you said also -- that Python provides a rather 
rich string type which can do many common tasks natively and better, but 
that regular expressions live in the front of the mind for so many 
people coming to the language that its the first thing they even think 
of, and what should be simple becomes difficult.


So people quote that proverb. Its a good proverb. As all proverbs, its 
not perfectly applicable to all situations. But it does has an important 
lesson to it: you should generally not consider re to be the solution 
you're looking for until you are quite sure there's nothing else to 
solve the same task.


It obviously applies less to the guru's who know all about regular 
expressions and their subtleties including potential pathological behavior.


--

   ... Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

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


Re: optphart (alpha2)

2010-06-29 Thread Stephen Hansen

On 6/28/10 11:50 PM, rantingrick wrote:

You just don't get the point, do you?


And just what *point* an i supposed to be "getting" Stephen? That you
don't like my contribution? If thats your point then i very much "get"
it.


This garbage:

"optphart is the nemisis of the asinine interfaces and bulky libraries
you may be accustomed to in the stdlib. All of which clog your scripts
with wasted lines and your memory with complex interfaces far worse
than any colon clogging putrifaction of junk food can hold a candle
to. Do yourself a favor and give your scripts an enema by harnessing
the simplistic elegance of the "optphart" module instead!"

It doesn't advocate your solution; it doesn't describe the benefits of 
using it; it doesn't provide a reasonable or technical basis by which it 
is in some way superior to others.


It just hand waves other solutions (which exist and are more fully 
featured for *very* good reasons-- but you don't bother addressing why 
less is more here, you basically just declare it all shit) all the while 
being simply insulting to the authors and users of those solutions.


--

   ... Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

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


Re: python source code -> win/dos executable (on linux)

2010-06-29 Thread Stephen Hansen

On 6/29/10 12:27 AM, Lawrence D'Oliveiro wrote:

In message<[email protected]>, superpollo
wrote:


Lawrence D'Oliveiro ha scritto:


Is it really such a hassle to install things on Windows?


no, but it *IS* to explain it to dumb users... :-(


Can’t you create an installation package that specifies Python and all the
other necessary dependencies, so the Windows package-management system will
automatically pull the right versions in when the user does the
installation?


At first, on reading this, I assumed it was sarcastic (and sort of 
decided not to reply, because anti-windows is too easy); but on reading 
again I'm not so sure, you're writing it all out so .. dry. Then again, 
'hearing' tone in text is hard.


If this isn't sarcastic: windows has no package management system. You 
include every dependency manually (in varying forms) or things don't run.


Windows has a way to track what you install, and the ability to 
uninstall about three fourths of it later. That's it.


--

   ... Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

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


Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Mark Lawrence

On 29/06/2010 01:55, Roy Smith wrote:

[snips]


The nice thing about null-terminated strings is how portable they have
been over various word lengths.


The bad thing about null-terminated strings is the number of off-by-one 
errors they've helped to create.  I obviously have never created an 
off-by-one error myself. :)


Kindest regards.

Mark Lawrence.


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


Re: N00b question: matching stuff with variables.

2010-06-29 Thread Tim Golden

On 29/06/2010 15:14, Stephen Hansen wrote:

True: but I've personally never seent he point of the csv module unless
we're talking about a more complicated csv format, such as one with
quoting in fields. I don't know if that's what the OP is working with,
but good point: csv might be a good approach if this is more complicated
format then just a line with a couple commas.


The most common reason is that it caters for all the nastiness of embedded
commas, quotes etc. which you'd otherwise have to end up reinventing. If
you know your data's just a string of numbers, then just use s.split (",").

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


Re: Why Python3

2010-06-29 Thread Martin v. Loewis
> I should point out that this wasn't a mere whimsy on Guido's part. 
> Mathematically, supporting larger-than and less-than comparisons on 
> complex numbers *is* a bug -- they're simply meaningless mathematically. 
> (Which is greater, 2-1i or -1+2i?)

However, that's true for many other values that *where* ordered in 2.x.
Which is greater, (1,2) or [1,2]? It's meaningless mathematically.

Likewise (if you claim that comparing lists and tuples is like comparing
apples and oranges) - how should these be ordered:
file("/etc/passwd"), file("/etc/group"), and sys.stdin?

> What Python needs[1] is a "sorting" operator, which is allowed to return 
> a consistent if arbitrary sort order (perhaps lexicographic sort order?), 
> separate from the ordinary > and < operators. This would allow the caller 
> to sort lists of arbitrary items for display purposes, without implying 
> anything about the relative size of items.

And indeed, that's available, by means of the key= argument to list.sort.

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


Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread nanothermite911fbibustards
On Jun 29, 5:24 am, "[email protected]"  wrote:
> On Jun 26, 12:16 pm, nanothermite911fbibustards
>
>  wrote:
>
>   Let's talk about thermite.
>
>   Do you know anything about thermite? It's a powdered mixture of a
> metal oxide and another pure metal that, when raised to a specific
> minimum temperature, allows the metal to "steal" the oxygen from the
> metal oxide, evolving heat. Example, iron oxide loses its oxygen to
> aluminum, yielding aluminum oxide and metallic iron, plus heat.
>
>   Do you know what temperature it must be brought to in order to
> ignite it?
>
>   How do you propose the alleged "nanothermite" supposedly spread
> around the towers was raised to that temperature *simultaneously*?
>
>   Do you know what amount of heat (not temperature) a given mass of
> thermite can produce?
>
>   What amount of heat could the particles of your alleged
> "nanothermite" produce? Remember, each particle burns only as long as
> the oxide component can provide oxygen to the pure metal component of
> the thermite.
>
>   Mark L. Fergerson

Spoook, All your QUESTIONS are answered in the papers by 911 truth
videos, by Dr Steven Jones and his VIDEOS !!!

Go to st911.org and start looking !!!

Go to 911blogger.com and start reading !!!

Go to youtube and google for 911truth.

They had military type wireless coordinated cutter charges that they
accessed from under the elevator shafts. One or all of CIA , MOSSAD ,
Blackwater , Kroll etc may have been involved.

Wasn't Israeli attack and murder of US Soldiers and NSA employees on
USS Liberty covered up ?
Wasn't Israeli attack and murder of US Soldiers and NSA employees on
USS Liberty covered up ?
Wasn't Israeli attack and murder of US Soldiers and NSA employees on
USS Liberty covered up ?
Wasn't Israeli attack and murder of US Soldiers and NSA employees on
USS Liberty covered up ?
Wasn't Israeli attack and murder of US Soldiers and NSA employees on
USS Liberty covered up ?
Wasn't Israeli attack and murder of US Soldiers and NSA employees on
USS Liberty covered up ?
Wasn't Israeli attack and murder of US Soldiers and NSA employees on
USS Liberty covered up ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python dynamic attribute creation

2010-06-29 Thread WANG Cong
On 06/29/10 17:48, Andre Alexander Bell  wrote:

> On 06/25/2010 03:15 PM, WANG Cong wrote:
>> 1) Modifying a class attribute is metaprogramming, and this is modifying
>> a class, i.e. adding a new attribute to it, thus this should belong
>> to metaprogramming. (I know, strictly speaking, maybe my definition of
>> "metaprogramming" here is incorrect, I _do_ welcome someone could
>> correct me if I am really wrong, but that is not the main point here,
>> please don't go off-topic.)
>
> We should define meta programming a little more. First attempt:
>
> Programming is the art of writing down instructions such that when
> executed accordingly will do what has been pre-specified.
>
> Meta programming is the art of writing down instructions such that when
> executed accordingly will program instructions that when executed
> accordingly will do what has been pre-specified.
>
>>From this definition I would argue that a dynamic attribute assignement
> is _not_ meta programming. It is just modifying an object.
>


Yeah, probably this is the correct and strict definition of
"metaprogramming". Thanks for correction.

However, as I said above, I just wanted to borrow the word
"metaprogramming" to express my meaning.

What I meant is actually programming classes, you can call it
"class-programming" if not "metaprogramm".



>> 3) Thus, allowing dynamic attribute creation by assignment _by default_
>> is not a good design for me. It is not obvious at all to see if I am
>> doing metaprogramming at a first glance.
>
> As said previously I don't think one should differentiate between meta
> programming and programming within the language, since the former is
> nothing different than the latter.
>

If you check other programming language rather than Python, it is
different. Even in Ruby which is also a dynamic language.




> Python is not pure OO as others already did explain. You may still use
> it in pure OO style.
>

Yeah, even C can also have some OO style. But that is not the point.



>
>> 1) Disallow dynamic attribute creations by assignments _by default_,
>> thus I expect an error when I do:
>
> So far I only did tell you _how_ it is in Python. If I understand your
> question about the design of the language correctly than you would like
> Python to detect the typo. Let's for the moment assume that the
> declaration would be decoupled from assigning a value.
>


Nope, I would like Python not to allow adding a new attribute via an
assignment by default, detecting the typo is a side-effect.


> The first thing that would have to change is that in a class declaration
> we would have to specify at least the names of the attributes and
> methods. E.g.
>
> class Sample(object):
> var a
> def __init__(self):
> self.a = 1
>
> s = Sample()
> s.b = 1
> -> Exception
>
> This however would furthermore change the way you would have to write a
> function and a method due to possible internal variables
>
> def somefunc():
> var a
> var b
> a = 1
> b = 2
> return a+b
>
> As soon as you would need a variable you would always first have to
> declare that variable and then assign a value.
>
> Even on the interactive shell you would have to do so:
>
 var a
 a = 1
 b = 2
> -> Exception
>
> Why would this declaration be necessary on the shell and in the
> function/method? Declaring a variable means adding that variable to the
> namespace, i.e. the underlying dictionary. There is one in each object,
> the locals() of a function or even the __dict__ of a module.
>
> The downside of this is that Python has no such thing as a variable
> without a value. Still you would need such a thing for this approach
>
 var a
 a
> -> should raise an variable 'unset' exception
>
> The underlying dictionary would need the ability to store keys (variable
> names) without values.
>
> This approach increases the code length considerably, just to catch the
> typos.
>
> Keep in mind that the module you are writing in is just an object as is
> any function or method. So using local variables therein you are doing
> exactly what you want to abandon from the OOP part.
>

Hmm, this looks really appealing.

But if so why setattr() still exists? What is it for if we can do the
same thing via assignments? Also, in order to be perfect, Python should
accept to add dynamic attributes dynamically, something like PEP
363. That doesn't happen.

Thanks!


-- 
Live like a child, think like the god.
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Third World War is Coming - Who is Webster Tarpley ?

2010-06-29 Thread nanothermite911fbibustards
On Jun 28, 11:25 pm, nanothermite911fbibustards
 wrote:
> Third World War is Coming - Who is Webster Tarpley ?
>
> http://www.youtube.com/watch?v=jLaaPBV9nqAhttp://www.youtube.com/watch?v=KV6oKRnM4mYhttp://www.youtube.com/watch?v=y53R_h-OZAM

Third World War is Coming - Who is Webster Tarpley ?

http://www.youtube.com/watch?v=jLaaPBV9nqA
http://www.youtube.com/watch?v=KV6oKRnM4mY
http://www.youtube.com/watch?v=y53R_h-OZAM

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


Re: Python dynamic attribute creation

2010-06-29 Thread WANG Cong
On 06/27/10 12:01, Carl Banks  wrote:

> On Jun 25, 8:24 pm, WANG Cong  wrote:
>> Understand, but please consider my proposal again, if we switched to:
>>
>> setattr(foo, 'new_attr', "blah")
>>
>> by default, isn't Python still dynamic as it is? (Please teach me if I
>> am wrong here.)
>>
>> This why I said the questionable thing is not so much related with dynamic
>> programming or not.
>
> Because it makes dynamicism harder to do.
>
> Like I said, Python's goal isn't simply to make dynamicism possible,
> it's to make it easy.
>
> "foo.new_attr = 'blah'" is easier than using setattr.
>

I do agree it's easier, but why do we need this to be easy? This is
really my question.

Also, since it is easier, why not drop the harder one, setattr()?


-- 
Live like a child, think like the god.
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread nanothermite911fbibustards
On Jun 29, 5:24 am, "[email protected]"  wrote:
> On Jun 26, 12:16 pm, nanothermite911fbibustards
>
>  wrote:
>
>   Let's talk about thermite.

SPOOOK MOTHER FUCKER, I will talk what I want to talk.

I know you are an ODIOUS SPK, which has many aliases on newsnet
like Uncle Al and you have TWO GOALS !!!

1) Harass people who talk of 911 truth
2) Discredit people who talk of 911 truth
3) Destroy threads under various aliases where they is any useful
technical information being discussed because you are RACIST and dont
want DISSEMINATION of KNOWLEDGE

4) I have closely scrutinized your thread and they involve disrupting
threads. If there is 911 truth or someother useful truth your ilk then
starts spamming with porn and other crap. You work for CIA ? FBI ?
BLACKWATER ? KROLL ?

Third World War is Coming - Who is Webster Tarpley ?

http://www.youtube.com/watch?v=jLaaPBV9nqA
http://www.youtube.com/watch?v=KV6oKRnM4mY
http://www.youtube.com/watch?v=y53R_h-OZAM

>   Do you know anything about thermite? It's a powdered mixture of a
> metal oxide and another pure metal that, when raised to a specific
> minimum temperature, allows the metal to "steal" the oxygen from the
> metal oxide, evolving heat. Example, iron oxide loses its oxygen to
> aluminum, yielding aluminum oxide and metallic iron, plus heat.
>
>   Do you know what temperature it must be brought to in order to
> ignite it?
>
>   How do you propose the alleged "nanothermite" supposedly spread
> around the towers was raised to that temperature *simultaneously*?
>
>   Do you know what amount of heat (not temperature) a given mass of
> thermite can produce?
>
>   What amount of heat could the particles of your alleged
> "nanothermite" produce? Remember, each particle burns only as long as
> the oxide component can provide oxygen to the pure metal component of
> the thermite.
>
>   Mark L. Fergerson

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


Python v3.1.2 documentation question

2010-06-29 Thread Ethan Furman

In the glossary section it states:


nested scope

The ability to refer to a variable in an enclosing definition. For 
instance, a function defined inside another function can refer to 
variables in the outer function. Note that nested scopes work only for 
reference and not for assignment which will always write to the 
innermost scope. In contrast, local variables both read and write in the 
innermost scope. Likewise, global variables read and write to the global 
namespace.



Doesn't the nonlocal keyword make variables in outer scopes writable?

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


Infinite prime number generator

2010-06-29 Thread Thomas Jollans
I've been toying with Haskell a bit, and after implementing
(essentially) the Sieve of Eratosthenes as an infinite list, thus:

primes = 1 : foldr elim_mult [] [2..]
where elim_mult n l = n : filter ((/=0) . (`mod` n)) l

I wondered how easy it would be to do the same thing in Python.
Obviously, Python doesn't have Haskell's infinite lists as such, and
normally evaluates expressions eagerly instead of lazily, but it's
still, with generators, relatively simple do create infinite sequences
(which aren't, strictly speaking, sequences)

So, here's the same thing as a Python generator, in a simple imperative
style:

def primes():
yield 1
i = 2
old = set()
while True:
for p in old:
if (i % p) == 0:
break
else:
old.add(i)
yield i
i += 1

Haskell:
*Main> take 10 primes
[1,2,3,5,7,11,13,17,19,23]
*Main>

Python:
>>> from itertools import islice
>>> list(islice(primes(), 0, 10))
[1, 2, 3, 5, 7, 11, 13, 17, 19, 23]
>>>

So far, so good. But then I thought, how close to the haskell version
can a Python generator get?
foldr is like functools.reduce, except that it's right-associative. In
Haskell, it works for infinite lists because Haskell is a lazy bastard,
but it's not that difficult to express the exactly same thing with
recursive generators:

if isinstance(filter(None, []), list): # Python 2
from itertools import ifilter as filter

def rprimes():
def elim_mult(n):
yield n
for p in filter((lambda x:x%n != 0), elim_mult(n+1)): yield p
yield 1
for p in elim_mult(2): yield p

This sort of works:
>>> list(islice(rprimes(), 0, 10))
[1, 2, 3, 5, 7, 11, 13, 17, 19, 23]
>>>

But it has a bit of a problem:
>>> sl = islice(rprimes(), None, None, 150) #step=150
>>> next(sl)
1
>>> next(sl)
863
>>> next(sl)

 [..]

  File "primes.py", line 21, in elim_mult
for p in filter((lambda x:x%n != 0), elim_mult(n+1)): yield p
  File "primes.py", line 21, in elim_mult
for p in filter((lambda x:x%n != 0), elim_mult(n+1)): yield p
  File "primes.py", line 21, in elim_mult
for p in filter((lambda x:x%n != 0), elim_mult(n+1)): yield p
RuntimeError: maximum recursion depth exceeded
>>>

If you happen to have a copy of stackless lying around, I'd expect it to
work!

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


Re: Python dynamic attribute creation

2010-06-29 Thread Chris Rebert
On Tue, Jun 29, 2010 at 9:48 AM, WANG Cong  wrote:
> On 06/27/10 12:01, Carl Banks  wrote:
>> On Jun 25, 8:24 pm, WANG Cong  wrote:
>>> Understand, but please consider my proposal again, if we switched to:
>>>
>>> setattr(foo, 'new_attr', "blah")
>>>
>>> by default, isn't Python still dynamic as it is? (Please teach me if I
>>> am wrong here.)
>>>
>>> This why I said the questionable thing is not so much related with dynamic
>>> programming or not.
>>
>> Because it makes dynamicism harder to do.
>>
>> Like I said, Python's goal isn't simply to make dynamicism possible,
>> it's to make it easy.
>>
>> "foo.new_attr = 'blah'" is easier than using setattr.
>
> I do agree it's easier, but why do we need this to be easy? This is
> really my question.

Conversely: Why do we need to make it harder than necessary?

> Also, since it is easier, why not drop the harder one, setattr()?

Because there's no way to write the following without using setattr()
or similar, aside from adding new syntax:

attr_name = raw_input("Enter an identifier: ")
setattr(x, attr_name, 42)

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Python profiler usage with objects

2010-06-29 Thread harit
Hi,

I have a specific question regarding the usage of profiler. I am new
to python programming I am trying to profile a function which I want
to invoke as a class method, something like this

import profile

class Class:

def doSomething():

do here ..

def callMethod():

**self.doSomething()**
instead of this I want to use

**profile.run(self.doSomething())**
but the profile.run expects the string inside it and I get error

TypeError: exec: arg 1 must be a string, file, or code object

Can somebody please help?

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


Re: Python dynamic attribute creation

2010-06-29 Thread Ethan Furman

WANG Cong wrote:

On 06/27/10 12:01, Carl Banks  wrote:


On Jun 25, 8:24 pm, WANG Cong  wrote:

Understand, but please consider my proposal again, if we switched to:

setattr(foo, 'new_attr', "blah")

by default, isn't Python still dynamic as it is? (Please teach me if I
am wrong here.)

This why I said the questionable thing is not so much related with dynamic
programming or not.

Because it makes dynamicism harder to do.

Like I said, Python's goal isn't simply to make dynamicism possible,
it's to make it easy.

"foo.new_attr = 'blah'" is easier than using setattr.



I do agree it's easier, but why do we need this to be easy? This is
really my question.


To excerpt from
http://www1.american.edu/cas/econ/faculty/isaac/choose_python.pdf

Choose the simple over the complex, and the complex over the complicated.




Also, since it is easier, why not drop the harder one, setattr()?


Because setattr and friends are needed when the variable names are 
constructed dynamically.


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


Re: Python dynamic attribute creation

2010-06-29 Thread Ethan Furman

WANG Cong wrote:

On 06/29/10 17:48, Andre Alexander Bell  wrote:


As said previously I don't think one should differentiate between meta
programming and programming within the language, since the former is
nothing different than the latter.



If you check other programming language rather than Python, it is
different. Even in Ruby which is also a dynamic language.


If Python were going to be the same as other languages, what would be 
the point of having Python?




So far I only did tell you _how_ it is in Python. If I understand your
question about the design of the language correctly than you would like
Python to detect the typo. Let's for the moment assume that the
declaration would be decoupled from assigning a value.


Nope, I would like Python not to allow adding a new attribute via an
assignment by default, detecting the typo is a side-effect.


I, for one, am very happy that Python allows it -- if I wanted to jump 
through hoops for simple things I'd use some other language.




But if so why setattr() still exists? What is it for if we can do the
same thing via assignments? Also, in order to be perfect, Python should
accept to add dynamic attributes dynamically, something like PEP
363. That doesn't happen.


Setattr and friends exist to work with dynamic attributes.

"The Perfect Language" does not exist, and never will.  I'm not even 
sure it could exist for a single person, let alone a group of people 
with disparate needs, patterns of thought, etc.


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


Re: Python dynamic attribute creation

2010-06-29 Thread Stephen Hansen

On 6/29/10 9:48 AM, WANG Cong wrote:

On 06/27/10 12:01, Carl Banks  wrote:


On Jun 25, 8:24 pm, WANG Cong  wrote:

Understand, but please consider my proposal again, if we switched to:

setattr(foo, 'new_attr', "blah")

by default, isn't Python still dynamic as it is? (Please teach me if I
am wrong here.)

This why I said the questionable thing is not so much related with dynamic
programming or not.


Because it makes dynamicism harder to do.

Like I said, Python's goal isn't simply to make dynamicism possible,
it's to make it easy.

"foo.new_attr = 'blah'" is easier than using setattr.



I do agree it's easier, but why do we need this to be easy? This is
really my question.


The question is fundamentally invalid, really.

"Why do we need this--"

What does need have to do with it?

We use the standard assignment and deletion semantics because there's no 
reason not to; the syntax is readable, understandable, straight-forward, 
and useful.


"Why not make it harder--" you've basically asked repeatedly.

Why would we make it harder?

There's no reason to.

There's no reason to change to "setattr by default", for although it 
would make Python dynamic, it would be harder to be dynamic. When given 
a choice between "easier" and "harder" the answer is simply, always, 
easier. It is not for us to defend *why* -- easier wins, period. If you 
think that harder would be better, it is for you to defend why it 
*needs* to be harder. Not vice versa.


"It is easier" is, by itself, the end of the justification. There need 
be no other, unless there is some compelling reason why making a certain 
thing easier is *bad* -- this is a real consideration that is made on 
occasion, but the burden of proof is on you.



Also, since it is easier, why not drop the harder one, setattr()?


Why would we? There are some corner cases where setattr is easier then 
other options (such as thing.__dict__[key]).


There is no exclusive-OR here. There's no reason to drop "the harder one".

--

   ... Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

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


Russian Spies ???? This is Hilarious !!!!! Does anyone BELIEVE it ? after 911 Inside JOB and ANTHRAX

2010-06-29 Thread nanothermite911fbibustards
YanQui  cry babies using old RACIST formula of Harassment !!!

To Harass Muslims :- Make a Movie of Bin Laden from a Studio in
Langley Virginia with an actor with SILICONE mask

and release on the internet

with FBI working on AUTHENTICATING it.

Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
CREDIBILITY with your own ODIOUS HANDS 

Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
CREDIBILITY with your own ODIOUS HANDS 

Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
CREDIBILITY with your own ODIOUS HANDS 

They cry HOARSE on Abdul Qader Khan, while its a FACT

that CENTRIFUGE technology was STOLEN by GERMANS from RUSSIA. It was
RUSSIA which invented the centrifuge running on a single ball. The
DUTCH and BRITISH stole it under URENCO.

USA stole it from LIBYA.
USA stole it from LIBYA.
USA stole it from LIBYA.

The concept of CENTRIFUGE as the possibility was PROLIFERATED by MAD
JEWS of New York Times, Washington POST and the NEOCONS. I learnt the
CONCEPT from the NEWSPAPERS and before that the books were LYING about
the Gas DIFFUSION PLANT or some Reactor Reprocessing Plant. The word
KRYTRON was also PROLIFERATED by MAD Neocons.

==

Hey FBI BUSTARDS, I ask you a POINTED QUESTION in PUBLIC ?

If you are SO competent, tell me where is the ANTHRAX MAILER and where
are his sound and VIDEO TESTIMONIALS ?

Where is the trail leading from nanothermite residue collected by DR
STEVEN JONES to the actual 911 perpetrators ?

What about the Testimonials  of  EXPLOSIVES and EXPLOSIONS  !

==


http://nymag.com/daily/intel/2010/06/russian_spies_seem_to_have_bee.html
http://nymag.com/daily/intel/2010/06/russian_spies_seem_to_have_bee.html

Russian Spies’ Dumbest Mistakes
6/29/10 at 11:00 AM Comment 22Comment 22Comments
Anna Chapman.
Photo: Patrick McMullan
This morning, a lot of the papers said the Justice Department's
complaint about the Russian spies read like "a Cold War thriller." But
between their yapping about their work in cafés, their decision to
write anti-American editorials in newspapers (because no one will
notice if they're in Spanish!) and the plain fact that, over ten
years, none of these ten intelligence agents actually gathered any
intelligence (they're being charged with being unregistered, not with
obtaining classified materials), it's more like a Cold War–era comedy,
in the vein of Rocky and Bullwinkle. Let's take a look at some of the
gang's most awkward moments.

It appears the incompetence came from the top. For instance, someone
at the S.V.R. actually sent them this directive:

“You were sent to U.S.A. for long-term service trip,” it said. “Your
education, bank accounts, car, house etc. — all these serve one goal:
fulfill your main mission, i.e. to search and develop ties in
policymaking circles and send intels [intelligence reports] to
C[enter].”


Thanks for the expository dialogue, super-secret agency!

While several of them quite successfully immersed themselves in
American culture, particularly the Murphys, whom neighbors called
"suburbia personified" (“They couldn’t have been spies,” one neighbor
quipped, awesomely, “Look what she did with the hydrangeas”), others
explained away their weirdness with flimsy excuses, like Tracey Foley,
of Cambridge. According to a neighbor:

“She said they were from Canada.”


Right, because that worked for the Coneheads.

Then there's the methods they used to conduct their work, which were
so over-the-top dramatic (briefcase-switching, short-wave-radio-using)
that they may as well have been wearing signs reading, "We Are SPIES."
The Post picks up on the following, which it calls a "particularly
slick spy exchange" between one "Anna Chapman" and a fellow spy.

Chapman pulled a laptop out of a tote bag in a bookstore at Warren and
Greenwich streets in the West Village while her handler lurked
outside, receiving her message on his own computer, the feds said.


Wait, how is that slick, exactly? He was standing right outside. If
she had just gone and told him in person, then the Feds mightn't have
gotten hold of the e-mail using what according to the complaint was a
common "commercially available" wireless-connection interceptor that
even Ali Wise owns.

Chapman, we are sorry to say, seems to be one of the least bright
bulbs in this box. In addition to the above scenario, she 1)
registered a cell phone under the preposterous address of "99 Fake
Street," and in the end, fell hard for a ridiculous scenario posed to
her by undercover U.S. agents.

The undercover instructed her on how she would recognize her fellow
spy and how to report back on the handoff, the feds said.

"Haven’t we met in California last summer?" the spy expecting the fake
passport was supposed to say. Chapman was to respond, "No, I think it
was the Hamptons," according to the FBI.


Oh, that dialogue. It's like they are making fun of her to her face.
It gets worse:

Chapman allegedly was also supposed to h

Re: Python dynamic attribute creation

2010-06-29 Thread Stephen Hansen

On 6/29/10 9:46 AM, WANG Cong wrote:

1) Disallow dynamic attribute creations by assignments _by default_,
thus I expect an error when I do:


So far I only did tell you _how_ it is in Python. If I understand your
question about the design of the language correctly than you would like
Python to detect the typo. Let's for the moment assume that the
declaration would be decoupled from assigning a value.


Nope, I would like Python not to allow adding a new attribute via an
assignment by default, detecting the typo is a side-effect.


Python does not do restrictions by default, period. If you wish to not 
add new attributes to objects, it is up to you to police yourself. This 
is Python. This is how Python rolls.




But if so why setattr() still exists? What is it for if we can do the
same thing via assignments? Also, in order to be perfect, Python should
accept to add dynamic attributes dynamically, something like PEP
363. That doesn't happen.


What does perfection have to do with anything? Python does not strive 
for perfection. More then that, it rejects the entire idea of perfection 
when it gets in the way of simply solving problems in an easy, clean, 
readable, and reliable way. "Practicality beats purity".


PEP 363 proposes adding new syntax: for new syntax to be accepted into 
the language one must meet a *very* high bar. One must show a clear, 
compelling reason why this new mental burden is worth increasing the 
complexity of the language.


Syntax won't get added to make the language more "perfect" to some 
ideals (especially not ideals to some paradigm like OOP, as opposed to 
its own internal ideals of readability, ease and practicality).


Syntax is a burden. Every change in syntax, every addition in syntax, 
requires everyone's to mental investment to increase: it costs more 
mental energy to use the language, to fully understand it, then it did 
before.


There has to be some real use-case, some *real* code out in the *real* 
world which is doing something, and its hard-- and you have to do this 
hard thing often enough that you are burdened by it-- and only then is 
it reasonable to ask for syntax to be added to Python to make it easier.


Alternatively, if there's something that's not even possible for you to 
to today, but you have a *real* problem you'd like to solve, a *real* 
need to do something new: then you can ask for something to be added to 
the language.


Barring that, its not worth the cost of making the language bigger. PEP 
363 didn't meet that burden: sure, there's times when you need to do 
that-- I've done it several times-- but the solutions that exist to 
solve that problem (setattr) are "good-enough" that it isn't really much 
of a burden to do. Moreover, during the discussion of PEP 363, someone 
proposed (Raymond Hettinger, I think) an excellent recipe which not only 
made the 'good enough' quite a bit easier, but which a lot of people 
thought was even cleaner then syntax.


So, PEP363 went the way of the dodo.

Is Python perhaps less perfect, pure, with that addition to the language 
denied?


Who cares? Perfection is what the Borg* worship, I like understandable. :)

--

   ... Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

P.S. *Not calling anyone a borg! Seven of Nine said they worshipped 
perfection, remember?

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


Re: Python v3.1.2 documentation question

2010-06-29 Thread Stephen Hansen

On 6/29/10 10:01 AM, Ethan Furman wrote:

In the glossary section it states:


nested scope

The ability to refer to a variable in an enclosing definition. For
instance, a function defined inside another function can refer to
variables in the outer function. Note that nested scopes work only for
reference and not for assignment which will always write to the
innermost scope. In contrast, local variables both read and write in the
innermost scope. Likewise, global variables read and write to the global
namespace.


Doesn't the nonlocal keyword make variables in outer scopes writable?


Yes. I'd submit a doc bug.

--

   ... Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

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


Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread UltimatePatriot
On Tue, 29 Jun 2010 09:31:07 -0700 (PDT), nanothermite911fbibustards
 wrote:

>They had military type wireless coordinated cutter charges that they
>accessed 

  You're a goddamned idiot.

  You think that we did not go to the moon as well, right?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread UltimatePatriot
On Tue, 29 Jun 2010 09:46:06 -0700 (PDT), nanothermite911fbibustards
 wrote:

>I know you are an ODIOUS SPK, which has many aliases on newsnet
>like Uncle Al and you have TWO GOALS !!!

 Yer a goddamned kook, boy.  Run over to the kook group.

  Uncle Al has only ever posted into Usenet under his moniker.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Third World War is Coming - Who is Webster Tarpley ?

2010-06-29 Thread small Pox
On Jun 29, 9:41 am, nanothermite911fbibustards
 wrote:
> On Jun 28, 11:25 pm, nanothermite911fbibustards
>
>  wrote:
> > Third World War is Coming - Who is Webster Tarpley ?
>
> >http://www.youtube.com/watch?v=jLaaPBV9nqAhttp://www.youtube.com/watc...
>
> Third World War is Coming - Who is Webster Tarpley ?
>
> http://www.youtube.com/watch?v=jLaaPBV9nqAhttp://www.youtube.com/watch?v=KV6oKRnM4mYhttp://www.youtube.com/watch?v=y53R_h-OZAM

http://www.youtube.com/watch?v=oNo2kDkstBo

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


Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread Thomas 'PointedEars' Lahn
UltimatePatriot crossposted twice over 4 off-topic newsgroups without 
Followup-To, replying to an obvious troll:

> [...]

One good thing about Usenet is that you don't have to look for people you 
can safely put into your killfile; they'll agglomerate automatically.


F'up2 set accordingly
-- 
PointedEars
-- 
http://mail.python.org/mailman/listinfo/python-list


Find slope of function given empirical data.

2010-06-29 Thread Thomas
Hello all.

Trying to find slope of function using numpy.
Getting close, but results are a bit off. Hope someone out here can
help.

import numpy as np

def deriv(y):
x = list(range(len(y)))
x.reverse() # Change from [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
x = np.array(x) #to   [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
y = np.array(y) # x.reverse() is used to put point 0 at end of
list.
z = np.polyfit(x, y, 2)
print np.poly1d(z)
#  Returns:
# 2
#  3.142 x - 18.85 x + 35.13
#  2
# Should be closer to   3.142 x  - 6.283 +
10   
return [z[0] * 2, z[1]]

if __name__=='__main__':
# range(-6,5,1)
# y = 3.141592 * x ** 2 - 6.283184 * x + 10 for x in range(-6, 5,
1)
# 160.796416, 119.95572, 85.398208, 57.12388, 35.132736,
19.424776, 10.0, 6.858408, 10.0, 19.424776, 35.132736
#
# y' = 6.283184 * x - 6.283184  for x in range(-6, 5, 1)
# -43.982288, -37.699104, -31.41592, -25.132736, -18.849552,
-12.566368, -6.283184, 0.0, 6.283184, 12.566368, 18.849552
#
z = deriv([160.796416, 119.95572, 85.398208, 57.12388, 35.132736,
19.424776, 10.0, 6.858408, 10.0, 19.424776, 35.132736])
for x in range(-6,5,1):
print str(w(x)) + ',' ,
# Returns:
# -56.548656, -50.265472, -43.982288, -37.699104, -31.41592,
-25.132736, -18.849552, -12.566368, -6.283184, -1.06581410364e-14,
6.283184
# Should be:
# -43.982288, -37.699104, -31.41592, -25.132736, -18.849552,
-12.566368, -6.283184, 0.0, 6.283184, 12.566368, 18.849552
# Note that the range is offset by 2 positions




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


Re: Russian Spies ???? This is Hilarious !!!!! Does anyone BELIEVE it ? after 911 Inside JOB and ANTHRAX

2010-06-29 Thread small Pox
http://www.youtube.com/watch?v=oNo2kDkstBo
http://www.youtube.com/watch?v=3jNuGBCAAg8
http://www.youtube.com/watch?v=9C4umi2eMrM

http://www.youtube.com/watch?v=PR6s_Ib0I-M
http://www.youtube.com/watch?v=ivTcmbqQCFg
http://www.youtube.com/watch?v=6JzupsT-8Sc

http://www.youtube.com/watch?v=ubacHhs8RUA

http://www.youtube.com/watch?v=C4NmwNE4qps

If confirmed Elena Kagan will be impartial and if not then she wont
http://www.youtube.com/watch?v=aCUo6cORArA


On Jun 29, 10:18 am, nanothermite911fbibustards
 wrote:
> YanQui  cry babies using old RACIST formula of Harassment !!!
>
> To Harass Muslims :- Make a Movie of Bin Laden from a Studio in
> Langley Virginia with an actor with SILICONE mask
>
> and release on the internet
>
> with FBI working on AUTHENTICATING it.
>
> Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> CREDIBILITY with your own ODIOUS HANDS 
>
> Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> CREDIBILITY with your own ODIOUS HANDS 
>
> Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> CREDIBILITY with your own ODIOUS HANDS 
>
> They cry HOARSE on Abdul Qader Khan, while its a FACT
>
> that CENTRIFUGE technology was STOLEN by GERMANS from RUSSIA. It was
> RUSSIA which invented the centrifuge running on a single ball. The
> DUTCH and BRITISH stole it under URENCO.
>
> USA stole it from LIBYA.
> USA stole it from LIBYA.
> USA stole it from LIBYA.
>
> The concept of CENTRIFUGE as the possibility was PROLIFERATED by MAD
> JEWS of New York Times, Washington POST and the NEOCONS. I learnt the
> CONCEPT from the NEWSPAPERS and before that the books were LYING about
> the Gas DIFFUSION PLANT or some Reactor Reprocessing Plant. The word
> KRYTRON was also PROLIFERATED by MAD Neocons.
>
> ==
>
> Hey FBI BUSTARDS, I ask you a POINTED QUESTION in PUBLIC ?
>
> If you are SO competent, tell me where is the ANTHRAX MAILER and where
> are his sound and VIDEO TESTIMONIALS ?
>
> Where is the trail leading from nanothermite residue collected by DR
> STEVEN JONES to the actual 911 perpetrators ?
>
> What about the Testimonials  of  EXPLOSIVES and EXPLOSIONS  !
>
> ==
>
> http://nymag.com/daily/intel/2010/06/russian_spies_seem_to_have_bee.htmlhttp://nymag.com/daily/intel/2010/06/russian_spies_seem_to_have_bee.html
>
> Russian Spies’ Dumbest Mistakes
> 6/29/10 at 11:00 AM Comment 22Comment 22Comments
> Anna Chapman.
> Photo: Patrick McMullan
> This morning, a lot of the papers said the Justice Department's
> complaint about the Russian spies read like "a Cold War thriller." But
> between their yapping about their work in cafés, their decision to
> write anti-American editorials in newspapers (because no one will
> notice if they're in Spanish!) and the plain fact that, over ten
> years, none of these ten intelligence agents actually gathered any
> intelligence (they're being charged with being unregistered, not with
> obtaining classified materials), it's more like a Cold War–era comedy,
> in the vein of Rocky and Bullwinkle. Let's take a look at some of the
> gang's most awkward moments.
>
> It appears the incompetence came from the top. For instance, someone
> at the S.V.R. actually sent them this directive:
>
> “You were sent to U.S.A. for long-term service trip,” it said. “Your
> education, bank accounts, car, house etc. — all these serve one goal:
> fulfill your main mission, i.e. to search and develop ties in
> policymaking circles and send intels [intelligence reports] to
> C[enter].”
>
> Thanks for the expository dialogue, super-secret agency!
>
> While several of them quite successfully immersed themselves in
> American culture, particularly the Murphys, whom neighbors called
> "suburbia personified" (“They couldn’t have been spies,” one neighbor
> quipped, awesomely, “Look what she did with the hydrangeas”), others
> explained away their weirdness with flimsy excuses, like Tracey Foley,
> of Cambridge. According to a neighbor:
>
> “She said they were from Canada.”
>
> Right, because that worked for the Coneheads.
>
> Then there's the methods they used to conduct their work, which were
> so over-the-top dramatic (briefcase-switching, short-wave-radio-using)
> that they may as well have been wearing signs reading, "We Are SPIES."
> The Post picks up on the following, which it calls a "particularly
> slick spy exchange" between one "Anna Chapman" and a fellow spy.
>
> Chapman pulled a laptop out of a tote bag in a bookstore at Warren and
> Greenwich streets in the West Village while her handler lurked
> outside, receiving her message on his own computer, the feds said.
>
> Wait, how is that slick, exactly? He was standing right outside. If
> she had just gone and told him in person, then the Feds mightn't have
> gotten hold of the e-mail using what according to the complaint was a
> common "commercially available" wireless-connection interceptor that
> even Ali Wise owns.
>
> Chapman, we are sorry to say, seems to b

Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread Bart!
On Tue, 29 Jun 2010 19:58:13 +0200, Thomas 'PointedEars' Lahn
 wrote:

>UltimatePatriot crossposted twice over 4 off-topic newsgroups without 
>Followup-To, replying to an obvious troll:

  Whoopie fucking doo, you fucking netkkkop wanna be Usenet PUTZ!

   Your kill file edit announcement post is only about three orders of
magnitude more retarded than anything I ever replied to.  The sad thing
is that you are so goddamned stupid that it is referred to as "hard wired
stupid", and there is no hope that you would ever get a clue about the
bigger picture.

  Whine all you want, pussy boy.

>One good thing about Usenet is that you don't have to look for people you 
>can safely put into your killfile;

  You're pretty funny, opper.

> they'll agglomerate automatically.

  Did mommy help you learn that 'big word' so you could toss it out at
the world to make it appear that you actually have a clue as to what is
going on?


>F'up2 set accordingly

  More retarded behavior, but not nearly as bad as the announcement post
I respond to here. You are a sad case, netkkkop boy.  Pointed ears.

  HA!  You are about as logical as a freshly laid turd.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why Python3

2010-06-29 Thread Paul Rubin
"Martin v. Loewis"  writes:
> And indeed, that's available, by means of the key= argument to list.sort.

Unfortunately what's needed for more generality is the ability to supply
a comparison function, which Python2 also offers, but Python3 removes.
I gave an example a while back of wanting to compare two tree
structures, and Raymond H. explained how to do it with just a key
function, which seemed ok at the time.  But thinking about it further
afterwards, I believe both of us missed then that the method suggested
doesn't always work, so you really do need cmp.  I'll see if I can find
the old post and reconstruct the problem.
-- 
http://mail.python.org/mailman/listinfo/python-list


MURDEROUS CRIMES of ODOUSLY RACIST FBI BUSTARDS !!!

2010-06-29 Thread small Pox
The MURDEROUS Bustards killed a man who was a SAINT .

He ran a sunday soup and food place for the homeless and hungry.


http://www.youtube.com/watch?v=Cnz5N9OubCQ
http://www.youtube.com/watch?v=Cnz5N9OubCQ
http://www.youtube.com/watch?v=Cnz5N9OubCQ
http://www.youtube.com/watch?v=Cnz5N9OubCQ
http://www.youtube.com/watch?v=Cnz5N9OubCQ

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


Re: Russian Spies ???? This is Hilarious !!!!! Does anyone BELIEVE it ? after 911 Inside JOB and ANTHRAX

2010-06-29 Thread small Pox

http://www.youtube.com/watch?v=Cnz5N9OubCQ

On Jun 29, 11:18 am, small Pox  wrote:
> http://www.youtube.com/watch?v=oNo2kDkstBohttp://www.youtube.com/watch?v=3jNuGBCAAg8http://www.youtube.com/watch?v=9C4umi2eMrM
>
> http://www.youtube.com/watch?v=PR6s_Ib0I-Mhttp://www.youtube.com/watch?v=ivTcmbqQCFghttp://www.youtube.com/watch?v=6JzupsT-8Sc
>
> http://www.youtube.com/watch?v=ubacHhs8RUA
>
> http://www.youtube.com/watch?v=C4NmwNE4qps
>
> If confirmed Elena Kagan will be impartial and if not then she 
> wonthttp://www.youtube.com/watch?v=aCUo6cORArA
>
> On Jun 29, 10:18 am, nanothermite911fbibustards
>
>  wrote:
> > YanQui  cry babies using old RACIST formula of Harassment !!!
>
> > To Harass Muslims :- Make a Movie of Bin Laden from a Studio in
> > Langley Virginia with an actor with SILICONE mask
>
> > and release on the internet
>
> > with FBI working on AUTHENTICATING it.
>
> > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > CREDIBILITY with your own ODIOUS HANDS 
>
> > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > CREDIBILITY with your own ODIOUS HANDS 
>
> > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > CREDIBILITY with your own ODIOUS HANDS 
>
> > They cry HOARSE on Abdul Qader Khan, while its a FACT
>
> > that CENTRIFUGE technology was STOLEN by GERMANS from RUSSIA. It was
> > RUSSIA which invented the centrifuge running on a single ball. The
> > DUTCH and BRITISH stole it under URENCO.
>
> > USA stole it from LIBYA.
> > USA stole it from LIBYA.
> > USA stole it from LIBYA.
>
> > The concept of CENTRIFUGE as the possibility was PROLIFERATED by MAD
> > JEWS of New York Times, Washington POST and the NEOCONS. I learnt the
> > CONCEPT from the NEWSPAPERS and before that the books were LYING about
> > the Gas DIFFUSION PLANT or some Reactor Reprocessing Plant. The word
> > KRYTRON was also PROLIFERATED by MAD Neocons.
>
> > ==
>
> > Hey FBI BUSTARDS, I ask you a POINTED QUESTION in PUBLIC ?
>
> > If you are SO competent, tell me where is the ANTHRAX MAILER and where
> > are his sound and VIDEO TESTIMONIALS ?
>
> > Where is the trail leading from nanothermite residue collected by DR
> > STEVEN JONES to the actual 911 perpetrators ?
>
> > What about the Testimonials  of  EXPLOSIVES and EXPLOSIONS  !
>
> > ==
>
> >http://nymag.com/daily/intel/2010/06/russian_spies_seem_to_have_bee.h...
>
> > Russian Spies’ Dumbest Mistakes
> > 6/29/10 at 11:00 AM Comment 22Comment 22Comments
> > Anna Chapman.
> > Photo: Patrick McMullan
> > This morning, a lot of the papers said the Justice Department's
> > complaint about the Russian spies read like "a Cold War thriller." But
> > between their yapping about their work in cafés, their decision to
> > write anti-American editorials in newspapers (because no one will
> > notice if they're in Spanish!) and the plain fact that, over ten
> > years, none of these ten intelligence agents actually gathered any
> > intelligence (they're being charged with being unregistered, not with
> > obtaining classified materials), it's more like a Cold War–era comedy,
> > in the vein of Rocky and Bullwinkle. Let's take a look at some of the
> > gang's most awkward moments.
>
> > It appears the incompetence came from the top. For instance, someone
> > at the S.V.R. actually sent them this directive:
>
> > “You were sent to U.S.A. for long-term service trip,” it said. “Your
> > education, bank accounts, car, house etc. — all these serve one goal:
> > fulfill your main mission, i.e. to search and develop ties in
> > policymaking circles and send intels [intelligence reports] to
> > C[enter].”
>
> > Thanks for the expository dialogue, super-secret agency!
>
> > While several of them quite successfully immersed themselves in
> > American culture, particularly the Murphys, whom neighbors called
> > "suburbia personified" (“They couldn’t have been spies,” one neighbor
> > quipped, awesomely, “Look what she did with the hydrangeas”), others
> > explained away their weirdness with flimsy excuses, like Tracey Foley,
> > of Cambridge. According to a neighbor:
>
> > “She said they were from Canada.”
>
> > Right, because that worked for the Coneheads.
>
> > Then there's the methods they used to conduct their work, which were
> > so over-the-top dramatic (briefcase-switching, short-wave-radio-using)
> > that they may as well have been wearing signs reading, "We Are SPIES."
> > The Post picks up on the following, which it calls a "particularly
> > slick spy exchange" between one "Anna Chapman" and a fellow spy.
>
> > Chapman pulled a laptop out of a tote bag in a bookstore at Warren and
> > Greenwich streets in the West Village while her handler lurked
> > outside, receiving her message on his own computer, the feds said.
>
> > Wait, how is that slick, exactly? He was standing right outside. If
> > she had just gone and told him in person, then the Feds mightn't have
> > gotten hold of the e-mail using 

Re: Python as a scripting language. Alternative to bash script?

2010-06-29 Thread Robert Kern

On 6/29/10 4:06 AM, Jorgen Grahn wrote:

On Mon, 2010-06-28, John Nagle wrote:

On 6/28/2010 7:58 AM, Benjamin Kaplan wrote:

How does a program return anything other than an exit code?


 Ah, yes, the second biggest design mistake in UNIX.

 Programs have "argv" and "argc", plus environment variables,
going in.  So, going in, there are essentially subroutine parameters.
But all that comes back is an exit code. They should have had
something similar coming back, with arguments to "exit()" returning
the results.  Then the "many small intercommunicating programs"
concept would have worked much better.


Like others said, you have standard output. sys.stdout for data,
sys.stderr for human-readable errors and warnings, and the exit code
for machine-readable errors.


 C was like that once.  In the 1970s, all you could return was
an "int" or a "float".  But that got fixed.


Huh? The C we have today cannot return a float, and not even a full int.
0 and 1 work, small integers up to 255 are likely to work, but beyond
that common systems (Unix) will chop off the high bits.


I think he's talking about C functions now, not programs.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: C++/Python function call

2010-06-29 Thread Rami Chowdhury
Hi Zohair,

On Tuesday 29 June 2010 05:24:26 Zohair M. Abu Shaban wrote:
> Dear Rami,
> 
> Thanks for your reply. I am using hardware that uses some libraries on
> Linux. def set_time_at_next_pps(*args, **kwargs):
> """set_time_at_next_pps(self, usrp2::time_spec_t time_spec) ->
> bool""" return _usrp2.usrp2_base_set_time_at_next_pps(*args, **kwargs)
> 
> This is actually a definition of a function in C++ transformed to python.
> It receives a structure parameter and returns boolean the structure is
> defined like this: in a library called libusrp2.so and the header file is
> usrp2.h
> 
>   typedef struct time_spec{
>   uint32_t secs;
>   uint32_t ticks;
>   time_spec(void){
> secs = ~0;
> ticks = ~0;
>   }
>   time_spec(uint32_t new_secs, uint32_t new_ticks = 0){
> secs = new_secs;
> ticks = new_ticks;
>   }
>   } time_spec_t;
> 
> in my python code I wrote:
> zeroise=usrp2.time_spec_t(0,0)
> self.$(id).set_time_at_next_pps(zeroise)
> 
> The error Iam receiveing is :
> zeroise=usrp2.time_spec_t(0,0)
> AttributeError: 'module' object has no attribute 'time_spec_t'
> 

Thank you for the details. Could you let me know how you're accessing the C++ 
code? Are you using ctypes? Are you using a Python extension module that wraps 
the C++ code? Some other method?

> MY PROBLEM THAT I NEED HELP FOR IS:
> 1- Am I using the structure correctly?
> 2- Am I invoking the python definition correctly?

I'd guess not, since you're getting an error ;-)

> 
> Thanks againg for your help.
> 
> JZK
> 
> Zohair
> 
> > From: [email protected]
> > To: [email protected]
> > Subject: Re: C++/Python function call
> > Date: Mon, 28 Jun 2010 13:05:20 -0700
> > CC: [email protected]
> > 
> > On Monday 28 June 2010 12:46:13 Zohair M. Abu Shaban wrote:
> > > Hello every one:
> > > 
> > > 
> > > I have this python function defined as:
> > > 
> > > def set_time_at_next_pps(self, *args, **kwargs):
> > >  """set_time_at_next_pps(self, usrp2::time_spec_t time_spec)
> > > 
> > > -> bool"""
> > > 
> > > 
> > > 
> > > it was generated to do the same function as the c++:
> > > 
> > > set_time_at_next_pps(usrp2::time_spec_t(0, 0))
> > > 
> > > 
> > > I am new to python and don't know hoe to use this python syntax.
> > > 
> > >  Any hint or help please?
> > 
> > Can you give us a little more information? What do you need to use it
> > for?
> > 
> > > Cheers
> > > 
> > > 
> > > Zoh
> > > _
> > > http://clk.atdmt.com/UKM/go/19780/direct/01/
> > > Do you have a story that started on Hotmail? Tell us now
> > 
> > 
> > Rami Chowdhury
> > "Given enough eyeballs, all bugs are shallow." -- Linus' Law
> > +1-408-597-7068 / +44-7875-841-046 / +88-01819-245544
> 
> _
> http://clk.atdmt.com/UKM/go/19780/direct/01/
> Do you have a story that started on Hotmail? Tell us now


Rami Chowdhury
"It always takes longer than you expect, even when you take Hofstadter's
Law into account." -- Hofstadter's Law
+1-408-597-7068 / +44-7875-841-046 / +88-01819-245544
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I strongly dislike Python 3

2010-06-29 Thread Edward A. Falk
In article ,
Stephen Hansen   wrote:
>>
>> Uhmm, just add the parenthesis to your old scripts. You can
>> do that without breaking on 2.x.
>
>Only sort of. But in Python 2.6+, you only need to "from __future__ 
>import print_function" to make code work in both 2.x and 3.x (at least 
>insofar as the print situation is concerned).  

Nice.  Once 100% of the installed base is at 2.6, I'll finally be able
to write code that compatible with 3.0.

-- 
-Ed Falk, [email protected]
http://thespamdiaries.blogspot.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Infinite prime number generator

2010-06-29 Thread John Posner

On 6/29/2010 12:51 PM, Thomas Jollans wrote:


def rprimes():
 def elim_mult(n):
 yield n
 for p in filter((lambda x:x%n != 0), elim_mult(n+1)): yield p
 yield 1
 for p in elim_mult(2): yield p



Thomas, take a look at the thread "Generators/iterators, Pythonicity, 
and primes" in the April 2009 archives of python-list. For example:


  from itertools import ifilter, count
  pgen = ifilter(
lambda n, primes=[]:
all(n%p for p in primes) and not primes.append(n),
count(2)
 )
  for _ in range(50): print pgen.next()

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


Re: C++/Python function call

2010-06-29 Thread Stefan Behnel

Rami Chowdhury, 29.06.2010 20:56:

On Tuesday 29 June 2010 05:24:26 Zohair M. Abu Shaban wrote:

From: [email protected]
On Monday 28 June 2010 12:46:13 Zohair M. Abu Shaban wrote:

I have this python function defined as:

def set_time_at_next_pps(self, *args, **kwargs):
  """set_time_at_next_pps(self, usrp2::time_spec_t time_spec)

->  bool"""

it was generated to do the same function as the c++:


"Generated" by what?



set_time_at_next_pps(usrp2::time_spec_t(0, 0))

I am new to python and don't know hoe to use this python syntax.

  Any hint or help please?


Can you give us a little more information? What do you need to use it
for?


I am using hardware that uses some libraries on Linux.

>>
>> def set_time_at_next_pps(*args, **kwargs):

 """set_time_at_next_pps(self, usrp2::time_spec_t time_spec) ->
 bool

>>  """
>>  return _usrp2.usrp2_base_set_time_at_next_pps(*args, **kwargs)


This is actually a definition of a function in C++ transformed to python.
It receives a structure parameter and returns boolean the structure is
defined like this: in a library called libusrp2.so and the header file is
usrp2.h

   typedef struct time_spec{
   uint32_t secs;
   uint32_t ticks;
   time_spec(void){
 secs = ~0;
 ticks = ~0;
   }
   time_spec(uint32_t new_secs, uint32_t new_ticks = 0){
 secs = new_secs;
 ticks = new_ticks;
   }
   } time_spec_t;

in my python code I wrote:
zeroise=usrp2.time_spec_t(0,0)
self.$(id).set_time_at_next_pps(zeroise)

The error Iam receiveing is :
 zeroise=usrp2.time_spec_t(0,0)
AttributeError: 'module' object has no attribute 'time_spec_t'


What is "usrp2"? The "generated" module?



Thank you for the details. Could you let me know how you're accessing the C++
code? Are you using ctypes? Are you using a Python extension module that wraps
the C++ code? Some other method?


These are the right questions.



MY PROBLEM THAT I NEED HELP FOR IS:
1- Am I using the structure correctly?
2- Am I invoking the python definition correctly?


I'd guess not, since you're getting an error ;-)


Try "dir(usrp2)" or "help(usrp2)", that will tell you what the module provides.

If you're after wrapping the library yourself, take a look at ctypes and 
Cython. Depending on the requirements, either of the two is a good choice.


Stefan

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


Re: I strongly dislike Python 3

2010-06-29 Thread geremy condra
On Tue, Jun 29, 2010 at 2:56 PM, Edward A. Falk  wrote:
> In article ,
> Stephen Hansen   wrote:
>>>
>>> Uhmm, just add the parenthesis to your old scripts. You can
>>> do that without breaking on 2.x.
>>
>>Only sort of. But in Python 2.6+, you only need to "from __future__
>>import print_function" to make code work in both 2.x and 3.x (at least
>>insofar as the print situation is concerned).
>
> Nice.  Once 100% of the installed base is at 2.6, I'll finally be able
> to write code that compatible with 3.0.

I can't tell if you're being unpleasant or not. If so, I'd point out that
if your user base isn't going to be off of 2.5 for the next couple of
years that you have little stake in 3.x one way or the other. If not,
fear not- that happy day will come.

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


Re: CONTROLLED DEMOLITION INC explosive-charge placement technician Tom Sullivan 911 TESTIMONIAL Video

2010-06-29 Thread Pieyed Piper
On Tue, 29 Jun 2010 12:49:50 -0600, m II  wrote:

>See you 

 You are worse than Proteus. He IS a retard. You have no excuse, so for
you, it must be by choice.  Making your mental age below 15 years.

  How sad.  I wonder how long it will take you to notice that I have been
calling you "shit for brains" for over a week now in every post.  Then,
how much longer will it take for you to realize that the statement is
true?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: refactoring a group of import statements

2010-06-29 Thread Aahz
In article ,
Thomas Jollans   wrote:
>
>(3) Why not
>
>try:
>import x
>import y
>import z
>except ImportError as exc:
>display_error_properly(exc)
>raise exc

Why not?  Because that destroys the original traceback.  Inside an
except clause, you should almost always use a bare raise.  (I'm not
absolutely certain that the new "as" subclause doesn't fix the problem,
but why not stick with an idiom guaranteed to work in all versions of
Python.)
-- 
Aahz ([email protected])   <*> http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python v3.1.2 documentation question

2010-06-29 Thread Ethan Furman

Stephen Hansen wrote:

On 6/29/10 10:01 AM, Ethan Furman wrote:

In the glossary section it states:


nested scope

The ability to refer to a variable in an enclosing definition. For
instance, a function defined inside another function can refer to
variables in the outer function. Note that nested scopes work only for
reference and not for assignment which will always write to the
innermost scope. In contrast, local variables both read and write in the
innermost scope. Likewise, global variables read and write to the global
namespace.


Doesn't the nonlocal keyword make variables in outer scopes writable?


Yes. I'd submit a doc bug.


Bug submitted.

~Ethan~

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


Re: validate string representation of a timedelta

2010-06-29 Thread CM
On Jun 29, 8:00 am, Thomas Jollans  wrote:
> On 06/29/2010 03:41 AM, CM wrote:
>
>
>
> > I'm looking for a good way to check whether a certain string is
> > valid.  It is a string representation of a Python timedelta object,
> > like this:  '0:00:03.695000'
>
> > (But the first place, the hours, could also be double digits)
>
> > In trying to figure out how to validate that, I saw this page which
> > creates a parseTimeDelta(s) function, which takes that kind of string
> > and returns a timedelta object:
>
> >http://kbyanc.blogspot.com/2007/08/python-reconstructing-timedeltas-f...
> > (and I agree that this sort of function should come standard with
> > datetime)
>
> > I modified the code to accept microseconds, too, and I can use it now
> > by trying to parse my candidate string and if it throws an exception,
> > rejecting that string as invalid.  It works fine on strings that are
> > not even close to my format, like '0 min'. But it doesn't throw an
> > exception on something like:  '0:00:03.695000extrajunk'
>
> > I'd like it to be pickier than that with the validation and only
> > accept strings which are truly string representations of timedelta
> > objects.  But I have not learned regex yet, so am not sure how to
> > modify parseTimeDetla so it wouldn't work with
> > '0:00:03.695000extrajunk'.
>
> > My question:  is there a simple way to modify the parseTimeDelta so
> > that it will work ONLY with a string that would be the string
> > representation of a timedelta object?
>
> If you want the end of the regexp to correspond to the end of the
> string, add a "$" at the end of the regexp.

Thanks.  That works to do what I need.

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


Re: MURDEROUS CRIMES of ODOUSLY RACIST FBI BUSTARDS !!!

2010-06-29 Thread nanothermite911fbibustards
On Jun 29, 11:35 am, small Pox  wrote:
> The MURDEROUS Bustards killed a man who was a SAINT .
>
> He ran a sunday soup and food place for the homeless and hungry.
>
> http://www.youtube.com/watch?v=Cnz5N9OubCQhttp://www.youtube.com/watch?v=Cnz5N9OubCQhttp://www.youtube.com/watch?v=Cnz5N9OubCQhttp://www.youtube.com/watch?v=Cnz5N9OubCQhttp://www.youtube.com/watch?v=Cnz5N9OubCQ

FBI Bustards - No one believes your ODIOUS LIES !!!

http://www.youtube.com/watch?v=NLo6Y0weyro


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


Re: Infinite prime number generator

2010-06-29 Thread Thomas Mlynarczyk

Thomas Jollans schrieb:

def primes():
yield 1


1 is not a prime number.

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Russian Spies ???? This is Hilarious !!!!! Does anyone BELIEVE it ? after 911 Inside JOB and ANTHRAX

2010-06-29 Thread nanothermite911fbibustards
FBI Bustards - No one believes your ODIOUS LIES !!!

http://www.youtube.com/watch?v=NLo6Y0weyro


On Jun 29, 11:37 am, small Pox  wrote:
> http://www.youtube.com/watch?v=Cnz5N9OubCQ
>
> On Jun 29, 11:18 am, small Pox  wrote:
>
> >http://www.youtube.com/watch?v=oNo2kDkstBohttp://www.youtube.com/watc...
>
> >http://www.youtube.com/watch?v=PR6s_Ib0I-Mhttp://www.youtube.com/watc...
>
> >http://www.youtube.com/watch?v=ubacHhs8RUA
>
> >http://www.youtube.com/watch?v=C4NmwNE4qps
>
> > If confirmed Elena Kagan will be impartial and if not then she 
> > wonthttp://www.youtube.com/watch?v=aCUo6cORArA
>
> > On Jun 29, 10:18 am, nanothermite911fbibustards
>
> >  wrote:
> > > YanQui  cry babies using old RACIST formula of Harassment !!!
>
> > > To Harass Muslims :- Make a Movie of Bin Laden from a Studio in
> > > Langley Virginia with an actor with SILICONE mask
>
> > > and release on the internet
>
> > > with FBI working on AUTHENTICATING it.
>
> > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > They cry HOARSE on Abdul Qader Khan, while its a FACT
>
> > > that CENTRIFUGE technology was STOLEN by GERMANS from RUSSIA. It was
> > > RUSSIA which invented the centrifuge running on a single ball. The
> > > DUTCH and BRITISH stole it under URENCO.
>
> > > USA stole it from LIBYA.
> > > USA stole it from LIBYA.
> > > USA stole it from LIBYA.
>
> > > The concept of CENTRIFUGE as the possibility was PROLIFERATED by MAD
> > > JEWS of New York Times, Washington POST and the NEOCONS. I learnt the
> > > CONCEPT from the NEWSPAPERS and before that the books were LYING about
> > > the Gas DIFFUSION PLANT or some Reactor Reprocessing Plant. The word
> > > KRYTRON was also PROLIFERATED by MAD Neocons.
>
> > > ==
>
> > > Hey FBI BUSTARDS, I ask you a POINTED QUESTION in PUBLIC ?
>
> > > If you are SO competent, tell me where is the ANTHRAX MAILER and where
> > > are his sound and VIDEO TESTIMONIALS ?
>
> > > Where is the trail leading from nanothermite residue collected by DR
> > > STEVEN JONES to the actual 911 perpetrators ?
>
> > > What about the Testimonials  of  EXPLOSIVES and EXPLOSIONS  !
>
> > > ==
>
> > >http://nymag.com/daily/intel/2010/06/russian_spies_seem_to_have_bee.h...
>
> > > Russian Spies’ Dumbest Mistakes
> > > 6/29/10 at 11:00 AM Comment 22Comment 22Comments
> > > Anna Chapman.
> > > Photo: Patrick McMullan
> > > This morning, a lot of the papers said the Justice Department's
> > > complaint about the Russian spies read like "a Cold War thriller." But
> > > between their yapping about their work in cafés, their decision to
> > > write anti-American editorials in newspapers (because no one will
> > > notice if they're in Spanish!) and the plain fact that, over ten
> > > years, none of these ten intelligence agents actually gathered any
> > > intelligence (they're being charged with being unregistered, not with
> > > obtaining classified materials), it's more like a Cold War–era comedy,
> > > in the vein of Rocky and Bullwinkle. Let's take a look at some of the
> > > gang's most awkward moments.
>
> > > It appears the incompetence came from the top. For instance, someone
> > > at the S.V.R. actually sent them this directive:
>
> > > “You were sent to U.S.A. for long-term service trip,” it said. “Your
> > > education, bank accounts, car, house etc. — all these serve one goal:
> > > fulfill your main mission, i.e. to search and develop ties in
> > > policymaking circles and send intels [intelligence reports] to
> > > C[enter].”
>
> > > Thanks for the expository dialogue, super-secret agency!
>
> > > While several of them quite successfully immersed themselves in
> > > American culture, particularly the Murphys, whom neighbors called
> > > "suburbia personified" (“They couldn’t have been spies,” one neighbor
> > > quipped, awesomely, “Look what she did with the hydrangeas”), others
> > > explained away their weirdness with flimsy excuses, like Tracey Foley,
> > > of Cambridge. According to a neighbor:
>
> > > “She said they were from Canada.”
>
> > > Right, because that worked for the Coneheads.
>
> > > Then there's the methods they used to conduct their work, which were
> > > so over-the-top dramatic (briefcase-switching, short-wave-radio-using)
> > > that they may as well have been wearing signs reading, "We Are SPIES."
> > > The Post picks up on the following, which it calls a "particularly
> > > slick spy exchange" between one "Anna Chapman" and a fellow spy.
>
> > > Chapman pulled a laptop out of a tote bag in a bookstore at Warren and
> > > Greenwich streets in the West Village while her handler lurked
> > > outside, receiving her message on his own computer, the feds sai

Crimes of YanQui Anglo Saxon ODIOUSLY CRIMINAL Bustards - BLACKWATER, CIA, FBI

2010-06-29 Thread nanothermite911fbibustards
Crimes of YANQUI Bustards

http://www.youtube.com/watch?v=SYl6NKrmIfQ



The FAT per DIEM FBI bustards use our TAX PAYER MONEY and INCOMPETENCE
is UNACCEPTABLE.

=

http://www.youtube.com/watch?v=lX18zUp6WPY

http://www.youtube.com/watch?v=XQapkVCx1HI

http://www.youtube.com/watch?v=tXJ-k-iOg0M

Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ?
Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did
you release the 5 dancing Israelis compromising the whole 911
investigation ? If the Dubai Police can catch Mossad Murderers and put
the videos and Iranian Police can why cant you put the Pentagon
Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and
puting on INTERNATIONAL MEDIA a day after catching him without
TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did
you have to LIE about Dr Afiya Siddiqui and torture that Innocent
little mother of 3 and smashing the skull of her one child ?

http://www.youtube.com/watch?v=DhMcii8smxk
http://www.youtube.com/watch?v=0SZ2lxDJmdg

There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian
courts.

FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but
only because he was a white. They got away with MURDER of thousands of
Non-whites in all parts of the world.

Daily 911 news : http://911blogger.com

http://www.youtube.com/watch?v=tRfhUezbKLw

http://www.youtube.com/watch?v=x7kGZ3XPEm4

http://www.youtube.com/watch?v=lX18zUp6WPY

Conclusion : FBI bustards are RACIST and INcompetent. They could
neither catch the ANTHRAX or 911 YANK/Jew criminals nor could they
cover them up - whichever was their actual goal or task.

SLASH the SALARIES of FBI/CIA/NSA etc BUSTARDS into half all across
tbe board, esp the whites/jew on the top.

FBI Bustards failed to Catch BERNARD MADOFF even after that RACIST and
UNPATRIOTIC Act
FBI bustards failed to prevent ROMAN POLANSKY from absconding to
europe and rapes.
FBI bustards failed to prevent OKLAHOMA


On Jun 29, 2:13 pm, nanothermite911fbibustards
 wrote:
> FBI Bustards - No one believes your ODIOUS LIES !!!
>
> http://www.youtube.com/watch?v=NLo6Y0weyro
>
> On Jun 29, 11:37 am, small Pox  wrote:
>
> >http://www.youtube.com/watch?v=Cnz5N9OubCQ
>
> > On Jun 29, 11:18 am, small Pox  wrote:
>
> > >http://www.youtube.com/watch?v=oNo2kDkstBohttp://www.youtube.com/watc...
>
> > >http://www.youtube.com/watch?v=PR6s_Ib0I-Mhttp://www.youtube.com/watc...
>
> > >http://www.youtube.com/watch?v=ubacHhs8RUA
>
> > >http://www.youtube.com/watch?v=C4NmwNE4qps
>
> > > If confirmed Elena Kagan will be impartial and if not then she 
> > > wonthttp://www.youtube.com/watch?v=aCUo6cORArA
>
> > > On Jun 29, 10:18 am, nanothermite911fbibustards
>
> > >  wrote:
> > > > YanQui  cry babies using old RACIST formula of Harassment !!!
>
> > > > To Harass Muslims :- Make a Movie of Bin Laden from a Studio in
> > > > Langley Virginia with an actor with SILICONE mask
>
> > > > and release on the internet
>
> > > > with FBI working on AUTHENTICATING it.
>
> > > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > > They cry HOARSE on Abdul Qader Khan, while its a FACT
>
> > > > that CENTRIFUGE technology was STOLEN by GERMANS from RUSSIA. It was
> > > > RUSSIA which invented the centrifuge running on a single ball. The
> > > > DUTCH and BRITISH stole it under URENCO.
>
> > > > USA stole it from LIBYA.
> > > > USA stole it from LIBYA.
> > > > USA stole it from LIBYA.
>
> > > > The concept of CENTRIFUGE as the possibility was PROLIFERATED by MAD
> > > > JEWS of New York Times, Washington POST and the NEOCONS. I learnt the
> > > > CONCEPT from the NEWSPAPERS and before that the books were LYING about
> > > > the Gas DIFFUSION PLANT or some Reactor Reprocessing Plant. The word
> > > > KRYTRON was also PROLIFERATED by MAD Neocons.
>
> > > > ==
>
> > > > Hey FBI BUSTARDS, I ask you a POINTED QUESTION in PUBLIC ?
>
> > > > If you are SO competent, tell me where is the ANTHRAX MAILER and where
> > > > are his sound and VIDEO TESTIMONIALS ?
>
> > > > Where is the trail leading from nanothermite residue collected by DR
> > > > STEVEN JONES to the actual 911 perpetrators ?
>
> > > > What about the Testimonials  of  EXPLOSIVES and EXPLOSIONS  !
>
> > > > ==
>
> > > >http://nymag.com/daily/intel/2010/06/russian_spies_seem_to_have_bee.h...
>
> > > > Russian Spies’ Dumbest Mistakes
> > > > 6/29/10 at 11:00 AM Comment 22Comment 22Comments
> > > > Anna Chapman.
> > > > Photo: Patrick McMullan
> > > > This morning, a lot of the papers said the Justice Department's
> > > > complaint about the Russian spies read like "a Cold War thriller." But
> > > > betw

Re: Why Python3

2010-06-29 Thread Martin v. Loewis
Am 29.06.2010 20:30, schrieb Paul Rubin:
> "Martin v. Loewis"  writes:
>> And indeed, that's available, by means of the key= argument to list.sort.
> 
> Unfortunately what's needed for more generality is the ability to supply
> a comparison function, which Python2 also offers, but Python3 removes.

That isn't really a problem. You can readily have one:

http://code.activestate.com/recipes/576653-convert-a-cmp-function-to-a-key-function/

> I gave an example a while back of wanting to compare two tree
> structures, and Raymond H. explained how to do it with just a key
> function, which seemed ok at the time.  But thinking about it further
> afterwards, I believe both of us missed then that the method suggested
> doesn't always work, so you really do need cmp.  I'll see if I can find
> the old post and reconstruct the problem.

If you remember, don't forget to post it to the recipe, so that you can
find it more easily the next time.

Regards,
Martin


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


Re: Crimes of YanQui Anglo Saxon ODIOUSLY CRIMINAL Bustards - BLACKWATER, CIA, FBI

2010-06-29 Thread nanothermite911fbibustards
KEY VIDEO of FBI BUSTARD ODIOUSLY CRIMINAL RACISTS

http://www.youtube.com/watch?v=LCYKZq9JLnc

KEY VIDEO of FBI BUSTARD ODIOUSLY CRIMINAL RACISTS

http://www.youtube.com/watch?v=LCYKZq9JLnc

KEY VIDEO of FBI BUSTARD ODIOUSLY CRIMINAL RACISTS

http://www.youtube.com/watch?v=LCYKZq9JLnc

KEY VIDEO of FBI BUSTARD ODIOUSLY CRIMINAL RACISTS

http://www.youtube.com/watch?v=LCYKZq9JLnc

KEY VIDEO of FBI BUSTARD ODIOUSLY CRIMINAL RACISTS

http://www.youtube.com/watch?v=LCYKZq9JLnc

KEY VIDEO of FBI BUSTARD ODIOUSLY CRIMINAL RACISTS

http://www.youtube.com/watch?v=LCYKZq9JLnc

KEY VIDEO of FBI BUSTARD ODIOUSLY CRIMINAL RACISTS

http://www.youtube.com/watch?v=LCYKZq9JLnc

KEY VIDEO of FBI BUSTARD ODIOUSLY CRIMINAL RACISTS

http://www.youtube.com/watch?v=LCYKZq9JLnc



On Jun 29, 2:23 pm, nanothermite911fbibustards
 wrote:
> Crimes of YANQUI Bustards
>
> http://www.youtube.com/watch?v=SYl6NKrmIfQ
>
> 
>
> The FAT per DIEM FBI bustards use our TAX PAYER MONEY and INCOMPETENCE
> is UNACCEPTABLE.
>
> =
>
> http://www.youtube.com/watch?v=lX18zUp6WPY
>
> http://www.youtube.com/watch?v=XQapkVCx1HI
>
> http://www.youtube.com/watch?v=tXJ-k-iOg0M
>
> Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ?
> Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did
> you release the 5 dancing Israelis compromising the whole 911
> investigation ? If the Dubai Police can catch Mossad Murderers and put
> the videos and Iranian Police can why cant you put the Pentagon
> Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and
> puting on INTERNATIONAL MEDIA a day after catching him without
> TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did
> you have to LIE about Dr Afiya Siddiqui and torture that Innocent
> little mother of 3 and smashing the skull of her one child ?
>
> http://www.youtube.com/watch?v=DhMcii8smxkhttp://www.youtube.com/watch?v=0SZ2lxDJmdg
>
> There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian
> courts.
>
> FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but
> only because he was a white. They got away with MURDER of thousands of
> Non-whites in all parts of the world.
>
> Daily 911 news :http://911blogger.com
>
> http://www.youtube.com/watch?v=tRfhUezbKLw
>
> http://www.youtube.com/watch?v=x7kGZ3XPEm4
>
> http://www.youtube.com/watch?v=lX18zUp6WPY
>
> Conclusion : FBI bustards are RACIST and INcompetent. They could
> neither catch the ANTHRAX or 911 YANK/Jew criminals nor could they
> cover them up - whichever was their actual goal or task.
>
> SLASH the SALARIES of FBI/CIA/NSA etc BUSTARDS into half all across
> tbe board, esp the whites/jew on the top.
>
> FBI Bustards failed to Catch BERNARD MADOFF even after that RACIST and
> UNPATRIOTIC Act
> FBI bustards failed to prevent ROMAN POLANSKY from absconding to
> europe and rapes.
> FBI bustards failed to prevent OKLAHOMA
>
> On Jun 29, 2:13 pm, nanothermite911fbibustards
>
>  wrote:
> > FBI Bustards - No one believes your ODIOUS LIES !!!
>
> >http://www.youtube.com/watch?v=NLo6Y0weyro
>
> > On Jun 29, 11:37 am, small Pox  wrote:
>
> > >http://www.youtube.com/watch?v=Cnz5N9OubCQ
>
> > > On Jun 29, 11:18 am, small Pox  wrote:
>
> > > >http://www.youtube.com/watch?v=oNo2kDkstBohttp://www.youtube.com/watc...
>
> > > >http://www.youtube.com/watch?v=PR6s_Ib0I-Mhttp://www.youtube.com/watc...
>
> > > >http://www.youtube.com/watch?v=ubacHhs8RUA
>
> > > >http://www.youtube.com/watch?v=C4NmwNE4qps
>
> > > > If confirmed Elena Kagan will be impartial and if not then she 
> > > > wonthttp://www.youtube.com/watch?v=aCUo6cORArA
>
> > > > On Jun 29, 10:18 am, nanothermite911fbibustards
>
> > > >  wrote:
> > > > > YanQui  cry babies using old RACIST formula of Harassment !!!
>
> > > > > To Harass Muslims :- Make a Movie of Bin Laden from a Studio in
> > > > > Langley Virginia with an actor with SILICONE mask
>
> > > > > and release on the internet
>
> > > > > with FBI working on AUTHENTICATING it.
>
> > > > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > > > Hey YANK Bustards , NO ONE trust you. You have DESTROYED your OWN
> > > > > CREDIBILITY with your own ODIOUS HANDS 
>
> > > > > They cry HOARSE on Abdul Qader Khan, while its a FACT
>
> > > > > that CENTRIFUGE technology was STOLEN by GERMANS from RUSSIA. It was
> > > > > RUSSIA which invented the centrifuge running on a single ball. The
> > > > > DUTCH and BRITISH stole it under URENCO.
>
> > > > > USA stole it from LIBYA.
> > > > > USA stole it from LIBYA.
> > > > > USA stole it from LIBYA.
>
> > > > > The concept of CENTRIFUGE as the possibility was PROLIFERATED by MAD
> > > > > JEWS of New York Times, Washington POST and the NEOCONS. I learnt the
> > > > > CONCEPT from the NEWSPAPERS and before that the books were L

Testimonial VIDEO for Honorable Prime Minister Vladimir Putin of the Russian Federation

2010-06-29 Thread nanothermite911fbibustards
Testimonial VIDEO for Honorable Prime Minister Vladimir Putin of the
Russian Federation

http://www.youtube.com/watch?v=LCYKZq9JLnc
http://www.youtube.com/watch?v=Cnz5N9OubCQ
http://www.youtube.com/watch?v=4nP8IdKP9Bc
http://www.youtube.com/watch?v=E0_zG0PEh4o
http://www.youtube.com/watch?v=JQzBeXa6Jao

A brief TIMELINE of how the MURDEROUS assault of the YANQUIS on the
whole PLANET was ARRESTED :

1) Mikhael Khodorkovsky is arrested like a RAT and put in prison - the
whole ROTHSCHILD + SOROS and British Petroleum Conspiracy to Destroy
Motherland Russia and the Fatherland is destroyed - Odious Halliburton
Cheney is found crying

2) Advanced Russian ANTI-TANK weapons INCINERATE Merkeva after Merkeva
in the Hands of the BRAVE HEZBOLLAH - Butcher Bush is found crying

3) Crushing Defeat of the attempt to Harass Russia directly is
Vigorously countered in South Ossetia, Abkhazia and Georgia's American
Lawyer president Sakashvilli faces defeat. Butcher Bush and
Halliburton Cheney are found crying.

Conclusion : The only solution to the world harmony and peace is a
uniform cosmopolitan fairness and ethic all over the world and
application of law without prejudice.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python dynamic attribute creation

2010-06-29 Thread Carl Banks
On Jun 29, 9:48 am, WANG Cong  wrote:
> On 06/27/10 12:01, Carl Banks  wrote:
>
>
>
>
>
> > On Jun 25, 8:24 pm, WANG Cong  wrote:
> >> Understand, but please consider my proposal again, if we switched to:
>
> >> setattr(foo, 'new_attr', "blah")
>
> >> by default, isn't Python still dynamic as it is? (Please teach me if I
> >> am wrong here.)
>
> >> This why I said the questionable thing is not so much related with dynamic
> >> programming or not.
>
> > Because it makes dynamicism harder to do.
>
> > Like I said, Python's goal isn't simply to make dynamicism possible,
> > it's to make it easy.
>
> > "foo.new_attr = 'blah'" is easier than using setattr.
>
> I do agree it's easier, but why do we need this to be easy? This is
> really my question.

Because the guy who wrote Python (our BDFL, Guido van Rossum) knows
and understands your objection, but disagrees with you nonetheless.
I've already told you why, and that's just going to have to be your
answer.  There's really nothing more to it than that.


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


Re: I strongly dislike Python 3

2010-06-29 Thread Steven D'Aprano
On Tue, 29 Jun 2010 18:56:37 +, Edward A. Falk wrote:

> Nice.  Once 100% of the installed base is at 2.6, I'll finally be able
> to write code that compatible with 3.0.

What's "the installed base"?

Machines you control? Then just install 2.6 on your installed base and be 
done with it. Or even 3.1 (but do yourself a favour and skip 3.0).

Client machines? I'm sorry, I simply don't believe any professional can 
allow your *potential* (your word, from a previous post) user base to 
dictate terms like that. What are you going to do, stick on 2.5 for the 
next thirty years years because *one* customer (or potential customer!) 
refuses to upgrade, even when *everyone else* is up to 3.3 or higher? 
I've got news for you: there are still machines out there running Python 
1.5. Do you write for them?



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


[ANN] git JSONRPC web service and matching pyjamas front-end

2010-06-29 Thread Luke Kenneth Casson Leighton
as more than just a proof-of-concept but to get pyjamas out of looking
like "a nice toy, doesn't do much, great demos, shame about real
life", i've created yet another git repository browser.  this one,
thanks to pyjamas, obviously runs as both a desktop application and
also as a web application - same source code.

pyjamasgitweb is actually two independent happily small projects.  the
first is simply a JSONRPC-based git web server (in python, using
python-git) and the second is a matching front-end.

the front-end is happily bare but functional.  a demo is here (please
be nice to it) where you will see immediately a total lack of colour
or even borders:
http://pyjs.org/pygit

if anyone wants the source code, or to help contribute, it's at:
   git clone [email protected]:pyjamasgitweb

to start the server, read the README, install the dependencies, then do:

$ cd jsonservice
$ python srv.py {path to top level of repository} &
$ cd ../pyjamas
$ ./build.sh # requires symlink ~/bin/pyjsbuild to sandbox
$ firefox http://127.0.0.1:8000/outputJSONRPCService.html &
$ python JSONRPCService.py # for the desktop version

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


Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Lawrence D'Oliveiro
In message , Kushal 
Kumaran wrote:

> On Tue, Jun 29, 2010 at 5:56 AM, Lawrence D'Oliveiro
>  wrote:
>
>> Why does this work, then:
>>
>> l...@theon:hack> cat test.c
>> #include 
>>
>> int main(int argc, char ** argv)
>>  {
>>char buf[512];
>>const int a = 2, b = 3;
>>snprintf(&buf, sizeof buf, "%d + %d = %d\n", a, b, a + b);
>>fprintf(stdout, buf);
>>return
>>0;
>>  } /*main*/
>> l...@theon:hack> ./test
>> 2 + 3 = 5
> 
> By accident.

I have yet to find an architecture or C compiler where it DOESN’T work.

Feel free to try and prove me wrong.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Lawrence D'Oliveiro
In message , Jorgen Grahn 
wrote:

> On Sat, 2010-06-26, Lawrence D'Oliveiro wrote:
>
>> In message , Jorgen Grahn
>> wrote:
>>
>>> I thought it was well-known that the solution is *not* to try to
>>> sanitize the input -- it's to switch to an interface which doesn't
>>> involve generating an intermediate executable.  In the Python example,
>>> that would be something like os.popen2(['zcat', '-f', '--', untrusted]).
>>
>> That’s what I mean. Why do people consider input sanitization so hard?
> 
> I'm not sure you understood me correctly, because I advocate
> *not* doing input sanitization. Hard or not -- I don't want to know,
> because I don't want to do it.

But no-one has yet managed to come up with an alternative that involves less 
work.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Why Python3

2010-06-29 Thread Dino Viehland
Terry wrote:
>  > IronPython targets Python 2.6.
> 
> They plan to release a 2.7 version sometime this year after CPython2.7
> is released. They plan to release a 3.2 version early next year, soon
> after CPython. They should be able to do that because they already have
> a 3.1 version mostly done (but will not release it as such) and 3.2 has
> no new syntax, so the 3.1 development version will easily morph into a
> 3.2 release version. I forget just where I read this, but here is a
> public article.
> http://www.itworld.com/development/104506/python-3-and-ironpython
>   Cameron Laird, Python/IronPython developer '''
> As Jimmy Schementi, a Program Manager with Microsoft, e-mailed me last
> week, "IronPython's roadmap over the next year includes compatibility
> with Python 3. Also, we're planning on a release ... before our first
> 3.2-compatible release which will target 2.7 compatibility."

Close but not 100% correct - we do plan to release 2.7 sometime this year
but 3.2 is going to be sometime next year, not early, I would guess EOY.  
I guess Jimmy misspoke a little there but the "2.7 this year 3.2 next year"
plan is what I said during my PyCon State of IronPython talk and it hasn't
changed yet.

Also we have only a few 3.x features implemented (enabled w/ a -X:Python30 
option since 2.6) instead of having a different build for 3.x.  Running 
with that option isn't likely to run any real 3.x code though but it gives
people a chance to test out a few new features.  Of course implementing 2.7
also gets us much closer to 3.x then we are today w/ all its backports so 
we are certainly making progress.

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


Re: Find slope of function given empirical data.

2010-06-29 Thread duncan smith

Thomas wrote:

Hello all.

Trying to find slope of function using numpy.
Getting close, but results are a bit off. Hope someone out here can
help.



[snip]

Why are you generating y-coordinates from the x-coordinates [-6, -5, -4, 
-3, -2, -1, 0, 1, 2, 3, 4]?  If you're going to use the x-coordinates 
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] in your function, then use the same 
to generate the y-coordinates.  Surely, if you have empirical data 
(which, for some reason, you know are well fitted by a quadratic 
function?) you'd pass both the x and y coordinates to the function? 
Maybe (untested),


def deriv(x, y):
z = np.polyfit(x, y, 2)
p = np.poly1d(z)
return p.deriv()

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


Re: git JSONRPC web service and matching pyjamas front-end

2010-06-29 Thread CM
On Jun 29, 6:54 pm, Luke Kenneth Casson Leighton 
wrote:
> as more than just a proof-of-concept but to get pyjamas out of looking
> like "a nice toy, doesn't do much, great demos, shame about real
> life", i've created yet another git repository browser.  this one,
> thanks to pyjamas, obviously runs as both a desktop application and
> also as a web application - same source code.
>
> pyjamasgitweb is actually two independent happily small projects.  the
> first is simply a JSONRPC-based git web server (in python, using
> python-git) and the second is a matching front-end.
>
> the front-end is happily bare but functional.  a demo is here (please
> be nice to it) where you will see immediately a total lack of colour
> or even borders:http://pyjs.org/pygit

When I load that page all I see is what appears to be the barest of a
web page with some text and links, but no widgets.  If may be
generated with pyjamas but I'm not sure how this fulfills your wish to
do something that does more than "doesn't do much".  I would expect a
demo to at least have some typical GUI features on it--or am I
completely missing the point of what you're doing?

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


Re: Why are String Formatted Queries Considered So Magical?

2010-06-29 Thread Carl Banks
On Jun 28, 3:07 am, Dennis Lee Bieber  wrote:
> On Sun, 27 Jun 2010 21:02:57 -0700, Stephen Hansen
>  declaimed the following in
> gmane.comp.python.general:
>
> > (This is an area where parametrized queries is even more important: but
> > I'm not sure if MySQL does proper prepared queries and caching of
> > execution plans).
>
>         MySQL version 5 finally added prepared statements and a discrete
> parameter passing mechanism...
>
>         However, since there likely are many MySQL v4.x installations out
> there, which only work with complete string SQL, MySQLdb still formats
> full SQL statements (and it uses the Python % string interpolation to do
> that, after converting/escaping parameters -- which is why %s is the
> only allowed placeholder; even a numeric parameter has been converted to
> a quoted string before being inserted in the SQL).
>
>         It would be nice if MySQLdb could become version aware in a future
> release, and use prepared statements on v5 engines... I doubt it can
> drop the existing string based queries any time soon... Consider the
> arguments about how long Python 2.x will be in use (I'm still on 2.5)...
> Imagine the sluggishness in having database engines converted
> (especially in a shared provider environment, where the language
> specific adapters also need updating -- ODBC drivers, etc.)

Thanks, your replies to this subthread have been most enlightening.

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


The Icelandic Sheepdog,

2010-06-29 Thread Camelot Entertainment
The Icelandic Sheepdog,

http://noizeystatic.blogspot.com/2070/06/icelandic-sheepdog-noizey-static-free.html
inherently comes from the spitz type, the dogs that landed on iceland
by the Vikings.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Michael Torrie
On 06/29/2010 06:25 PM, Lawrence D'Oliveiro wrote:
> I have yet to find an architecture or C compiler where it DOESN’T work.
> 
> Feel free to try and prove me wrong.

Okay, I will. Your code passes a char** when a char* is expected.  Every
compiler I know of will give you a *warning*.  Mistaking char*, char**,
and char[] is a common mistake that almost every C program makes in the
beginning.  Now for the proof:

Consider this variation where I use a dynamically allocated buffer
instead of static:

#include 

int main(int argc, char ** argv)
{
char *buf = malloc(512 * sizeof(char));
const int a = 2, b = 3;
snprintf(&buf, sizeof buf, "%d + %d = %d\n", a, b, a + b);
fprintf(stdout, buf);
free(buf);
return 0;
} /*main*/

On my machine, an immediate segfault (stack overrun).  Your code only
works because your buf is statically allocated, which means &buf==buf.
But this equivalance does not hold for any other situation.  If your
buffer was dynamically allocated on the heap, instead of passing a
pointer to the buffer (which *is* what buf itself is), you are passing a
pointer to the pointer, which is where buf is stored on the stack, but
not the buffer itself.  Instant stack corruption.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Michael Torrie
On 06/29/2010 06:26 PM, Lawrence D'Oliveiro wrote:
>> I'm not sure you understood me correctly, because I advocate
>> *not* doing input sanitization. Hard or not -- I don't want to know,
>> because I don't want to do it.
> 
> But no-one has yet managed to come up with an alternative that involves less 
> work.

Your case is still not persuasive.

How is using the DB API's placeholders and parameterization more work?
It's the same amount of keystrokes, perhaps even less.  You would just
be substituting the API's parameter placeholders for Python's.  In fact
with Psycopg2 and the mysql python db apis, it's almost a matter of
simply removing the "%" and putting in a comma, turning python's string
substitution into a method call.  And you can leave out the quotes
around where the variables go.  If I have to sanitize every input, I
have to do it on each and every field on each and every form action.
With the DB API doing the work I just do it once, in one place.  Is this
not easier that manually escaping everything and then embedding it in
the query string?

I've not used sqlalchemy, but it looks similarly easy.

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


Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Michael Torrie
On 06/29/2010 10:05 PM, Michael Torrie wrote:
> #include 
> 
> int main(int argc, char ** argv)
> {
>   char *buf = malloc(512 * sizeof(char));
>   const int a = 2, b = 3;
>   snprintf(&buf, sizeof buf, "%d + %d = %d\n", a, b, a + b);
   ^^
Make that 512*sizeof(buf)

Still segfaults though.

>   fprintf(stdout, buf);
>   free(buf);
>   return 0;
> } /*main*/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Michael Torrie
On 06/29/2010 10:17 PM, Michael Torrie wrote:
> On 06/29/2010 10:05 PM, Michael Torrie wrote:
>> #include 
>>
>> int main(int argc, char ** argv)
>> {
>>  char *buf = malloc(512 * sizeof(char));
>>  const int a = 2, b = 3;
>>  snprintf(&buf, sizeof buf, "%d + %d = %d\n", a, b, a + b);
>^^
> Make that 512*sizeof(buf)

Sigh.  Try again.  How about "512 * sizeof(char)" ?  Still doesn't make
a different.  The code still crashes because the &buf is incorrect.

Another reason python programming is just so much funner and easier!

This little diversion is fun though.  C is pretty powerful and I enjoy
it, but it sure keeps one on one's toes.  I made a similar mistake to
the &buf thing years ago when I thought I could return strings (char *)
from functions on the stack the way Pascal and BASIC could.  It was only
by pure luck that my code worked as the part of the stack being accessed
was invalid and could have been overwritten.

>>  fprintf(stdout, buf);
>>  free(buf);
>>  return 0;
>> } /*main*/

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


Re: Why Python3

2010-06-29 Thread John Yeung
On Jun 28, 1:58 pm, "OKB (not okblacke)"
 wrote:
> Steven D'Aprano wrote:
> > For the rest of us, you can do a lot with just Python 3.1,
> > with or without C modules. Whether it does *enough* to be
> > considered for deployment depends on what you're deploying
> > it to do. I for one would not hesitate to use Python 3.1
> > as a scripting language, or for any application where the
> > standard library is all you need. You can do a lot with
> > just the standard library.
>
>         The thing is that, for me at least, this isn't
> sufficient, because I often don't know what all I'm going
> to need when I start off.  I may decide to add some new
> feature that requires an extra library, and only then find
> out that I can't, because that library doesn't exist for
> Python 3.  Some things are part of the standard lib, some
> aren't.  I want to be able to start a project and be able
> to find what I need, whether that's part of the standard
> lib or not.

Ah, but what version of Python has a package for everything that you
will need, including the things you haven't thought of?  What happens
when you want to provide a feature that requires a library that
doesn't exist for 2.6?  (Or 2.5 or whatever it is that you feel has
the most complete coverage.)

My point is simply that you have not said anything that goes against
any of Steven's points.

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


Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Carl Banks
On Jun 28, 2:44 am, Gregory Ewing  wrote:
> Carl Banks wrote:
> > Indeed, strncpy does not copy that final NUL if it's at or beyond the
> > nth element.  Probably the most mind-bogglingly stupid thing about the
> > standard C library, which has lots of mind-boggling stupidity.
>
> I don't think it was as stupid as that back when C was
> designed. Every byte of memory was precious in those days,
> and if you had, say, 10 bytes allocated for a string, you
> wanted to be able to use all 10 of them for useful data.
>
> So the convention was that a NUL byte was used to mark
> the end of the string *if it didn't fill all the available
> space*.

I can't think of any function in the standard library that observes
that convention, which inclines me to disbelieve this convention ever
really existed.  If it did, there would be functions to support it.

For that matter, I'm not really inclined to believe bytes were *that*
precious in those days.

> Functions such as strncpy and snprintf are designed
> for use with strings that follow this convention. Proper
> usage requires being cognizant of the maximum length and
> using appropriate length-limited functions for all operations
> on such strings.

Well, no.  Being cognizant of the string's maximum length doesn't make
you able to pass it to printf, or system, or any other C function.

The obvious rationale behind strncpy's stupid behavior is that it's
not a string function at all, but a memory block function, that stops
at a NUL in case you don't care what's after the NUL in a block.  But
it leads you to believe it's a string function by it's name.


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


Re: Python profiler usage with objects

2010-06-29 Thread rik
harit  gmail.com> writes:

> 
> Hi,
> 
> I have a specific question regarding the usage of profiler. I am new
> to python programming I am trying to profile a function which I want
> to invoke as a class method, something like this
> 
> import profile
> 
> class Class:
> 
> def doSomething():
> 
> do here ..
> 
> def callMethod():
> 
> **self.doSomething()**
> instead of this I want to use
> 
> **profile.run(self.doSomething())**
> but the profile.run expects the string inside it and I get error
> 
> TypeError: exec: arg 1 must be a string, file, or code object
> 
> Can somebody please help?
> 
> Thank you
> 


Harit,

i am OLD to python, and have used its profiler in the past.
but i'm getting your same error:

> TypeError: exec: arg 1 must be a string, file, or code object

on both Ubuntu with Python 2.6 and OSX with 2.4.  with both
cProfile and profile?!  whether or not i specify a file for
profile output!?!

anybody else having trouble profiling?

 - rik


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


RE: Python profiler usage with objects

2010-06-29 Thread Ben Kaplan


> -Original Message-
> From: [email protected] [mailto:python-list-
> [email protected]] On Behalf Of rik
> Sent: Tuesday, June 29, 2010 10:52 PM
> To: [email protected]
> Subject: Re: Python profiler usage with objects
> 
> harit  gmail.com> writes:
> 
> >
> > Hi,
> >
> > I have a specific question regarding the usage of profiler. I am new
> > to python programming I am trying to profile a function which I want
> > to invoke as a class method, something like this
> >
> > import profile
> >
> > class Class:
> >
> > def doSomething():
> >
> > do here ..
> >
> > def callMethod():
> >
> > **self.doSomething()**
> > instead of this I want to use
> >
> > **profile.run(self.doSomething())**
> > but the profile.run expects the string inside it and I get error
> >
> > TypeError: exec: arg 1 must be a string, file, or code object
> >
> > Can somebody please help?
> >
> > Thank you
> >
> 
> 
> Harit,
> 
> i am OLD to python, and have used its profiler in the past.
> but i'm getting your same error:
> 
> > TypeError: exec: arg 1 must be a string, file, or code object
> 
> on both Ubuntu with Python 2.6 and OSX with 2.4.  with both cProfile and
> profile?!  whether or not i specify a file for profile output!?!
> 
> anybody else having trouble profiling?
> 
>  - rik
> 

Let's take this code as an example:

def foo() :
return None

import profile
profile.run(foo())

What does the profile.run call do?

First thin it does is evaluate foo(), which returns None. So you're calling
profile.run(None)

There's  nothing special about profile.run- you have to hand it something to
execute, not something already executed. Try calling
Profile.run(doSomething) # no parenthesis for doSomething.
> 
> --
> http://mail.python.org/mailman/listinfo/python-list

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


Re: Python profiler usage with objects

2010-06-29 Thread rik
Ben Kaplan  case.edu> writes:
 
> 
> Let's take this code as an example:
> 
> def foo() :
> return None
> 
> import profile
> profile.run(foo())
> 
> What does the profile.run call do?
> 
> First thin it does is evaluate foo(), which returns None. So you're calling
> profile.run(None)
> 
> There's  nothing special about profile.run- you have to hand it something to
> execute, not something already executed. Try calling
> Profile.run(doSomething) # no parenthesis for doSomething.
> > 
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> 
> 

hi Ben,  right: i have a top-level function main() that runs just
fine.  but i give it as an argument to cProfile.run() or profile.run(),
it executes as expected, but then:

>   File "/var/folders/lu/luGJNSGwE0mO84R+YbcKpU+++TI/-Tmp-/python-439Ffi.py",
line 544, in ?
> profile.run(main(seedFile),'/Data/tmp/fetchProfile_100629.profile')
>   File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/profile.py",
line 72, in run
> prof = prof.run(statement)
>   File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/profile.py",
line 448, in run
> return self.runctx(cmd, dict, dict)
>   File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/profile.py",
line 454, in runctx
> exec cmd in globals, locals
> TypeError: exec: arg 1 must be a string, file, or code object

this example is from python2.4 on OSX, but the same code generates
the same error on python2.6 on Ubuntu?!  





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