Re: [Tutor] (no subject)

2009-09-10 Thread Alan Gauld


"C or L Smith"  wrote

Or (and I'll duck after I pass on what I just happened across today on 
the web):


###
for i in range(len(word)):
   print word[~i]
###


Neat trick!
Now what does ~ do?... the bitwise inverse.
So it relies on the rules of complementing the binary value
to effectively add one and negate. Sneaky, and a new one on me!

Alan G.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Threads very simple examle

2009-09-10 Thread Oleg Oltar
Hi!

I have a question.
I want to create simple load test for my web application.

Consider the following script:

while 1:
urllib2.urlopen("www.example.com")

How can I make it running in several threads?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Threads very simple examle

2009-09-10 Thread Alan Gauld

"Oleg Oltar"  wrote


I want to create simple load test for my web application.
Consider the following script:

while 1:
   urllib2.urlopen("www.example.com")


Just a small caveat.
If you try a load test like this from a single PC you might 
get very surprising (and non representative) results. 
Remember that each request will be sharing a single 
network connection, so the performance bottleneck
can very quickly become the network interface not the 
server. It depends of course on what you are measuring 
and how many threads you want to run. Just be aware of 
the full architecture that you are testing to make sure 
what you measure is what you mean to measure.


Load testing is a very complex task, frought with potential
for false results. I've seen far more erroneous load tests 
than I've seen valid ones!If you on;y want to test for 3 or 4 
connections then it is probably OK but if you try running 
dozens of concurrent tests it will almost certainly fail to 
reflect reality. The same applies to the server of course, 
if it only has one network connection then it may bottleneck 
there too. But most servers (in a data center environment) 
have at least two network interfaces running so its usually  
less of an issue.



How can I make it running in several threads?


I'll leave the threading part to someone else.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2009-09-10 Thread Dirk Wangsadirdja
I tested it and it works. But I dont understand why it works. Can 
someone please explain it further? Thanks.


Alan Gauld wrote:


"C or L Smith"  wrote

Or (and I'll duck after I pass on what I just happened across today on 
the web):


###
for i in range(len(word)):
   print word[~i]
###


Neat trick!
Now what does ~ do?... the bitwise inverse.
So it relies on the rules of complementing the binary value
to effectively add one and negate. Sneaky, and a new one on me!

Alan G.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2009-09-10 Thread Lucas Prado Melo
On Thu, Sep 10, 2009 at 6:44 AM, Dirk Wangsadirdja  wrote:

> I tested it and it works. But I dont understand why it works. Can someone
> please explain it further? Thanks.

~i == -i - 1

http://en.wikipedia.org/wiki/Two%27s_complement
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Threads very simple examle

2009-09-10 Thread Oleg Oltar
On Thu, Sep 10, 2009 at 12:43 PM, Alan Gauld wrote:

> "Oleg Oltar"  wrote
>
>  I want to create simple load test for my web application.
>> Consider the following script:
>>
>> while 1:
>>   urllib2.urlopen("www.example.com")
>>
>
> Just a small caveat.
> If you try a load test like this from a single PC you might get very
> surprising (and non representative) results. Remember that each request will
> be sharing a single network connection, so the performance bottleneck
> can very quickly become the network interface not the server. It depends of
> course on what you are measuring and how many threads you want to run. Just
> be aware of the full architecture that you are testing to make sure what you
> measure is what you mean to measure.
>
> Load testing is a very complex task, frought with potential
> for false results. I've seen far more erroneous load tests than I've seen
> valid ones!If you on;y want to test for 3 or 4 connections then it is
> probably OK but if you try running dozens of concurrent tests it will almost
> certainly fail to reflect reality. The same applies to the server of course,
> if it only has one network connection then it may bottleneck there too. But
> most servers (in a data center environment) have at least two network
> interfaces running so its usually  less of an issue.
>
>  How can I make it running in several threads?
>>
>
> I'll leave the threading part to someone else.
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>


Yes, I use tsung to make massive tests, but I just wanted to make some small
test runner for approx 10-20 threads

Here what I've done:


import
urllib2

from threading import
Thread





def
btl_test():

while
True:

page = urllib2.urlopen("example.com")
print
page.code



for i in
range(120):

t = Thread(target =
btl_test)


t.start()
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] web2py vs django

2009-09-10 Thread mdipierro

This is an example of a Django tutorial "polls" being rewritten in web2py.
Hope to help kickstart:

http://vimeo.com/6507384
-- 
View this message in context: 
http://www.nabble.com/web2py-vs-django-tp25360012p25376004.html
Sent from the Python - tutor mailing list archive at Nabble.com.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Threads very simple examle

2009-09-10 Thread Kent Johnson
On Thu, Sep 10, 2009 at 4:13 AM, Oleg Oltar  wrote:
> Hi!
>
> I have a question.
> I want to create simple load test for my web application.
>
> Consider the following script:
>
> while 1:
>     urllib2.urlopen("www.example.com")
>
> How can I make it running in several threads?

Have you read at all about threads?
http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/
http://www.wellho.net/solutions/python-python-threads-a-first-example.html

You might consider using an existing load test application, there are
many, some even written in Python:
http://httpd.apache.org/docs/2.0/programs/ab.html
http://www.opensourcetesting.org/performance.php
http://www.softwareqatest.com/qatweb1.html#LOAD

Kent
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] (no subject)

2009-09-10 Thread shellc...@juno.com
I want to display all the cards in a deck of playing cards using two tuples for 
all the possible suits.



value = ("A","2","3","4","5","6","7","8","9","10","J","Q","K")

suit = ("c","h","s","d")

deck = value[0:1] + suit[0:1]
for item in deck:
print item

This is the display

>>> 

A c 


Woodhouse Day Spa
Luxury Plano Day Spa with over 70 pampering services
http://thirdpartyoffers.juno.com/TGL2141/c?cp=dsr8LBg9kip6hkIh3gzXYwAAJ1CmHaRKpeX3s0f3JfT8odq8AAUAACSXfz4cTkdAnjuWutIFlqhweIymAA==
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] wxpython question

2009-09-10 Thread Kristina Ambert
Thank you guys for the replies! And thanks for the headsup about the
wxpython mail list, I'll be sure to sign up there as well.


On Wed, Sep 9, 2009 at 7:14 PM, Alan Gauld wrote:

> "Kristina Ambert"  wrote
>
>  I'm not sure if I could ask questions about wx in this list or not,
>> hopefully it's okay? If not I guess disregard this question.
>>
>
> Yes its fine but you will get more complete answers in the wx mailing list.
>
>  But, does anyone have any idea of if it's possible to make a frame that
>> will
>> latch on to the parent frame (e.g. if you resize the parent, the child
>> also
>> resizes, if you move the parent, the child also moves), aside from using
>> the
>> MDI window that's wxpython provides?
>>
>
> Yes, I think so - I'm not 100% sure I know what you mean. But the
> standard wxPython layout managers should control all that for you.
> Look into the docs for FlexGrid and Grid Bag sizers.
>
> They are probably the most powerful sizers but also take more effort
> to use of course.
>
> HTH,
>
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
Cheers,
Krissy
---
Testing the waters is always fun...
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2009-09-10 Thread Kent Johnson
On Thu, Sep 10, 2009 at 9:54 AM, shellc...@juno.com  wrote:
> I want to display all the cards in a deck of playing cards using two tuples 
> for all the possible suits.
>
>
>
> value = ("A","2","3","4","5","6","7","8","9","10","J","Q","K")
>
> suit = ("c","h","s","d")
>
> deck = value[0:1] + suit[0:1]
> for item in deck:
>    print item

See itertools.product(), you can use it directly or use a nested list
comprehension as shown in the docs:
http://docs.python.org/library/itertools.html#itertools.product

Kent
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Getting list of attributes from list of objects

2009-09-10 Thread Oleg Oltar
Hi!

I have the following list

l= [ a, b, c]

Where a,b,c are objects created from one class, e.g. each has title
attribute.
What I want to have is a list of titles, e.g. [a.title, b.title, c.title]

Is there a quick way to do it? Or I should use loops (looping through each
element, and generating list)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Getting list of attributes from list of objects

2009-09-10 Thread vince spicer
On Thu, Sep 10, 2009 at 8:51 AM, Oleg Oltar  wrote:

> Hi!
>
> I have the following list
>
> l= [ a, b, c]
>
> Where a,b,c are objects created from one class, e.g. each has title
> attribute.
> What I want to have is a list of titles, e.g. [a.title, b.title, c.title]
>
> Is there a quick way to do it? Or I should use loops (looping through each
> element, and generating list)
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
you can use list comprehension, which is a type of loop, but looks so pretty
:)

titles = [x.title for x in l]

Vince
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Getting list of attributes from list of objects

2009-09-10 Thread Serdar Tumgoren
> I have the following list
>
> l= [ a, b, c]
>
> Where a,b,c are objects created from one class, e.g. each has title
> attribute.
> What I want to have is a list of titles, e.g. [a.title, b.title, c.title]
>
> Is there a quick way to do it? Or I should use loops (looping through each
> element, and generating list)

I think a list comprehension might be the most compact way to
accomplish what you're after:

objcts = [a, b, c]

titles = [obj.title for obj in objcts]
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Getting list of attributes from list of objects

2009-09-10 Thread Douglas Philips

On or about 2009 Sep 10, at 11:36 AM, Serdar Tumgoren indited:

I think a list comprehension might be the most compact way to
accomplish what you're after:

objcts = [a, b, c]

titles = [obj.title for obj in objcts]


That probably is the best form.


For the sake of showing other options:

from operator import attrgetter
#...
titles = map(attrgetter("title"), objcts)


# I love placeholder for this kind of thing.
from placeholder import __
#...
titles = map(__.title, objcts)

--Doug

P.S. placeholder can be found at: http://pypi.python.org/pypi/placeholder
P.P.S. I have a version that composes, so you can say: map((__ + 3) *  
2, my_numbers) -- http://bitbucket.org/dgou/placeholder2/


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Vista UAC

2009-09-10 Thread Dj Gilcrease
I have a python app that requires elevated privileges on Vista when
installed in "Program Files" since it has an auto updater. I was
wondering if there was a way with a standard install of python 2.6
that I can check if I have the correct privileges and if not relaunch
the app required privileges.


Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2009-09-10 Thread Alan Gauld

"Dirk Wangsadirdja"  wrote

I tested it and it works. But I dont understand why it works. Can 
someone please explain it further? Thanks.


~n means the bitwise complement (or inverse) of n.

This simply means reversing every bit of n so that 1-> 0 and 0->1

This trick relies on the fact that negative numbers are stored 
on computers using a thing called twos-complement (or 
ones-complement sometimes) .  This ensures tjhe leftmost bit 
is always 1 which the PC uses to indicate a negative number. 
Thus to represent -1 we take the  bitwise inverse of 1 and add 1


1 = 0001 ->  1110 + 1 -> 

To get back we subtract 1 and then take the bitwise complement

-1 -> 1110 -> 0001

But with this trick we omit the initial add by 1 stage so 


range(n) yields 0...n

But the inverse of  is  which is interpreted as -1 by Python
as above, so 0 maps to -1  in decimal!

and thus 1 (0001) becomes 1110 to which python does: 
1110 subtracting 1 becomes 1101, and inverting gives 0010 = -2!


and so on.

So using ~ maps 0,1,2... to -1,-2,-3...

Very, very sneaky and the first time I've sen it done!
(because its so opaque I wouldn't actually recommend it, 
most programmers would struggle to figure out what was going on 
and probably think ~ was a typo for - I suspect)


See wikipedia for more on twos-complement, and the related trick ,
which is also used sometimes, of ones-complement.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread David Perlman

I'm not sure why I'm getting an error at the end here:

>>> class dummy:
... def __init__(self,dur=0):
... self.dur=dur
...
>>> z=dummy(3)
>>> z.dur
3
>>> z=dummy(dur=3)
>>> z.dur
3

That worked fine, of course.

>>> class dummy2(str):
... def __init__(self,dur=0):
... self.dur=dur
...
>>> z=dummy2(3)
>>> z.dur
3

So far so good.  But:

>>> z=dummy2(dur=3)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'dur' is an invalid keyword argument for this function
>>>

Why doesn't that last bit work?  I'm not sure where to begin to look  
this up.

Thanks!

--
-dave
"Pseudo-colored pictures of a person's brain lighting up are
undoubtedly more persuasive than a pattern of squiggles produced by a
polygraph.  That could be a big problem if the goal is to get to the
truth."  -Dr. Steven Hyman, Harvard



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread Serdar Tumgoren
 class dummy2(str):
> ...     def __init__(self,dur=0):
> ...             self.dur=dur
> ...
 z=dummy2(3)
 z.dur
> 3
>
> So far so good.  But:
>
 z=dummy2(dur=3)
> Traceback (most recent call last):
>  File "", line 1, in 
> TypeError: 'dur' is an invalid keyword argument for this function


I think you're problem may stem from the fact that you subclassed the
string type and then tried to pass in an integer.

>>> class Dummy2(int):
... def __init__(self, dur=0):
... self.dur = dur
...
>>> z = Dummy2(3)
>>> z.dur
3

When you sub "int" for "str", it seems to work. Is there a reason
you're not just subclassing "object"? I believe doing so would give
you the best of both worlds.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread David Perlman

Well, here's what I am really doing:

class oneStim(str):
def __init__(self, time, mods=[], dur=None, format='%1.2f'):
self.time=time
self.mods=mods
self.dur=dur
self.format=format

def __cmp__(self,other):
return cmp(self.time,other.time)

def __repr__(self):
timestr=self.format % self.time
if self.mods == []:
modstr=''
else:
modstr = '*' + ','.join(self.format % i for i in self.mods)
if self.dur == None:
durstr = ''
else:
durstr = ':' + (self.format % self.dur)
return timestr + modstr + durstr

def __len__(self):
return len(self.__repr__())


The purpose of this is to make an object that holds a collection of  
numbers and represents them as a specifically formatted string.  I  
want to be able to do something like:


>>> z=oneStim(22.5678)
>>> z.dur=10
>>> z
22.57:10.00
>>> len(z)
11
>>> z.rjust(20)
' 22.5678'

Note that that doesn't work either.  It works fine like this, though:
>>> z
22.57:10.00
>>> str(z).rjust(20)
' 22.57:10.00'

I can work with that just fine, but I am curious to understand what's  
going on under the hood that makes it fail when subclassed from str...



On Sep 10, 2009, at 3:42 PM, Serdar Tumgoren wrote:


class dummy2(str):

... def __init__(self,dur=0):
... self.dur=dur
...

z=dummy2(3)
z.dur

3

So far so good.  But:


z=dummy2(dur=3)

Traceback (most recent call last):
 File "", line 1, in 
TypeError: 'dur' is an invalid keyword argument for this function




I think you're problem may stem from the fact that you subclassed the
string type and then tried to pass in an integer.


class Dummy2(int):

... def __init__(self, dur=0):
... self.dur = dur
...

z = Dummy2(3)
z.dur

3

When you sub "int" for "str", it seems to work. Is there a reason
you're not just subclassing "object"? I believe doing so would give
you the best of both worlds.


--
-dave
"Pseudo-colored pictures of a person's brain lighting up are
undoubtedly more persuasive than a pattern of squiggles produced by a
polygraph.  That could be a big problem if the goal is to get to the
truth."  -Dr. Steven Hyman, Harvard



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread Serdar Tumgoren
> When you sub "int" for "str", it seems to work. Is there a reason
> you're not just subclassing "object"? I believe doing so would give
> you the best of both worlds.
>

Of course, I should qualify the above -- the "str" subclass inherits
very different methods than "int" or "object".

http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-buffer-xrange

If retaining the string methods is important for your use case, you
might require a more nuanced solution...
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread christopher . henk
tutor-bounces+christopher.henk=allisontransmission@python.org wrote on 
09/10/2009 04:13:23 PM:

> I'm not sure why I'm getting an error at the end here:
> 
>  >>> class dummy:
> ... def __init__(self,dur=0):
> ... self.dur=dur
> ...
>  >>> z=dummy(3)
>  >>> z.dur
> 3
>  >>> z=dummy(dur=3)
>  >>> z.dur
> 3
> 
> That worked fine, of course.
> 
>  >>> class dummy2(str):
> ... def __init__(self,dur=0):
> ... self.dur=dur
> ...
>  >>> z=dummy2(3)
>  >>> z.dur
> 3
> 
> So far so good.  But:
> 
>  >>> z=dummy2(dur=3)
> Traceback (most recent call last):
>File "", line 1, in 
> TypeError: 'dur' is an invalid keyword argument for this function
>  >>>
> 
> Why doesn't that last bit work?  I'm not sure where to begin to look 
> this up.
> Thanks!
> 
> --
> -dave
> "Pseudo-colored pictures of a person's brain lighting up are
> undoubtedly more persuasive than a pattern of squiggles produced by a
> polygraph.  That could be a big problem if the goal is to get to the
> truth."  -Dr. Steven Hyman, Harvard
> 

I believe it has to do with the fact that str is immutable and thus should 
use __new__ instead of __init__. 
>>> class bob(str):
... def __new__(self, fred=3):
... self.fred=fred
... return self
...
>>> george=bob()
>>> george.fred
3
>>> george=bob(fred=7)
>>> george.fred
7

Don't have a chance to read it now but maybe pep 253 explains it.
http://www.python.org/dev/peps/pep-0253/

Chris
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread Kent Johnson
On Thu, Sep 10, 2009 at 4:51 PM, David Perlman  wrote:
> Well, here's what I am really doing:
>
> class oneStim(str):
>    def __init__(self, time, mods=[], dur=None, format='%1.2f'):
>        self.time=time
>        self.mods=mods
>        self.dur=dur
>        self.format=format

This is a bit odd because you don't call str.__init__() so you never
initialize the "str" part of a oneStim.

Actually when you subclass immutable, built-in classes you have to
override __new__() rather than __init__(). Here is an example:
http://mail.python.org/pipermail/python-list/2004-June/265368.html

> The purpose of this is to make an object that holds a collection of numbers
> and represents them as a specifically formatted string.  I want to be able
> to do something like:
>
 z=oneStim(22.5678)
 z.dur=10
 z
> 22.57:10.00
 len(z)
> 11
 z.rjust(20)
> '             22.5678'
>
> Note that that doesn't work either.

You are expecting that str.rjust() accesses the string using
__repr__() but it doesn't, it directly accesses the internal data.

> It works fine like this, though:
 z
> 22.57:10.00
 str(z).rjust(20)
> '         22.57:10.00'
>
> I can work with that just fine, but I am curious to understand what's going
> on under the hood that makes it fail when subclassed from str...

I would skip the cleverness of trying to subclass string. You can use
str(z).rjust(20) as above, or use string formatting:
  '%20s' % z

Kent
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread David Perlman

Yeah, this seems to be the best answer in this situation.  :)

On Sep 10, 2009, at 4:17 PM, Kent Johnson wrote:


I would skip the cleverness of trying to subclass string. You can use
str(z).rjust(20) as above, or use string formatting:
 '%20s' % z


--
-dave
Unfortunately, as soon as they graduate, our people return
to a world driven by a tool that is the antithesis of thinking:
PowerPoint. Make no mistake, PowerPoint is not a neutral tool —
it is actively hostile to thoughtful decision-making. It has
fundamentally changed our culture by altering the expectations
of who makes decisions, what decisions they make and how
they make them.  -Colonel T. X. Hammes, USMC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] web2py vs django

2009-09-10 Thread Mal Wanstall
On Thu, Sep 10, 2009 at 5:29 AM, Alan Gauld  wrote:
>
> "Kent Johnson"  wrote
>>
>> That thread is about web.py, not web2py, they are different frameworks.
>
> I confess I too had missed that subtlety!
> Like editors and standards...
> The wonderful thing about Web Frameworks in Python - there are so many to
> choose from!
>
> But it is confusing, my advice is just pick one and stick with it!
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> ___
> Tutor maillist  -  tu...@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

That is the advice that certainly worked for me. For a long time I was
switching between web frameworks, as each have their nuances which
make them seem better than the others, and what you end up with is a
bit of knowledge on each...but not enough on any single one to get the
full power out of it. There is always risk involved with backing a
single horse, but I found it massively beneficial when I did.

In the end I settled with Pylons because I like it's lack of glue
between components but I'm positive I could have done all of my
projects in any of the frameworks and each would have had their
challenges and successes.

Kudos to Massimo though; web2py is a spiffy idea and it's implemented well.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Vista UAC

2009-09-10 Thread Alan Gauld


"Dj Gilcrease"  wrote


wondering if there was a way with a standard install of python 2.6
that I can check if I have the correct privileges and if not relaunch
the app required privileges.


I haven't checked what the standard os functions do on Windows 
but you can always use ctypes to access the Windows API directly.

Not trivial but possible.

Alan G.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Vista UAC

2009-09-10 Thread Jeff Johnson

Dj Gilcrease wrote:

I have a python app that requires elevated privileges on Vista when
installed in "Program Files" since it has an auto updater. I was
wondering if there was a way with a standard install of python 2.6
that I can check if I have the correct privileges and if not relaunch
the app required privileges.


Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com
I have an application that uses something that auto updates but it may 
not be the same process as yours.  I have a "stub" executable that 
checks a network location for a different copy of the "real" executable. 
 If one exists, it copies the exe to the application folder and 
executes it.  My solution for Vista - which works very well - is to put 
my application in a folder C:\users\public\applications\myapplication.


This way there is no need for raised privileges.

--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor