Friday, November 20, 2009

comp.lang.python - 26 new messages in 12 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Python/HTML integration: phileas v0.3 released - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/2967d0cb7b4e697d?hl=en
* Is there something similar to list comprehension in dict? - 12 messages, 11
authors
http://groups.google.com/group/comp.lang.python/t/7aa443ac48f58851?hl=en
* non-copy slices - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/170cb57996d6ce57?hl=en
* BB論壇 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/cb5785b88471f809?hl=en
* Book: Programming Python 3 (Second Edition) now available - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/bb1a9bb3d35f36c8?hl=en
* Does turtle graphics have the wrong associations? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/d55388b0fdd9ed2f?hl=en
* Announcement: depikt - the minimalistic python gate to gtk - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/59d823e03b45a2cc?hl=en
* www.voguecatch.com sell cheap nike shoe,handbag,shox shoe,sunglass,t-shirt,
ed hardy ca from there - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/46f8396ead0ff493?hl=en
* Nike dunk high shoes wholesale\retail - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/cf7ec383ddaa2c55?hl=en
* python simply not scaleable enough for google? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/ceef2ae6b4472b61?hl=en
* checking 'type' programmatically - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/192a634c2070056f?hl=en
* Is an interactive command a block? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/3f0d7607ed5a4a78?hl=en

==============================================================================
TOPIC: Python/HTML integration: phileas v0.3 released
http://groups.google.com/group/comp.lang.python/t/2967d0cb7b4e697d?hl=en
==============================================================================

== 1 of 4 ==
Date: Fri, Nov 20 2009 12:02 am
From: Stefan Behnel


papa hippo, 19.11.2009 19:53:
> The prime goal of 'phileas' is to enable html code to be seamlessly
> included in python code in a natural looking syntax, without resorting
> to templatng language.

I assume you know XIST, ElementTree's ElementMaker, and all those other
ways of generating XML/HTML from Python code in a natural looking way?

Stefan


== 2 of 4 ==
Date: Fri, Nov 20 2009 4:31 am
From: papa hippo


On 19 nov, 20:18, Steve Howell <showel...@yahoo.com> wrote:
> On Nov 19, 10:53 am, papa hippo <hippost...@gmail.com> wrote:
>
> > The prime goal of 'phileas' is to enable html code to be seamlessly
> > included in python code in a natural looking syntax, without resorting
> > to templatng language.
>
> > see:
>
> >http://larry.myerscough.nl/phileas_project/
>
> > I intend to submit phileas to the python.announce  forum within the
> > next few days. Any feedback received now will be gratefully received
> > and may lead to improved quality of that submission.
>
> Hi Larry, looks like interesting stuff!
>
> There appears to be a problem with this page:
>
> http://larry.myerscough.nl/show_python_source.py?script_filename=./My...
>
> IOError: [Errno 2] No such file or directory: './MyPage.py'
>
Oh dear! my blunder; While syncing (with meld) from my test
environment to the live environment, I missed a file. It seems to be
fixed now.

> I do like the idea of having a more Python-oriented way to generate
> HTML.

That's good to hear.


Larry


== 3 of 4 ==
Date: Fri, Nov 20 2009 5:18 am
From: papa hippo


On 20 nov, 09:02, Stefan Behnel <stefan...@behnel.de> wrote:
> papa hippo, 19.11.2009 19:53:
>
> > The prime goal of 'phileas' is to enable html code to be seamlessly
> > included in python code in a natural looking syntax, without resorting
> > to templatng language.
>
> I assume you know XIST, ElementTree's ElementMaker, and all those other
> ways of generating XML/HTML from Python code in a natural looking way?
>
> Stefan

Hi Stefan,

Thanks for your feedback.

Yes, I am aware that phileas might - on the basis of the short
description on this post - come across like a 're-invented wheel'.
There is, however, one big difference between phileas and all other
other similar packages (XIST, ELementTree, HTMLgen, HyperText,
pyhtmloo etc.) that I inspected:

Phileas uses distinct objects to generate each start and end tag,
whereas all the others use a single function call (in some cases
itself generated by a function call) to generate a complete well-
formed element including start-tag and (where required) end-tag. In
theory this is less neat and indeed it means one can write 'bad' HTML
(e.g. missing end of paragraphs) with phileas just as easily as when
writing pure html. In practice, however, I find it at a lot easier to
use.

While using pyhtmloo (my previous favourite HTML generator), I had
found myself using awkward complicated artificial constructions in
order to generate all but the simplest HTML - and spent much time
playing 'hunt the missing bracket'. With phileas, these complexities
seem to just fall away.

Put another way, Phileas generates HTML4.0 - warts and all; it is not
a parser or generator of XML.

I'm considering building in checks/warnings for unclosed elements
etc., probably in the next-but-one pre-release.

Larry


== 4 of 4 ==
Date: Fri, Nov 20 2009 2:52 am
From: Daniel Fetchinson


>> The prime goal of 'phileas' is to enable html code to be seamlessly
>> included in python code in a natural looking syntax, without resorting
>> to templatng language.
>>
>> see:
>>
>> http://larry.myerscough.nl/phileas_project/
>>
>> I intend to submit phileas to the python.announce forum within the
>> next few days. Any feedback received now will be gratefully received
>> and may lead to improved quality of that submission.
>>
>
> Hi Larry, looks like interesting stuff!
>
> There appears to be a problem with this page:
>
> http://larry.myerscough.nl/show_python_source.py?script_filename=./MyPage.py
>
> IOError: [Errno 2] No such file or directory: './MyPage.py'
>
> I do like the idea of having a more Python-oriented way to generate
> HTML.

Have you guys considered markup.py from http://markup.sourceforge.net/
? It's comparable to your project as far as I can see, a more detailed
comparison would probably be useful.

Cheers,
Daniel


--
Psss, psss, put it down! - http://www.cafepress.com/putitdown

==============================================================================
TOPIC: Is there something similar to list comprehension in dict?
http://groups.google.com/group/comp.lang.python/t/7aa443ac48f58851?hl=en
==============================================================================

== 1 of 12 ==
Date: Fri, Nov 20 2009 12:19 am
From: Michele Simionato


On Nov 20, 4:18 am, Peng Yu <pengyu...@gmail.com> wrote:
> I'm wondering if there is something similar to list comprehension for
> dict

Yes, but only in Python 3:

>>> {(i, x) for i, x in enumerate('abc')}
{(0, 'a'), (1, 'b'), (2, 'c')}


== 2 of 12 ==
Date: Fri, Nov 20 2009 12:24 am
From: Stefan Behnel


Peng Yu, 20.11.2009 04:18:
> I'm wondering if there is something similar to list comprehension for
> dict (please see the example code below).

A list comprehension is an expression that produces a list, e.g.

[ i**2 for i in range(10) ]

Your example below uses a slice assignment.


> def fun(d):#Is there a way similar to list comprehension to change the
> argument d so that d is changed?
> d=dict(three=3)
> [...]
> def fun3(L):# argument L is changed
> L[:]=[1, 2, 3]

You can use d.update(...)

It accepts both another dict as well as a generator expression that
produces item tuples, e.g.

d.update( (i, i**2) for i in range(10) )

Does that help?

Stefan


== 3 of 12 ==
Date: Fri, Nov 20 2009 12:26 am
From: Stefan Behnel


Stefan Behnel, 20.11.2009 09:24:
> You can use d.update(...)
>
> It accepts both another dict as well as a generator expression that
> produces item tuples, e.g.
>
> d.update( (i, i**2) for i in range(10) )

This also works, BTW:

>>> d = {}
>>> d.update(value=5)
>>> d
{'value': 5}

Stefan


== 4 of 12 ==
Date: Fri, Nov 20 2009 1:21 am
From: Patrick Sabin


Peng Yu wrote:
> I'm wondering if there is something similar to list comprehension for
> dict (please see the example code below).

Do you mean something like this:

>>> {i:i+1 for i in [1,2,3,4]}
{1: 2, 2: 3, 3: 4, 4: 5}

This works in python3, but not in python2

- Patrick


== 5 of 12 ==
Date: Fri, Nov 20 2009 1:29 am
From: Paul Rudin


Patrick Sabin <patrick.just4fun@gmail.com> writes:

> Peng Yu wrote:
>> I'm wondering if there is something similar to list comprehension for
>> dict (please see the example code below).
>
> Do you mean something like this:
>
>>>> {i:i+1 for i in [1,2,3,4]}
> {1: 2, 2: 3, 3: 4, 4: 5}
>
> This works in python3, but not in python2

Of course in python 2 you can do:

>>> dict((i, i+1) for i in [1,2,3,4])
{1: 2, 2: 3, 3: 4, 4: 5}


== 6 of 12 ==
Date: Fri, Nov 20 2009 1:32 am
From: Terry Reedy


Peng Yu wrote:
> I'm wondering if there is something similar to list comprehension for
> dict (please see the example code below).

Python 3 has list, set, and dict comprehensions.
Don't know about 2.6/7

== 7 of 12 ==
Date: Fri, Nov 20 2009 3:08 am
From: DreiJane


NB: I wondered about about dict(one=1, two=2) - why not d = {one:1,
two:2} ? Since you do not write L=list((1, 2)) either. These composed
objects as basic building blocks make Python code so dense and
beautiful, thus using "{}" means embracing the language's concept.


== 8 of 12 ==
Date: Fri, Nov 20 2009 6:03 am
From: "Diez B. Roggisch"


DreiJane schrieb:
> NB: I wondered about about dict(one=1, two=2) - why not d = {one:1,
> two:2} ? Since you do not write L=list((1, 2)) either. These composed

because it's not working.

>>> {one : 1}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'one' is not defined


Yes, that looks nitpicky, but that is exactly the reason one often
prefers the dict(...)-variant. Because it uses python keywords, it
spares you to type quotes around all the keys. Which IMHO is more aesthetic.


> objects as basic building blocks make Python code so dense and
> beautiful, thus using "{}" means embracing the language's concept.

The collection-literals are a great thing, no doubt. But these
alternatives are not against any concept.

Diez


== 9 of 12 ==
Date: Fri, Nov 20 2009 3:41 am
From: Andre Engels


On Fri, Nov 20, 2009 at 4:18 AM, Peng Yu <pengyu.ut@gmail.com> wrote:
> I'm wondering if there is something similar to list comprehension for
> dict (please see the example code below).
>
>
> d = dict(one=1, two=2)
> print d
>
> def fun(d):#Is there a way similar to list comprehension to change the
> argument d so that d is changed?
>  d=dict(three=3)
>
> fun(d)
> print d
>
> def fun1(d):
>  d['one']=-1
>
> fun1(d)
> print d
>
>
> L = [1, 2]
> print L
>
> def fun2(L):#this doesn't have any effect on the argument L
>  L=[]
>
> fun2(L)
> print L#[1, 2]
>
> def fun3(L):# argument L is changed
>  L[:]=[1, 2, 3]
>
> fun3(L)
> print L#[1, 2, 3]
> --
> http://mail.python.org/mailman/listinfo/python-list
>

def fun(d):
d.clear()
d[three] = 3


--
André Engels, andreengels@gmail.com


== 10 of 12 ==
Date: Fri, Nov 20 2009 3:47 am
From: Tim Golden


Michele Simionato wrote:
> On Nov 20, 4:18 am, Peng Yu <pengyu...@gmail.com> wrote:
>> I'm wondering if there is something similar to list comprehension for
>> dict
>
> Yes, but only in Python 3:
>
>>>> {(i, x) for i, x in enumerate('abc')}
> {(0, 'a'), (1, 'b'), (2, 'c')}

Although the 2.x syntax is hardly onerous:

dict ((i+5, x) for i, x in enumerate ('abc'))


-- obviously without something like the i+5, the example
equates to dict (enumerate ('abc'))

:)

TJG


== 11 of 12 ==
Date: Fri, Nov 20 2009 3:45 am
From: Dave Angel


Peng Yu wrote:
> I'm wondering if there is something similar to list comprehension for
> dict (please see the example code below).
>
>
> d = dict(one=1, two=2)
> print d
>
> def fun(d):#Is there a way similar to list comprehension to change the
> argument d so that d is changed?
> d=dict(three=3)
>
> fun(d)
> print d
>
> def fun1(d):
> d['one']=-1
>
> fun1(d)
> print d
>
>
> L = [1, 2]
> print L
>
> def fun2(L):#this doesn't have any effect on the argument L
> L=[]
>
> fun2(L)
> print L#[1, 2]
>
> def fun3(L):# argument L is changed
> L[:]=[1, 2, 3]
>
> fun3(L)
> print L#[1, 2, 3]
>
>
You confused me by calling it a list comprehension. All you're using in
fun3() is a slice. Using a slice, you can give a new set of values to
an existing list.

For a dictionary, it's just a bit trickier. You need two steps in the
most general case.

def fun4(d):
d.clear() #clear out existing entries
d.update(new_dict) #copy in new key:val pairs from a
different dictionary

This function will modify the caller's dictionary, completely replacing
the contents.

DaveA


== 12 of 12 ==
Date: Fri, Nov 20 2009 4:00 am
From: Simon Brunning


2009/11/20 Michele Simionato <michele.simionato@gmail.com>:
> Yes, but only in Python 3:
>
>>>> {(i, x) for i, x in enumerate('abc')}
> {(0, 'a'), (1, 'b'), (2, 'c')}

In Python 2.x, you can do:

>>> dict((i, x) for i, x in enumerate('abc'))
{0: 'a', 1: 'b', 2: 'c'}

(Works in 2.5 - I can't remember when generator expressions were introduced.)

--
Cheers,
Simon B.

==============================================================================
TOPIC: non-copy slices
http://groups.google.com/group/comp.lang.python/t/170cb57996d6ce57?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 1:17 am
From: Ajit Kumar


On Thu, Nov 19, 2009 at 8:14 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
>> No I'm well aware that there is no deep copy of the objects and the lists
>> only keep references to the objects and in essence they have the same
>> objects in there. But this doesn't mean they are the same list.
>> Modifications to slices are not written back to the original list.
>>
>> x = range(5)
>> y = x[1:3]
>> y[0] = 13
>> x[1] == y[0]  --> False
>>
>> Of course if I modify the object in the slice then the original list will
>> see the change, but this is not what I was saying. Second and more
>> importantly it's the performance penalty from allocating a large number of
>> lists produced from the slices and the copy of the references. islice does
>> not have this penalty, it should only instantiate a small object that
>> iterates on the original list.
>>
>> Themis
>
> So "shallow copy" == "new label created for existing object".
>
> So is your desired behavior to write back to the original list if your
> sub-list is modified?  In other words, you are creating a window onto an
> existing list?  If not, what would happen when a sublist element was
> modified (or deleted, or appended, or ...)?

On a related note, GO encourages use of slices.

http://golang.org/doc/effective_go.html#slices

==============================================================================
TOPIC: BB論壇
http://groups.google.com/group/comp.lang.python/t/cb5785b88471f809?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 1:56 am
From: "texaomruzj@hotmail.com"


<a href=http://a5.0401.com.tw/ target="_blank">0401線上遊戲</a> -<font
color=red size=3>←點我進入~^^</font><BR>

<a href=http://12.5544986.com/ target="_blank">免費交友隨身碼</a> -<font
color=red size=3>←點我進入~^^</font><BR>

<a href=http://0405.a0932.com/ target="_blank">遊戲線上時空英雄</a> -<font
color=red size=3>←點我進入~^^</font><BR>

<BR>好消息!好消息!有新論壇問世了!裡頭有發表雅俗共賞的文章!有精彩寫真貼圖.電影長短片分
享與下載!大家快來搶頭香!請大家告訴大家!

共襄盛舉!<BR><a href=http://www.004q.info/ target="_blank">BB論壇</a> -<font
color=red size=3>←點我進入~^^</font><BR>


==============================================================================
TOPIC: Book: Programming Python 3 (Second Edition) now available
http://groups.google.com/group/comp.lang.python/t/bb1a9bb3d35f36c8?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 2:20 am
From: Mark Summerfield


Hi,

I'm delighted to announce that a new edition of my Python 3 book is
now available in the U.S.

"Programming in Python 3 (Second Edition):
A Complete Introduction to the Python Language"
ISBN 0321680561
http://www.qtrac.eu/py3book.html

The book has been fully revised and updated and now covers both Python
3.0
and 3.1, and with the language moratorium (PEP 3003), this second
edition
should be useful for many years to come. And in addition to the
thorough
updating, the book has been extended with new chapters on debugging,
testing, and profiling, and on parsing (including coverage of the
PyParsing and
PLY modules), as well as a new section on coroutines in the advanced
chapter.

The book is aimed at a wide audience, but assumes some programming
experience (not necessarily Python, not necessarily object-oriented).
It teaches solid procedural style programming, then builds on that to
teach solid object-oriented programming, and then goes on to more
advanced
topics (e.g., including a nice way to create validated attributes by
combining class decorators with descriptors). But even newcomers to
Python 3 should be able to write useful (although small and basic)
programs after reading chapter 1, and then go on to create larger and
more sophisticated programs as they work through the chapters.

All the examples are available for download from the book's web site.

==============================================================================
TOPIC: Does turtle graphics have the wrong associations?
http://groups.google.com/group/comp.lang.python/t/d55388b0fdd9ed2f?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 2:35 am
From: seeWebInstead@rem.intarweb.org (Robert Maas, http://tinyurl.com/uh3t)


> > My proposed no-syntax
> > IDE *also* gets rid of the need to bother with any programming-language
> > syntax. I've been proposing it for years, but nobody has shown any
> > interest
> From: Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au>
> I'm interested. No-syntax IDE? How is this even possible?

I guess you missed what I previously posted. The basic idea is that
you start with test data, and you use menus to select appropriate
data-processing actions to perform on that data. For example, you
manually key in a file name containing test data, or copy and paste
that same file name. Then you select "open file by that name" or
"load all lines from file by that name" etc. from a menu. If you
just opened the file, you now have a stream of input, and you can
select to read one line or one s-expression or one character etc.
from that file. After loading the whole file or one unit of data,
you now have some *real* data to work from. For example, with a
line of input, you might break it into words.

Caveat: When I said "no syntax", I mean no programming syntax, no
syntax to indicate function calls or variable assignment etc. You
still must deal with visual representation of strings and integers
and other essential data objects, which in a way may be considered
to be syntax. But if you want, you can avoid *all* syntax, even for
data, by drawing a *picture* of the individual bits. For some
low-level machine-language training, or boolean algebra lessons,
this might actually be preferable to Arabic numerals and English
letters to represent data values. Seeing a *picture* of something
that looks like a paper tape seems more binary-friendly than seeing
arabic digits "0" and "1" in rows across a page, when studying
operations upon boolean values or bitmasks.

Now if you don't like the burden of navigating the multi-level
menus, a search engine can be available, whereby you key in
keywords for the name of some data-processing operation you either
saw before or a name you can construct in your mind based on naming
conventions.

The extreme case of search engine would be if English-language
pseudo-code can be automatically converted into a very short menu
of most likely data-processing operations. I actually am seriously
considering doing NewEco software development by this means.
Basically I contract people to brainstorm with me in a Delphi
fashion to create the toplevel design of a new computer algorithm,
then we do top-down break into pieces, and continue top-down
break-down as far as it takes until the search engine recognizes
some step as something it already knows how to do.

> The only way I can think of is some sort of wizard interface.
> E.g. instead of having to remember the syntax for a slice, you
> click the "Slice" button and the computer prompts you to enter
> some combination of start, end, step, then generates the syntax
> [a:b:c] for you.

Yeah, it'll be vaguely like that in some ways. For major data,
we'll have the data first, all parameters to the next function to
apply, and *then* we select what function to call on those
parameters. But for minor parameters, we might allow you to choose
the function before filling in the minor-parameter slots. For
example, to select the nth character of string, we might have both
the string and the integer N before we select the NTH function, but
if N is a constant we might instead have just the string and select
the NTH function and fill in the constant N. With the pseudo-code
translation, some of the constant parameters might be apparent in
the English. For example, we have a string, and we say "select the
second word" (actually that's almost HyperTalk, the scripting
language of HyperCard on Macintosh computers), at which point the
constant parameter 2 would be supplied from the word "second" in
the English.

==============================================================================
TOPIC: Announcement: depikt - the minimalistic python gate to gtk
http://groups.google.com/group/comp.lang.python/t/59d823e03b45a2cc?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 2:51 am
From: DreiJane


Hi all,

these days i make depikt, a python C-extension for building apps with
gtk. It was a challenge for me and big fun. From its short description
on sourceforge.net:

"Python-3 wrappers for GTK. A minimalistic approach - just suited for
GUI-building of apps, in no way for widget-building. Currently 1250
lines for 15 widgets with about 100 methods ... "

depikt is advanced enough now to begin the transition of an 8MB python
app of me to it - simultaneously with the transition to Python-3 and
English. During this process depikt will grow to support for perhaps
25 widgets and 200 methods. From gobject it has connect(),
connect_after(), handler_block(), handler_unblock() and
handler_is_connected(). Still its status is marked as PreAlpha and
depikt not entered to the Python wiki, because
gtk_container_set_focus_chain() is defunct now - a vital method for
fine usable applications. It's difficult to find out why - as it is
the code was working for some time. depikt is very minimalistic:

No python attributes of its classes, let alone properties

No __repr__, no standard __init__

No support for set_property, get_property

No real class hierarchy, there is one abstract base class Pikt, from
which all concrete widgets are inheriting directly

No exposing of Glib to python (but all i need from pango, cairo and
gdk)

Thus the code is very petty, well understandable and easy to extend to
support for other widgets. That was the primary design goal, together
with exact control of encoding issues, support for Python-3 and
registry- and autoconf-free installation. Exception handling is about
average now - there no mimimalism is intended, quite the contrary (for
the long run). depikt will get to some mature state in 2010 - with
perhaps about 3.000 lines then. One C-file will always be sufficient.
atk might be added by means of a second file, also support for
gtk.TreeView might get an own file - but both directly inserted by
#include (no .h planned).

Enjoy, Joost

==============================================================================
TOPIC: www.voguecatch.com sell cheap nike shoe,handbag,shox shoe,sunglass,t-
shirt,ed hardy ca from there
http://groups.google.com/group/comp.lang.python/t/46f8396ead0ff493?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 5:37 am
From: reytfghfd hgfdhf


Our main products list is as below:
1) sports shoes: air jordan, jordan 23, af1, Jordan fussion, air max,
Dunks, Puma, Bape, GUCCI, Prada, UGG, Timberland boots, ect.
2) handbags: Chanel, Chloe, Coach, D&G, LV, Fendi, Gucci, Hermes,
Prada, UGG, ect.
3) T-shirts: Affliction, BBC, POLO, Lacoste, ED-Hardy, EVS, GGG, A&F,
Christan Audigier, Coogi, G-Star ect.
4) Jeans: Red Monkey, True Religion, BBC, Christan Audigier, Artful
Doger, bape, EVS ect.
5) Jerseys: NFL, MLB, NBA, NHL
6) Hoodies: Bape, BBC, LRG, CLH, ED hardy, Evisu, Gino Green Global,
Deep ect
7) watch, sunglasses, belt, hats/caps, underwear, socks, accessories.
http://www.voguecatch.com

==============================================================================
TOPIC: Nike dunk high shoes wholesale\retail
http://groups.google.com/group/comp.lang.python/t/cf7ec383ddaa2c55?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 6:25 am
From: xiao wang


Nike dunk high shoes wholesale\retail

Our company mainly deal with the import and export of the brand sports
shoes, clothes, jewelry, bags , glasses, etc . Products such as Nike
Jordan sell well in America , Canada , as well as Europe and other
countries. Our objective is to supply products of first-class quality
and advanced technology. Customers satisfaction is our greatest
pursuit. We thank you for your attention and wish having a long time
business relationship with all buyers from all over the world.

we take PAYPAL as the method of payment!
please kindly visite our website: http://www.cnnshoe.com
msn: cnnshoe2008@hotmail.com
email: cnnshoe@gmail.com

==============================================================================
TOPIC: python simply not scaleable enough for google?
http://groups.google.com/group/comp.lang.python/t/ceef2ae6b4472b61?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 2:12 am
From: Robin Becker


Aahz wrote:
> In article <mailman.224.1257933469.2873.python-list@python.org>,
> Robert P. J. Day <rpjday@crashcourse.ca> wrote:
>> http://groups.google.com/group/unladen-swallow/browse_thread/thread/4edbc406f544643e?pli=1
>>
>> thoughts?
>
> Haven't seen this elsewhere in the thread:
>
> http://dalkescientific.com/writings/diary/archive/2009/11/15/100000_tasklets.html


I looked at this and it looks very good in that stackless appears twice as fast
as go(lang) (I used to be in the department of computing at Imperial so I
suppose I have to side with McCabe).

Anyhow, my reading of why Pike was so proud of his set up and tear down of the
tasks example was that these were real threads.

Presumably that means they could potentially run in parallel on the 100000 cpu
machines of the future.

I'm not so clear on whether the threadless tasklets will run on separate cpus.
--
Robin Becker


==============================================================================
TOPIC: checking 'type' programmatically
http://groups.google.com/group/comp.lang.python/t/192a634c2070056f?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 2:10 am
From: mk

Disclaimer: this is for exploring and debugging only. Really.

I can check type or __class__ in the interactive interpreter:

Python 2.6.2 (r262:71600, Jun 16 2009, 16:49:04)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>>
p=subprocess.Popen(['/bin/ls'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
>>> p
<subprocess.Popen object at 0xb7f2010c>
>>> (so, se) = p.communicate()
>>> so
'abc.txt\nbak\nbox\nbuild\ndead.letter\nDesktop\nhrs\nmbox\nmmultbench\nmmultbench.c\npyinstaller\nscreenlog.0\nshutdown\ntaddm_import.log\nv2\nvm\nworkspace\n'
>>> se
''
>>> so.__class__
<type 'str'>
>>> type(so)
<type 'str'>
>>> type(se)
<type 'str'>

But when I do smth like this in code that is ran non-interactively (as
normal program):

req.write('stderr type %s<br>' % type(se))
req.write('stderr class %s<br>' % str(se.__class__))

then I get empty output. WTF?

How do I get the type or __class__ into some object that I can display?


Why do that: e.g. if documentation is incomplete, e.g. documentation on
Popen.communicate() says "communicate() returns a tuple (stdoutdata,
stderrdata)" but doesn't say what is the class of stdoutdata and
stderrdata (a file object to read? a string?).

Regards,
mk


==============================================================================
TOPIC: Is an interactive command a block?
http://groups.google.com/group/comp.lang.python/t/3f0d7607ed5a4a78?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 20 2009 5:06 am
From: Benjamin Kaplan


On Thu, Nov 19, 2009 at 4:42 PM, Alf P. Steinbach <alfps@start.no> wrote:
> * Steven D'Aprano:
>>
>> On Thu, 19 Nov 2009 21:37:17 +0100, Alf P. Steinbach wrote:
>>
>>> The CPython 3.1.1 language reference §4.1 says
>>>
>>>   "Each command typed interactively is a block."
>>>
>>> It also says
>>>
>>>   "If a name is bound in a block, it is a local variable of that block,
>>>   unless
>>>    declared as nonlocal"
>>>
>>> Even with a non-literal try-for-best-meaning reading I can't get this to
>>> mesh with the actual behavior of the interpreter, e.g.
>>>
>>>   >>> for x in "poi":
>>>   ...    fandango = 666
>>>   ...
>>>   >>> fandango
>>>   666
>>>   >>> _
>>>
>>> My current understanding is (A) that the interpreter is correct in this
>>> respect (for one would harldly want the effects of statements to be
>>> fundamentally different in interpreted mode, except the presentation of
>>> expression results), and (B), but here I'm less sure, that the
>>> documentation is incorrect.
>>
>>
>> Why do you say that? I don't see what it is in the command you typed that
>> leads you to think the documentation is incorrect.
>>
>> The first command you type is:
>>
>> for x in "poi":
>>    fandango = 666
>>
>>
>> which binds two names, x and fandango. Since you are not typing them in a
>> function or class definition, locals() is globals() and the two local names
>> you create happen to also be globals.
>
> Thanks, that may be it.
>
> In most other languages I'm familiar with, if a name is local then it isn't
> global (and vice versa), and I had that as an underlying assumption since it
> doesn't appear to be mentioned in the documentation.
>
> However, I find a language reference statement that alludes to this: "(The
> variables of the module code block are local and global.)"
>
> Hm...
>
>
>> The next two commands you type:
>>
>> fandango
>> _
>>
>> don't bind anything, so aren't relevant.
>
> Well it showed that 'fandango' had been defined as a global. :-)
>
>
>> If it helps:
>>
>>
>>>>> for x in "poi":
>>
>> ...     fandango = 666
>> ...
>>>>>
>>>>> locals() is globals()
>>
>> True
>>>>>
>>>>> fandango
>>
>> 666
>>>>>
>>>>> locals()['fandango']
>>
>> 666
>>>>>
>>>>> import __main__
>>>>> __main__.fandango
>>
>> 666
>
> Yeah, helps.
>
> I feel that there's still something lacking in my understanding though, like
> how/where the "really actually just pure local not also global" is defined
> for function definition, but it's now just a vague feeling of something
> missing, not a feeling of direct contradiction as I had when I believed
> local != global.
>

It's because the only blocks in python that have their own scope are
classes and functions. For loops don't have their own scope- they use
the enclosing one, which in this case is globals.

>
> Cheers, & thanks,
>
> - Alf
> --
> http://mail.python.org/mailman/listinfo/python-list
>


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate