Re: [Tutor] Ressources for licensing

2010-12-12 Thread Knacktus

Am 12.12.2010 03:42, schrieb David Hutto:

On Sat, Dec 11, 2010 at 9:52 AM, Knacktus  wrote:

Hi everyone,

can anybody recommend a lib or some other ressources about license
mechanisms of desktop applications written in python. I'm thinking of a
license-key that can be used to limit the time the application can be used.
I also need to exploit the usage of a license server.



You probably need:

def license_this(self):
 print "touch mine"

license_this(self)



I don't get it. Could you please explain a bit?





Cheers,

Jan
___
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] Writing to the terminal?

2010-12-12 Thread Wayne Werner
On Fri, Dec 10, 2010 at 2:38 PM, Corey Richardson  wrote:

>
>
> On 12/10/2010 3:34 PM, Wayne Werner wrote:
>
>> If you just want a single line you can use chr(13) which is a carriage
>> return. If you want a more complex program you'll need a curses type
>> library
>> hth, wayne
>>
>> On 12/10/10, Modulok  wrote:
>>
>>> List,
>>>
>>> Forgive me if I don't describe this well, I'm new to it:
>>>
>>> Assume I'm working in a command shell on a terminal. Something like
>>> tcsh on xterm, for example. I have a program which does *something*.
>>> Let's say it counts down from 10. How do I print a value, and then
>>> erase that value, replacing it with another value? Say I had something
>>> like '10' that appears, then wait a second, then the 10 is replaced by
>>> '9'... '8'.. and so forth. The point is, I don't want to print to a
>>> new line, nor do I want the new number to appear next to the previous
>>> number... I just want to change it in place. (If that makes any
>>> sense?) Think of console based progress counters in programs like
>>> fetch or wget, or lame.
>>>
>>> How do you do this in Python?
>>> -Modulok-
>>> ___
>>> Tutor maillist  -  Tutor@python.org
>>> To unsubscribe or change subscription options:
>>> http://mail.python.org/mailman/listinfo/tutor
>>>
>>>
> Try that in the interactive interpreter, it doesn't work.
> >>> print "a" + chr(13)
> a
> (Python 2.6.6)
>

Actually, it does:
 >>> print 'a' + chr(13) + 'b'
b

The cursor moves back, you just didn't bother to overwrite the 'a'.

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


Re: [Tutor] using a networked data file

2010-12-12 Thread Wayne Werner
On Sat, Dec 11, 2010 at 12:07 PM, Bill Allen  wrote:

> David,
>
> Thanks for the feedback.   I should have been more specific on the usage of
> the data.   The data will be some email addresses, names, department, and an
> indicator if the email address is internal to the business or an external
> contact.   So, one table with these being the fields in each record should
> suffice.   The users will be presented an interface that allows them to
> select one or more recipients to which a standardized email with a PDF
> attachment will be sent.   All of this is no problem.   I was concerned that
> with more than one user at a time potentially accessing the SQLite db at a
> time would be a problem, but I see from the SQLite site and from some
> discussions here on Tutor that this is perfectly fine.   The users may add
> information to the db also, but since such writes will be infrequent this
> too should be OK.   At least, that is the impression that I have gotten from
> what I have read here and other places.   Just wanting to confirm that I
> have understood this correctly.  Also, any other suggestions are welcome.
>
> Thanks,
> Bill Allen


 I think the larger concern is how the users are accessing the DB. Multiple
clients on multiple computers accessing the same db file on an accessible
network location? Or something else?

There are plenty of pitfalls to be aware of depending on your use.

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


Re: [Tutor] Slicing Tuples

2010-12-12 Thread John Russell
Thanks to all for your answers, especially those that went into detail about
why its done in that way.

As far as whether this is actually addressed in the book, as far as I can
tell by going a few pages forward, it does not. In fact, after the code
there's a how it works section which only added to my confusion because all
it contained was one sentence: "In each case, using the colon to specify a
slice of the sequence instructs Python to create a new sequence that
contains *just those elements.*" I added the bold, but obviously its a bit
misleading.

Thanks again for taking the time to answer and explain such a basic concept.
I appreciate it!

-jlr

On Sat, Dec 11, 2010 at 6:39 PM, Steven D'Aprano wrote:

> John Russell wrote:
>
>  So, my question is this, and I realize that this is *very* basic - what is
>> going on with the last element? Why is it returning one less than I think
>> it
>> logically should. Am I missing something here? There is not much of an
>> explanation in the book, but I would really like to understand what's
>> going
>> on here.
>>
>
>
> If the book really doesn't explain this (as opposed to you just having
> missed it), that's a fairly serious lack!
>
> Slicing in Python uses what is called "half-open intervals". There are four
> obvious ways to count slices:
>
> (1) Closed interval:
>both the start index and the end index are included.
>
> (2) Open interval:
>both the start index and end index are excluded.
>
> (3) Half-open interval:
>the start index is included, and the end index excluded.
>
> (4) Half-open interval (reversed sense):
>the start index is excluded, and the end index included.
>
>
> Python uses #3 because it is generally the most simple and least
> error-prone. Essentially, you should consider a slice like sequence[a:b] to
> be equivalent to "take a slice of items from seq, start at index=a and stop
> when you reach b". Because you stop *at* b, b is excluded.
>
> Indexes should be considered as falling *between* items, not on them:
>
> 0.1.2.3.4.5.6.7.8
> |a|b|c|d|e|f|g|h|
>
> Run an imaginary knife along the line marked "4", and you divide the
> sequence abcdefgh into two pieces: abcd and efgh.
>
> Why are half-open intervals less error-prone? Because you have to adjust by
> 1 less often, and you have fewer off-by-one errors. E.g.
>
> * Take n items starting from index i:
>
>  Half-open: seq[i:i+n]
>  Closed:seq[i:i+n-1]
>
> * Length of a slice [i:j]:
>
>  Half-open: j-i
>  Closed:j-i+1
>
> * Dividing a sequence into two slices with no overlap:
>
>  Half-open:
>s = seq[:i]
>t = seq[i:]
>
>  Closed:
>s = seq[:i-1]
>t = seq[i:]
>
> * Splitting a string at a delimiter:
>  s = "abcd:efgh"
>
>  We want to split the string into two parts, everything before
>  the colon and everything after the colon.
>
>  Half-open:
>p = s.find(':')
>before = s[:p]
>after = s[p+1:]
>
>  Closed:
>p = s.find(':')
>before = s[:p-1]
>after = s[p+1:]
>
> * Empty slice:
>
>  Half-open: seq[i:i] is empty
>  Closed:seq[i:i] has a single item
>
>
> So half-open (start included, end excluded) has many desirable properties.
> Unfortunately, it has two weaknesses:
>
> - most people intuitively expect #1;
> - when slicing in reverse, you get more off-by-one errors.
>
> There's not much you can do about people's intuition, but since reverse
> slices are much rarer than forward slices, that's a reasonable cost to pay.
>
>
>
> --
> Steven
> ___
> 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] using a networked data file

2010-12-12 Thread Bill Allen
Wayne,

Yes, you have characterized it pretty well.  Additionally, it will be
accessed typically by maybe a dozen individuals, typically only reading
information from the database and infrequently writing to it.

--Bill

On Sun, Dec 12, 2010 at 7:36 AM, Wayne Werner wrote:

>
>
>  I think the larger concern is how the users are accessing the DB. Multiple
> clients on multiple computers accessing the same db file on an accessible
> network location? Or something else?
>
> There are plenty of pitfalls to be aware of depending on your use.
>
> -Wayne
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Writing to the terminal?

2010-12-12 Thread Hugo Arts
On Sun, Dec 12, 2010 at 2:16 PM, Wayne Werner  wrote:
>>
>> Try that in the interactive interpreter, it doesn't work.
>> >>> print "a" + chr(13)
>> a
>> (Python 2.6.6)
>
> Actually, it does:
>  >>> print 'a' + chr(13) + 'b'
> b
> The cursor moves back, you just didn't bother to overwrite the 'a'.
> HTH,
> Wayne
>

Am I being spam-filtered or something? This e-mail I sent over two
days ago, cc'd to tutor and also you specifically. Not that you're
wrong, it just seems rather redundant at this point:

On Fri, Dec 10, 2010 at 9:38 PM, Corey Richardson  wrote:
>
> Try that in the interactive interpreter, it doesn't work.
 print "a" + chr(13)
> a

You forgot to print something after the carriage return. It works for me:

Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'a'+chr(13)+'b'
b
>>>

the carriage return resets the cursor to the beginning of the line, so
you can write over what you wrote before.

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


[Tutor] Any recommend of UML tool and UI design tool for python?

2010-12-12 Thread cajsdy
Either paid or free open source is fine.
I'm creating automation frame work. Idealy it includes:

test plan management,
test manager across windows, unix, linux, solaris and other os.
UML documentation for python scripts
IDE tool for python on windoes and linux
UI design tool for python(best is integrated with IDE)

Wonder any recommend?


On 12/11/10, David  wrote:
> On 12 December 2010 03:25, John Russell  wrote:
>> Last night I started working through a book (Beginning Python: Using
>> Python
>> 2.6 and Python 3.1)  I bought to learn Python, and there is an example in
>> it
>> that doesn't make sense to me.
>
> I have that book too, and several others thankfully. I'm just writing
> to share my experience, in case another perspective from another
> relatively new python user is helpful to anyone.
>
> I found that book is written towards a friendly beginner level, but it
> omits many details and is not a comprehensive reference. It does
> include plenty of examples on many topics. I have read the opposite
> criticism of other books, so it is probably impossible for one book to
> fit all needs.
>
> Personally I became weary of the food/fridge/kitchen theme of the
> early examples as it did not engage my interest at all, and there is
> so much of it. However I have found that book valuable for its Part
> III where it covers useful applications. Although I have come to
> expect that its examples will often need typos corrected or other
> small modifications to get them to run properly on Python 2.6.
>
> So while working through Parts I and II, if your experience is
> anything like mine where I moved away from it fairly quickly, you will
> definitely need other resources. Fortunately they are abundantly
> available. In case you are unaware, a Tutorial and Reference are
> integrated with Python. On my Linux box the tutorial is
> file:///usr/share/doc/python-docs-x.x.x/html/tutorial/index.html and
> the Alphabetic Index to the Reference is
> file:///usr/share/doc/python-docs-x.x.x/html/genindex.html
>
> I find the Tutorial easily readable, whereas the Reference can be
> challenging, but it is comprehensive and likely contains the answer to
> most questions, somewhere.
>
> As an exercise I thought I'd try to find the answer to your question
> using these built-in docs. The keyword is "slice" which we know from
> the book. I couldn't find any coverage in the 2.6 tutorial so I looked
> up "slice" in the Alphabetic Index, and the first link took me to a
> section which includes the answer: "The slicing now selects all items
> with index k such that i <= k < j where i and j are the specified
> lower and upper bounds".
>
> In case you are not aware, the web has a vast amount of great material
> for learning Python, see for example:
> http://wiki.python.org/moin/BeginnersGuide/NonProgrammers
> As Python is an evolving language, one needs be mindful of the
> differences between Python 2.x and Python 3.x when using this
> material.
>
> My favourite Python book of my small beginners collection is "Python 3
> Object Oriented Programming" by Dusty Phillips. It claims:
> "If you're new to object-oriented programming techniques, or if you
> have basic Python skills, and wish to learn in depth how and when to
> correctly apply object-oriented programming in Python, this is the
> book for you".
> I endorse that completely. Having learned the syntax basics elsewhere,
> for me this is a book like no other. I find its topic coverage and all
> its short examples consistently useful, powerful, and illuminating. I
> find it easy to read, well matched to my level and interest, and it
> has made a real difference to the code I write. I use classes with
> confidence now. For example, it gave me the background and confidence
> to design a custom sortable abstract class I needed, my first personal
> experience of the power of OOP.
>
> Tthe python and tutorial mailing lists are a wonderul resource as you
> are obviously aware. Thanks to all the contributors from whom I
> continue to learn.
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

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


Re: [Tutor] role playing game - help needed

2010-12-12 Thread Alan Gauld

"David Hutto"  wrote

> That is a bad piece of advice. You should only use input() when 
> you can

> fully trust whoever doing the input (i.e. you).

Who uses the crap we, as noobies produce?


Hopefully you do.
And can you really be absolutely sure you won't accidentally
type a dangerous command into an input prompt?
I once accidentally deleted all the files on my Unix workstation
by thinking I was in a subdirectory when I was at the root folder
as administrator It took me several hours to recover the bulk
of my files using the raw shell commands and a nwetwork
connection to my colleage's Sun box.

The point is that it's nearly as easy to use good practice as it
is to use bad practice so you might as well get used to doing
it the safe way. Then you are protected, even from yourself.


It's pie in the sky mentality. We design it because WE
want it and WE(individually) use it.


But if it works for you it may well work for somebody else,
who, when they see it, want a copy. That's how the vast majority
of amateur written software starts off, then it becomes
shareware or opensource and starts getting copied on.
And if it has insecure code in, people get bitten. Now, you
can argue its their own fault for using "opensource" code,
but they won't see it that way.

One of the most widely distributed programs that I've written
(privately) was something I did when first learning Windows
programming with Delphi - literally the second Windows
program I ever wrote. 15 years lqater I still get the occasional
email from somebody who has found a copy and wants to use it!
It was a learning excercise for my own amusement, I lent it
to a friend, who lent it to a friend who asked for some
tweaks, etc... There are probably several hundred users now.

And remember that Linux started out as a personal learning
exercise for Linus Torvalds while a student, he didn't set out
to challlenge Microsoft, it was just a bit of a fun thing to do.

Software that does something useful has a habit of proliferating,
even when written by noobies. Get into the habit of doing things
well and that will be a good thing of which you can be proud..

--
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] 'or' in assignment (not if statement)?

2010-12-12 Thread Alan Gauld


"Steven D'Aprano"  wrote

ordered a chai latte at a cafe. The waiter had no idea what that 
was, but must have known that "chai" means tea, and so mixed tea and 
coffee


So now I've got to ask, what is a chai latte?
I could Google it but I'm feeling lazy :-)

Alan G. 



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


Re: [Tutor] Any recommend of UML tool and UI design tool for python?

2010-12-12 Thread Alan Gauld


"cajsdy"  wrote

 Either paid or free open source is fine.
I'm creating automation frame work. Idealy it includes:

test plan management,
test manager across windows, unix, linux, solaris and other os.
UML documentation for python scripts
IDE tool for python on windoes and linux
UI design tool for python(best is integrated with IDE)


Eclipse would be the logical choice and there are a few free
UML editor plug-ins. I've tried one (can't recall the name) and
although a bit clunky compared to commercoal versions it
worked fine for small class and sequence diagrams.

If you don't need full CASE modelling  facilities someting
like a drawing tool such as Dia, Visio or Smartdraw might
suffice.

If you want full CASE features (model validation, simulation,
code generation, reverse engineering fof diagrams from code, etc)
then I think you will need to pay - and probably quite a lot! I've
used both Borland Together and IBM RSA. I prefer Borland
although IBM produces prettier diagrams - but I found it a
lot less intuitive. to use. Both come as Eclipse plugins and
work with whatever version control tools Eclipse is using.

There are other standalone UML tools too but it depends how
much of UML you want to use. If it's only a few basic class diagrams,
sequence diagrams and state diagrams then prettty much
anything will do. If you need to get into the more structural
aspects of UML (deployment diagrams, components, nested states,
activity charts, use-cases etc) then you might want to look at
paying out some money.

--
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] Writing to the terminal?

2010-12-12 Thread Modulok
List,

Thanks! I think I got it working now with the help of some suggestions :-)

For more complex stuff, (think blue screens with little white boxes
you press spacebar to activate. Kind of like an OS installer) I would
look into the `curses` module in the standard library?

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


Re: [Tutor] Any recommend of UML tool and UI design tool for python?

2010-12-12 Thread Knacktus

Am 12.12.2010 19:16, schrieb Alan Gauld:


"cajsdy"  wrote

Either paid or free open source is fine.
I'm creating automation frame work. Idealy it includes:

test plan management,
test manager across windows, unix, linux, solaris and other os.
UML documentation for python scripts
IDE tool for python on windoes and linux
UI design tool for python(best is integrated with IDE)


Eclipse would be the logical choice and there are a few free
UML editor plug-ins. I've tried one (can't recall the name) and
although a bit clunky compared to commercoal versions it
worked fine for small class and sequence diagrams.

If you don't need full CASE modelling facilities someting
like a drawing tool such as Dia, Visio or Smartdraw might
suffice.

If you want full CASE features (model validation, simulation,
code generation, reverse engineering fof diagrams from code, etc)
then I think you will need to pay - and probably quite a lot! I've
used both Borland Together and IBM RSA. I prefer Borland
although IBM produces prettier diagrams - but I found it a
lot less intuitive. to use. Both come as Eclipse plugins and
work with whatever version control tools Eclipse is using.

There are other standalone UML tools too but it depends how
much of UML you want to use. If it's only a few basic class diagrams,
sequence diagrams and state diagrams then prettty much
anything will do. If you need to get into the more structural
aspects of UML (deployment diagrams, components, nested states,
activity charts, use-cases etc) then you might want to look at
paying out some money.



If you're willing to pay for a CASE tool then check out Enterprise 
Architect from http://sparxsystems.eu/
For the massive features I think it's reasonable priced (professional 
edition for 165 Euro + VAT).
UML-Source Code integration with Python ... I don't know if it really 
works. You would need to limit your code to pure OO-style. Such 
integration might work with Java and C# (Enterprise Architect can do 
this: Change code -> update UML and vice versa). Nevertheless. 
Enterprise Architect supports Python for reverse engineering.


For designing UIs: You will need another tool. It depends on your GUI 
toolkit. If you're planning to use PyQt  as GUI toolkit (which I can 
only highly recommend) you're lucky. It has GUI designer, which is quite 
nice.

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


Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sat, Dec 11, 2010 at 10:39 PM, Steven D'Aprano  wrote:
> David Hutto wrote:
>>
>> On Sat, Dec 11, 2010 at 11:54 AM, Lie Ryan  wrote:
>>>
>>> On 12/07/10 23:37, Robert Sjöblom wrote:

 I've been told to use input() if I know that I'll only get integers,
 and raw_input() for "everything."
>>>
>>> That is a bad piece of advice. You should only use input() when you can
>>> fully trust whoever doing the input (i.e. you).
>>
>> Who uses the crap we, as noobies produce? It's pie in the sky
>> mentality. We design it because WE want it and WE(individually) use
>> it.
>
> Do you want to learn good habits or learn bad habits? I think we've seen
> plenty of evidence on this mailing list that you have little interest in
> learning good habits, but actively defend your right learn bad habits.

You define a good habit as making the code impossible for someone just
learning to use,
and you call my habits bad.. I recall you making a habit of being an
asshole(pystats should ring a bell, thanks for giving me the credit
for inspiration...bitch)



>
> There are plenty of people who do the same. They're harmless and even
> pathetically amusing as newbies, and then they get a job working as a
> professional programmer, and end up writing crappy, bug-addled code filled
> with the sort of n00b errors that we've been warning about. Bug-addled code
> with *real* consequences.

Yeah, we call that YOUR mistakes being pointed out later in life due
to experience.
20/20 hindsight is great ain't it poindexter?

>
> Command injection bugs are hugely common in the real world. At least four of
> the 25 most common security bugs in *professional* software are in my
> opinion varieties of the command injection flaw, and one of those is the
> SECOND most common flaw:
>
> SQL injection attack #2 most common
> Unrestricted upload of dangerous files #8 most common
> OS command injection #9 most common
> PHP file inclusion attack #13 most common

Injection is only relevant in non-personal code.


>
> http://cwe.mitre.org/top25/
>
> OS command injection is *exactly* the sort of thing we're warning about.
>
> Feel free to continue learning bad habits, but please stop trying to
> encourage others to do the same.

I didn't encourage a bad habit, I encouraged development of a problem
defined by the client and a solution developed byu the programmer.

The only bad habit around here, is your condescending nature.


>
>
> --
> Steven
> ___
> Tutor maillist  -  tu...@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] Ressources for licensing

2010-12-12 Thread David Hutto
You need a file that sets the initial time used for the app(the time
on the individuals computer), and a function that checks that initial
start up file for the current time and the original usage time of
first start up.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Ressources for licensing

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:27 PM, David Hutto  wrote:
> You need a file that sets the initial time used for the app(the time
> on the individuals computer), and a function that checks that initial
> start up file for the current time and the original usage time of
> first start up.
>

pseudocode:

def initialfile():
f = open('/initialfile','w')
if f:
pass
if not f:
time = os/sys.time
f.write(time)

def check original:
if f found:
check f.time
currenttime
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Ressources for licensing

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:32 PM, David Hutto  wrote:
> On Sun, Dec 12, 2010 at 2:27 PM, David Hutto  wrote:
>> You need a file that sets the initial time used for the app(the time
>> on the individuals computer), and a function that checks that initial
>> start up file for the current time and the original usage time of
>> first start up.
>>
>
> pseudocode:
>
> def initialfile():
>    f = open('/initialfile','w')
>    if f:
>        pass
>    if not f:
>        time = os/sys.time
>        f.write(time)
>
> def check original:
>    if f found:
>        check f.time
>        currenttime
  if f.time > setlimit of time:
sys.exit()
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:16 PM, David Hutto  wrote:
> On Sat, Dec 11, 2010 at 10:39 PM, Steven D'Aprano  wrote:
>> David Hutto wrote:
>>>
>>> On Sat, Dec 11, 2010 at 11:54 AM, Lie Ryan  wrote:

 On 12/07/10 23:37, Robert Sjöblom wrote:
>
> I've been told to use input() if I know that I'll only get integers,
> and raw_input() for "everything."

 That is a bad piece of advice. You should only use input() when you can
 fully trust whoever doing the input (i.e. you).
>>>
>>> Who uses the crap we, as noobies produce? It's pie in the sky
>>> mentality. We design it because WE want it and WE(individually) use
>>> it.
>>
>> Do you want to learn good habits or learn bad habits? I think we've seen
>> plenty of evidence on this mailing list that you have little interest in
>> learning good habits, but actively defend your right learn bad habits.
>
> You define a good habit as making the code impossible for someone just
> learning to use,
> and you call my habits bad.. I recall you making a habit of being an
> asshole(pystats should ring a bell, thanks for giving me the credit
> for inspiration...bitch)
>
>
>
>>
>> There are plenty of people who do the same. They're harmless and even
>> pathetically amusing as newbies,

Said the pathetically amusing pro.

 and then they get a job working as a
>> professional programmer, and end up writing crappy, bug-addled code filled

As your ignorant ass did when you first started(maybe no email
evidence, but just an educated guess)

>> with the sort of n00b errors that we've been warning about. Bug-addled code
>> with *real* consequences.
>
> Yeah, we call that YOUR mistakes being pointed out later in life due
> to experience.
> 20/20 hindsight is great ain't it poindexter?
>
>>
>> Command injection bugs are hugely common in the real world. At least four of
>> the 25 most common security bugs in *professional* software are in my
>> opinion varieties of the command injection flaw, and one of those is the
>> SECOND most common flaw:
>>
>> SQL injection attack #2 most common
>> Unrestricted upload of dangerous files #8 most common
>> OS command injection #9 most common
>> PHP file inclusion attack #13 most common
>
> Injection is only relevant in non-personal code.
>
>
>>
>> http://cwe.mitre.org/top25/
>>
>> OS command injection is *exactly* the sort of thing we're warning about.
>>
>> Feel free to continue learning bad habits, but please stop trying to
>> encourage others to do the same.
>
> I didn't encourage a bad habit, I encouraged development of a problem
> defined by the client and a solution developed byu the programmer.
>
> The only bad habit around here, is your condescending nature.
>
>
>>
>>
>> --
>> Steven
>> ___
>> Tutor maillist  -  tu...@python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>


And if you do look at the emails, yes i was hostile at the
beginning(I've learned to ignore bitches like you), because of
attitudes like yours. And if you also look, everytime I tried to help
point a fellow noob in the right direction, you came in and said how
ignorant I was for trying to help(thanks alot, from them and me).
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-12 Thread Tim Johnson
* Steven D'Aprano  [101211 17:20]:
> Tim Johnson wrote:
>
>>   I've never had the occasion to use assert() or any other
>>   python - shooting tools, any thoughts on that?
>
>
> Assertions are a great tool, but never ever, under pain of great pain,  
> use assert for testing user input or function arguments.
<.>
>
> Who makes that choice? You, or the caller? If the caller, then any  
> errors that occur are not internal state, and you shouldn't use assert.  
> If you, then it's an internal detail and you can use assert.

  Steven: Thanks very much for taking so much time and effort to
  answer my question. I will file this writing for future and
  ongoing reference. 

  BTW: I was able to solve the problem. Essentially a clone of
  Eval() was being called and probably clobbering the stack frame.
  It was a tedious process of tracking thru known and likely code
  dependencies and insert debugging stubs. I've written my own
  debugging macros using vimscript and from your input I would guess
  that assert would have just clouded the process.

  thanks again.
-- 
Tim 
tim at johnsons-web.com or akwebsoft.com
http://www.akwebsoft.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] role playing game - help needed

2010-12-12 Thread Walter Prins
On 12 December 2010 19:16, David Hutto  wrote:

>  I recall you making a habit of being an
> asshole(pystats should ring a bell, thanks for giving me the credit
> for inspiration...bitch)
>

Rudeness objection.  Ad-hominem objection.

Come on, this is not kindergarten.  We all have our foibles, and although
I'd agree the tone around here occasionally leaves something to be desired,
you just lower yourself to the same level and make matters worse if you
resort to this type of name-calling.   Let's stick to objectively (as far as
possible) critiquing and considering the points raised.

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


Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:44 PM, Walter Prins  wrote:
>
>
> On 12 December 2010 19:16, David Hutto  wrote:
>>
>>  I recall you making a habit of being an
>> asshole(pystats should ring a bell, thanks for giving me the credit
>> for inspiration...bitch)
>
> Rudeness objection.  Ad-hominem objection.
>
> Come on, this is not kindergarten.  We all have our foibles, and although
> I'd agree the tone around here occasionally leaves something to be desired,
> you just lower yourself to the same level and make matters worse if you
> resort to this type of name-calling.   Let's stick to objectively (as far as
> possible) critiquing and considering the points raised.
>
> Walter
>
 He started it!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:45 PM, David Hutto  wrote:
> On Sun, Dec 12, 2010 at 2:44 PM, Walter Prins  wrote:
>>
>>
>> On 12 December 2010 19:16, David Hutto  wrote:
>>>
>>>  I recall you making a habit of being an
>>> asshole(pystats should ring a bell, thanks for giving me the credit
>>> for inspiration...bitch)
>>
>> Rudeness objection.  Ad-hominem objection.
>>
>> Come on, this is not kindergarten.  We all have our foibles, and although
>> I'd agree the tone around here occasionally leaves something to be desired,
>> you just lower yourself to the same level and make matters worse if you
>> resort to this type of name-calling.   Let's stick to objectively (as far as
>> possible) critiquing and considering the points raised.
>>
>> Walter
>>
>  He started it Mama!
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:42 PM, Tim Johnson  wrote:
> * Steven D'Aprano  [101211 17:20]:
>> Tim Johnson wrote:
>>
>>>   I've never had the occasion to use assert() or any other
>>>   python - shooting tools, any thoughts on that?
>>
>>
>> Assertions are a great tool, but never ever, under pain of great pain,
>> use assert for testing user input or function arguments.
> <.>
>>
>> Who makes that choice? You, or the caller? If the caller, then any
>> errors that occur are not internal state, and you shouldn't use assert.
>> If you, then it's an internal detail and you can use assert.
>
>  Steven: Thanks very much for taking so much time and effort to
>  answer my question. I will file this writing for future and
>  ongoing reference.
>
>  BTW: I was able to solve the problem. Essentially a clone of
>  Eval() was being called and probably clobbering the stack frame.
>  It was a tedious process of tracking thru known and likely code
>  dependencies and insert debugging stubs. I've written my own
>  debugging macros using vimscript and from your input I would guess
>  that assert would have just clouded the process.
>
>  thanks again.
> --
> Tim
> tim at johnsons-web.com or akwebsoft.com
> http://www.akwebsoft.com
> ___
> Tutor maillist  -  tu...@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
 Thanks steven, you're the best.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:45 PM, David Hutto  wrote:
> On Sun, Dec 12, 2010 at 2:45 PM, David Hutto  wrote:
>> On Sun, Dec 12, 2010 at 2:44 PM, Walter Prins  wrote:
>>>
>>>
>>> On 12 December 2010 19:16, David Hutto  wrote:

  I recall you making a habit of being an
 asshole(pystats should ring a bell, thanks for giving me the credit
 for inspiration...bitch)
>>>
>>> Rudeness objection.  Ad-hominem objection.
>>>
>>> Come on, this is not kindergarten.


But steven likes to be the smartest kindergartner, show his holier
than thou posts since he likes to recall others posts. Look ma what I
can do.

 We all have our foibles, and although
>>> I'd agree the tone around here occasionally leaves something to be desired,
>>> you just lower yourself to the same level and make matters worse if you
>>> resort to this type of name-calling.   Let's stick to objectively (as far as
>>> possible) critiquing and considering the points raised.
>>>
>>> Walter
>>>
>>  He started it Mama!
>>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Writing to the terminal?

2010-12-12 Thread Terry Carroll

On Fri, 10 Dec 2010, Modulok wrote:


Assume I'm working in a command shell on a terminal. Something like
tcsh on xterm, for example. I have a program which does *something*.
Let's say it counts down from 10. How do I print a value, and then
erase that value, replacing it with another value? Say I had something
like '10' that appears, then wait a second, then the 10 is replaced by
'9'... '8'.. and so forth.



import time
for t in range(10,0, -1):
print "%s \x0D" %t,
time.sleep(1)
print # get to next line
print "Done!"


The magic is \0x0D, which resets to the front of the line; and the 
trailing comma, which suppresses starting the next print on a new line.

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


Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-12 Thread Steven D'Aprano

Alan Gauld wrote:


"Steven D'Aprano"  wrote

ordered a chai latte at a cafe. The waiter had no idea what that was, 
but must have known that "chai" means tea, and so mixed tea and coffee


So now I've got to ask, what is a chai latte?
I could Google it but I'm feeling lazy :-)


Spiced tea with milk. Well, technically, it just means "tea with milk", 
but in English chai is used exclusively for spiced tea ("masala chai" in 
Indian) rather than black or green tea.


Oh, except for Nestles, who sell something here in Australia which they 
call chai but is actually flavoured coffee. I think it's flavoured with 
rat droppings and pimple-squeezings, no matter what the packet says, 
because it truly is disgusting.


"Latte" is short for the Italian "caffè latte", or literally "coffee 
with milk". The latte part means "with milk", not coffee.




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


Re: [Tutor] Writing to the terminal?

2010-12-12 Thread Steven D'Aprano

Terry Carroll wrote:


import time
for t in range(10,0, -1):
print "%s \x0D" %t,
time.sleep(1)
print # get to next line
print "Done!"


Which operating system and terminal did you use?

In my experience, using print is not satisfactory, because the print 
command buffers the output and doesn't actually print anything until 
either a newline or you have a certain number of characters. So the 
above will queue up the following string:


"10 \r9 \r8 \r7 \r6 \r5 \r4 \r3 \r2 \r1 \r\n"

before anything becomes visible, and of course that just looks like "1".



--
Steven

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


Re: [Tutor] Writing to the terminal?

2010-12-12 Thread Terry Carroll

On Mon, 13 Dec 2010, Steven D'Aprano wrote:


Which operating system and terminal did you use?

In my experience, using print is not satisfactory...


You're right; it worked under Windows, but not under Linux.  Given the 
other details of the question, my suggestion is not an adequate solution.

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


Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-12 Thread Alan Gauld


"Steven D'Aprano"  wrote

Spiced tea with milk. Well, technically, it just means "tea with 
milk", but in English chai is used exclusively for spiced tea


Never heard of it I confess.

I've heard the,  presumably related, term char, meaning a cup of black
tea (as in tea without milk, not black leaves!). And when I've been
in India I've heard tea called chai, but again it wasn't spiced,
just plain old tea without milk. But I've never heard of chai being
used in the UK, certainly not in Scotland!.

"Latte" is short for the Italian "caffè latte", or literally "coffee 
with milk". The latte part means "with milk", not coffee.


And I'm familiar with coffee latte, but like your waiter I'd never
heard of chai and latte being used together. So I too might have
brought you coffee and tea mixed! :-)

PS.
I tasted the Nestle's chai when I was in Australia and your
description accords with my findings! :-(



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


Re: [Tutor] Writing to the terminal?

2010-12-12 Thread Alan Gauld


"Modulok"  wrote


For more complex stuff, (think blue screens with little white boxes
you press spacebar to activate. Kind of like an OS installer) I 
would

look into the `curses` module in the standard library?


curses on Unix but its not in the std library for windows.

I think there is a version you can download, and there are also
libraries specifically for the PC terminal, one that I've used
successfully being Wconio, based on the Borland Turbo-C
console I/O package conio.h.

Conio is on Sourceforge.

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


Re: [Tutor] Tutor Digest, Vol 82, Issue 54

2010-12-12 Thread marupalli charan
t;>
>>
>>>
>>>
>>> --
>>> Steven
>>> ___
>>> Tutor maillist ?- ?tu...@python.org
>>> To unsubscribe or change subscription options:
>>> http://mail.python.org/mailman/listinfo/tutor
>>>
>>
>
>
> And if you do look at the emails, yes i was hostile at the
> beginning(I've learned to ignore bitches like you), because of
> attitudes like yours. And if you also look, everytime I tried to help
> point a fellow noob in the right direction, you came in and said how
> ignorant I was for trying to help(thanks alot, from them and me).
>
>
> --
>
> Message: 2
> Date: Sun, 12 Dec 2010 10:42:49 -0900
> From: Tim Johnson 
> To: tutor@python.org
> Subject: Re: [Tutor] Code evaluation inside of string fails with
>   __get_item
> Message-ID: <20101212194249.gi3...@johnsons-web.com>
> Content-Type: text/plain; charset=us-ascii
>
> * Steven D'Aprano  [101211 17:20]:
>> Tim Johnson wrote:
>>
>>>   I've never had the occasion to use assert() or any other
>>>   python - shooting tools, any thoughts on that?
>>
>>
>> Assertions are a great tool, but never ever, under pain of great pain,
>> use assert for testing user input or function arguments.
> <.>
>>
>> Who makes that choice? You, or the caller? If the caller, then any
>> errors that occur are not internal state, and you shouldn't use assert.
>> If you, then it's an internal detail and you can use assert.
>
>   Steven: Thanks very much for taking so much time and effort to
>   answer my question. I will file this writing for future and
>   ongoing reference.
>
>   BTW: I was able to solve the problem. Essentially a clone of
>   Eval() was being called and probably clobbering the stack frame.
>   It was a tedious process of tracking thru known and likely code
>   dependencies and insert debugging stubs. I've written my own
>   debugging macros using vimscript and from your input I would guess
>   that assert would have just clouded the process.
>
>   thanks again.
> --
> Tim
> tim at johnsons-web.com or akwebsoft.com
> http://www.akwebsoft.com
>
>
> --
>
> Message: 3
> Date: Sun, 12 Dec 2010 19:44:14 +
> From: Walter Prins 
> To: David Hutto 
> Cc: tutor@python.org
> Subject: Re: [Tutor] role playing game - help needed
> Message-ID:
>   
> Content-Type: text/plain; charset="iso-8859-1"
>
> On 12 December 2010 19:16, David Hutto  wrote:
>
>>  I recall you making a habit of being an
>> asshole(pystats should ring a bell, thanks for giving me the credit
>> for inspiration...bitch)
>>
>
> Rudeness objection.  Ad-hominem objection.
>
> Come on, this is not kindergarten.  We all have our foibles, and although
> I'd agree the tone around here occasionally leaves something to be desired,
> you just lower yourself to the same level and make matters worse if you
> resort to this type of name-calling.   Let's stick to objectively (as far as
> possible) critiquing and considering the points raised.
>
> Walter
> -- next part --
> An HTML attachment was scrubbed...
> URL:
> <http://mail.python.org/pipermail/tutor/attachments/20101212/b842f6f8/attachment-0001.html>
>
> --
>
> Message: 4
> Date: Sun, 12 Dec 2010 14:45:29 -0500
> From: David Hutto 
> To: Walter Prins 
> Cc: tutor@python.org
> Subject: Re: [Tutor] role playing game - help needed
> Message-ID:
>   
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Sun, Dec 12, 2010 at 2:44 PM, Walter Prins  wrote:
>>
>>
>> On 12 December 2010 19:16, David Hutto  wrote:
>>>
>>> ?I recall you making a habit of being an
>>> asshole(pystats should ring a bell, thanks for giving me the credit
>>> for inspiration...bitch)
>>
>> Rudeness objection.? Ad-hominem objection.
>>
>> Come on, this is not kindergarten.? We all have our foibles, and although
>> I'd agree the tone around here occasionally leaves something to be
>> desired,
>> you just lower yourself to the same level and make matters worse if you
>> resort to this type of name-calling.?? Let's stick to objectively (as far
>> as
>> possible) critiquing and considering the points raised.
>>
>> Walter
>>
>  He started it!
>
>
> --
>
> Message: 5
> Date: Sun, 12 Dec 2010 14:45:46 -0500
> From: David Hutto 
> To: Walter Prins 

Re: [Tutor] Tutor Digest, Vol 82, Issue 54

2010-12-12 Thread Corey Richardson

On 12/12/2010 11:43 PM, marupalli charan wrote:

dont send me mails again. i want to unsubscript
At the bottom of every single message from the list there are the 
following lines:


To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

~Corey Richardson

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


Re: [Tutor] Tutor Digest, Vol 82, Issue 54

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 11:43 PM, marupalli charan
 wrote:
> dont send me mails again. i want to unsubscript

___
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] Tutor Digest, Vol 82, Issue 54

2010-12-12 Thread Hugo Arts
On Mon, Dec 13, 2010 at 5:43 AM, marupalli charan
 wrote:
> dont send me mails again. i want to unsubscript
>

unfortunately, the unsubscribe option is only available to those smart
enough to take the time to read the first few paragraphs of the
digest, or the last few of any message at all.

> On 12/13/10, tutor-requ...@python.org  wrote:
>> Send Tutor mailing list submissions to
>>       tutor@python.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>       http://mail.python.org/mailman/listinfo/tutor
>> or, via email, send a message with subject or body 'help' to
>>       tutor-requ...@python.org
>>

Up until around here, really.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor