|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
![]() ![]() |
Another neat Python trick that you may not know:
List notations are a quick and easy way to apply a transformation to every element in an iteratable data structure. Say that you wanted a list of numbers from 0 to 100 in a list. Instead of doing this:
a_list = []
for x in xrange(0, 101):
a_list.append(x)
You can do this: a_list = [x for x in xrange(0, 101)] If you need to, you can apply more logic to the for loop as well: # This will exclude 53 from the list. a_list = [x for x in xrange(0, 101) if x != 53] I used something like this not too long ago to figure out my passcode for my office door:
def passcode(last_name):
last_name = last_name.lower()
int_list = [ord(char) - ord('a') for char in last_name]
return "".join([str(i) for i in int_list])[0:5]
This is one of my favorite Python shortcuts. --- |
|||
|
|
|
|
|||
|
![]() ![]() |
I don't put comments inside functions unless the function is doing more than one thing (which, in principle, it shouldn't). Document what the function does before declaration. If you can't tell how a function actually performs the operation by looking at its source code, the author did something wrong. --- |
|||
|
|
|
its more like that spagetti arrangement. The part i dont like doing is having to search the different class files this guy wrote trying to find out what array is stored in a variable or what the referenced functions are doing. i'm looking at porting the program over to python from php and i want to start off with the most simple function, which he made linking vars and functions from like 4 class files. i dont mean to keep complaining about the same program, but i am still trying to decide where to start. |
|||
|
![]() ![]() |
In the spaghetti arrangement, it's always best to comment on what each logical block does.
PHP is such an awful language. --- |
|||
|
|
|
so i'm setting up a lamp server on my laptop so i can use that as my testing environment. Ubuntu was more than easy to install and setup to be ok for what I need. Actually, they added an installer that boots up in windows that will alter the partitions install ubuntu and make it so you can use windows mbr instead of grub or lilo(dont know if anybody still uses lilo). Then i setup mysql which was a simple apt-get, and i did a make install of both apache 2.3 and php5 (only using php for phpmyadmin) and i am now having issues linking the php with the apache. but I think i am almost over that issue and will be moving on to setting up phpmyadmin and then installing anything else i need. python and django were easier to setup than the lovely php program and django worked after 5 minutes.
|
|||
|
![]() ![]() |
I never had trouble getting Apache+PHP to work, then again I've always used something pre-packaged, whether it's apt-get, macports or xampp
If there's a package for Apache+PHP I'd use that, you can always install mod_wsgi or mod_python later. --- |
|||
|
the virtuous gizzard![]() |
how many people do you think you're talking to ? |
|||
|
![]() ![]() |
get out --- |
|||
|
|
|
|
|||
|
the virtuous gizzard![]() |
no need to get defensive, i really was curious
i'm not really a fan of one-click encoding but this program might be of use to some people, it can encode almost everything to almost everything http://www.erightsoft.com/S6Kg1.html |
|||
|
![]() ![]() |
i wouldn't use that just becaues the website is so fucking awful
use handbrake or mediacoder if you want programs that don't suck absolute shit ps get out --- |
|||
|
the virtuous gizzard![]() |
the web site is not just awful, it's a silent hill labyrinth, i spend 10 mins trying to find the download link
handbrake is just a cheap encoding gui and mediacoder is just another half way between proper encoding and one click solution super's simple but surprisingly good ps jerry springer is on, mom's gonna say how your uncle harry's really |
|||
|
»Cµłť ǿƒ Ŝţāţić«![]() |
Calm yourself Lorazepam -_-
P.S. I hate Jerry Springer |
|||
|
|
|
|
|||
|
![]() |
This is geeky shit....HardKore nerd.
myspace.com/angel1620 |
|||
|
|
Like salt to old wounds... |
Wow. Thanks for your deep insight. |
|||
|
|
|
|
|||
|
![]() |
ThanX for not getting all sensitive Brian, ya know I was just joshing you.
myspace.com/angel1620 |
|||
|
![]() ![]() |
out --- |
|||
|
| Powered by Eve Community | Page 1 3 4 5 6 7 8 9 11 |
| Please Wait. Your request is being processed... |
|

