User : Sunjay Varma
![]() |
Title | User | Language | Tags | Description | Date |
|---|---|---|---|---|---|---|
|
Simple recursive function to non-recursive function | Sunjay Varma | python | Simple recursive function non-recursive function function list recursive substitute |
This recipe is a simple solution for turning a recursive function into a non-recursive function. |
May 27, 2011 |
|
Fibonacci Number Generator | Sunjay Varma | python | fibonacci generator memorizing number |
This recipe allows for individual number generation, and allows for generations of number ranges as well. The recipe automatically memorizes numbers generated before and keeps them through out the running of the script. This recipe cannot handle too large of numbers, but does act as a simple solution for most cases. |
April 13, 2011 |
|
Dictionary Who's Keys Act Like Attributes As Well | Sunjay Varma | python | attribute dict keys |
Think of this as a JavaScript object. In JavaScript, the objects can be referenced by indexing (e.g. d[name]) or by directly using the dot (.) operator (e.g. d.name). This is the same concept. Note to Python 2.4 Users: You will need to change the "except KeyError as e:" line to "except KeyError, (e):". |
February 28, 2011 |
|
Special Range Function for Different Kinds of Ranges (int, float, character) | Sunjay Varma | python | character float integer python range special |
This module allows the user to create a more verbose set of ranges. Simple character ranges, and float ranges are supported. Supported Ranges:
It should work in Python 2 and Python 3. If you tested this for speed, or want to test this for speed, please post the results! (And your system specs) Edit: Found a really silly error of mine when using range instead of xrange in these functions! |
February 20, 2011 |
|
Python Sessions | Sunjay Varma | python | cgi cookie management python security sessions |
I think this script should now be functional enough to post here at ActiveState. When you reply or vote down, please post some information on your problem with the code, and if you can, maybe something about the solution. This interface works, and is designed especially for Python. If you like it, don't be afraid to post that either, constructive criticism is all good, but compliments are even better! ;) Get the latest version of this code here: http://wiki.sunjay.ca/Python:Contents/Python_Session Latest Changes:
|
December 31, 2010 |
|
Simple Regular Expression Tester | Sunjay Varma | python | command debugging line python quick re regex testing |
Is it possible to create a simple command line program that I can use to quickly test my regular expressions? Yes it is. This simple regular expression tester uses Python's re module as well as others to quickly allow you to test your regular expression in one go. TODO:
Recent Changes:
|
December 24, 2010 |
|
Python Tkinter Canvas Rectangle Selection Box | Sunjay Varma | python | canvas rectangle selection tkinter |
A simple, yet effective rectangle selection box. :) Works with a tkinter canvas! Just add the class and set it up like in the example code. The cross heir was my own touch, the RectTracker only draws a box. Have fun! And please don't just vote down, post what you don't like if you don't like it. |
September 27, 2010 |
|
Tkinter Splash Screen | Sunjay Varma | python | python screen splash tkinter |
I wanted to mess around with the overrideredirect function of the window manager, and ended up making a pretty good Python Tkinter splash screen. :) Just run it for a demo. There are instructions and more info in the script |
June 21, 2010 |
|
Python Tkinter Tabs | Sunjay Varma | python | python sunjay tabs tkinter varma |
This tabbed interface is very useful for Tkinter users. I am sure there is a better way to do it, but I did the best I could. Please enjoy this tabbed interface by SunjayVarma - www.sunjay-varma.com UPDATES: Fixed the index issues. Made it easier to use. |
June 13, 2010 |
|
Improved range function | Sunjay Varma | python | float python range replace |
While using the built-in range function a while ago. I found an odd (perhaps bug) where the range function couldn't use float steps. I am not sure if that was intended for simplicity or not, but I wrote my own range function that goes beyond that anyway. |
June 5, 2010 |
|
Flatten a list (or list of lists, etc.) | Sunjay Varma | python | extend flatten list optimization python smart |
I created this function sometime ago for my own purposes. It simply flattens a list. Check out the first comment for another version of someone else's design. |
June 5, 2010 |

