Re: [Tutor] Preparing virtualenvwrapper for Django 1.6 development

2014-08-23 Thread Chris “Kwpolska” Warrick
On Fri, Aug 22, 2014 at 11:23 PM, Sithembewena Lloyd Dube
 wrote:
> Hi everyone,
>
> I am developing on a Windows 8.1 machine and wold like to setup
> virtualenvironment via virtualenvwrapper so as to have a properly set up
> Python development environment.
>
> I am referring to Jeff Knupp's guide at
> http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/
>
> After installation of virtualenvwrapper via pip, the guide says:
> "
> After it's installed, add the following lines to your shell's start-up file
> (.zshrc, .bashrc, .profile, etc).
>
> export WORKON_HOME=$HOME/.virtualenvs
> export PROJECT_HOME=$HOME/directory-you-do-development-in
> source /usr/local/bin/virtualenvwrapper.sh
> "
>
> My issue is, I do not understand what these lines are doing (I have a vague
> idea but assumptions can be deadly). Moreover, it is clear that the
> instructions were authored with a UNIX environment in mind.
>
> Would anyone be so kind as to translate this to Windows speak, as well as
> perhaps pointing out what file this would go into in a Windows environment?

virtualenvwrapper does not work in Windows.  You should use regular
virtualenv instead.  Read this:
http://virtualenv.readthedocs.org/en/latest/virtualenv.html#usage

Note that this blog post is HEAVILY *nix-specific, and that Windows is
a bad environment for Python development (especially Web development).
I personally recommend you just get a virtual machine running some
Linux instead of playing with Windows.

-- 
Chris “Kwpolska” Warrick 
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Preparing virtualenvwrapper for Django 1.6 development

2014-08-23 Thread Alan Gauld

On 23/08/14 08:54, Chris “Kwpolska” Warrick wrote:


Note that this blog post is HEAVILY *nix-specific, and that Windows is
a bad environment for Python development (especially Web development).


While I wouldn't say its the best environment I don't think its
fair to say Windows is "a bad environment for Python". Any
experienced Windows programmer will find it much easier to use Python on 
Windows than to learn a whole new OS and development environment.


And if they use the ActiveState version of Python (or IronPython)
they should feel quite at home.

OTOH If they already know Linux and have a choice then I'd agree
*nix is a better match. But modern Windows (post Win2k say) is not
so bad that you need a new OS. IMHO at least.

[ And for context, I run Linux on my main desktop, MacOS on my
laptop, and Windows 8.1 on a second desktop - used mainly for 
photography/video processing. And I use Python on all 3 of them)


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

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


[Tutor] Shorter way for a little program

2014-08-23 Thread Mimi Ou Yang
age = input("K")


age = int(age)


if (age == 1) or (age == 2) or (age  == 3) or (age == 4):
print ("LOL")


else:
print ("K")




Is there a shorter way to do this program???___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Shorter way for a little program

2014-08-23 Thread Joel Goldstick
On Sat, Aug 23, 2014 at 10:16 AM, Mimi Ou Yang  wrote:
> age = input("K")
>
> age = int(age)
>
> if (age == 1) or (age == 2) or (age  == 3) or (age == 4):
> print ("LOL")
>
> else:
> print ("K")
>
>
>
> Is there a shorter way to do this program???
>
age = int(input("K"))
if age in (1,2,3,4):
print "LOL")
else:
print age  # or do you really want to print "K" ?
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



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


Re: [Tutor] Shorter way for a little program

2014-08-23 Thread Alan Gauld

On 23/08/14 15:16, Mimi Ou Yang wrote:

age = input("K")
age = int(age)
if (age == 1) or (age == 2) or (age  == 3) or (age == 4):
 print ("LOL")
else:
 print ("K")

Is there a shorter way to do this program???


Yes you could do this:

print('LOL' if int(input('K')) in (1,2,3,4) else 'K')


Its shorter, but it suffers from the usual problems of
being shorter:
1) Its much harder to debug if it goes wrong
2) Almost any modifications are much harder.

Having said that there are some valid reductions you could consider:

age = int(input("K"))
if age in (1,2,3,4):  # or:  if 1 <= age <= 4:
  print ("LOL")
else:
  print ("K")

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

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