text
stringlengths
200
200k
source
stringclasses
2 values
# Setup django with WSGI and apache ## Question I have been sold on mod_wsgi and apache rather than mod_python. I have all the parts installed (django, apache, mod_wsgi) but have run into a problem deploying. I am on osx 10.5 with apache 2.2 and django 1.0b2, mod_wsgi-2.3 My application is called tred. Here are the...
stackoverflow-qa
# How do I add data to an existing model in Django? ## Question Currently, I am writing up a bit of a product-based CMS as my first project. Here is my question. How can I add additional data (products) to my Product model? I have added '/admin/products/add' to my urls.py, but I don't really know where to go from th...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer From the Python documentation: If there are more positional arguments than there are formal par...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer The *args and **kwargs is a common idiom to allow arbitrary number of arguments to functions as des...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer The single * means that there can be any number of extra positional arguments. foo() can be invoked...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer It's also worth noting that you can use * and ** when calling functions as well. This is a shortcut...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer * and ** have special usage in the function argument list. * implies that the argument is a list an...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer *args and **kwargs notation *args (typically said "star-args") and **kwargs (stars can be implied ...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer In addition to function calls, *args and **kwargs are useful in class hierarchies and also avoid ha...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer In Python 3.5, you can also use this syntax in list, dict, tuple, and set displays (also sometimes ...
stackoverflow-qa
# What does ** (double star) and * (star) do for Python parameters? ## Question In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): ## Answer Let us first understand what are positional arguments and keyword arguments. Below is an example of...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Before PEP 435, Python didn't have an equivalent but you could implement your own. Myself, I like keeping it simple (...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Hmmm... I suppose the closest thing to an enum would be a dictionary, defined either like this: months = { 'Janua...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Python doesn't have a built-in equivalent to enum, and other answers have ideas for implementing your own (you may als...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer If you need the numeric values, here's the quickest way: dog, cat, rabbit = range(3) Tags: python, python-3.x, enums
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer The typesafe enum pattern which was used in Java pre-JDK 5 has a number of advantages. Much like in Alexandru's answer...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer davidg recommends using dicts. I'd go one step further and use sets: months = set('January', 'February', ..., 'Decem...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Alexandru's suggestion of using class constants for enums works quite well. I also like to add a dictionary for each...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer def M_add_class_attribs(attribs): def foo(name, bases, dict_): for v, k in attribs: dict_[k] =...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer It's funny, I just had a need for this the other day and I couldnt find an implementation worth using... so I wrote my...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer What I use: class Enum(object): def __init__(self, names, separator=None): self.names = names.split(separ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer The best solution for you would depend on what you require from your fake enum. Simple enum: If you need the enum as...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Use the following. TYPE = {'EAN13': u'EAN-13', 'CODE39': u'Code 39', 'CODE128': u'Code 128', ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Enums have been added to Python 3.4 as described in PEP 435. It has also been backported to 3.3, 3.2, 3.1, 2.7, 2.6, ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer I had need of some symbolic constants in pyparsing to represent left and right associativity of binary operators. I u...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer This is the best one I have seen: "First Class Enums in Python" http://code.activestate.com/recipes/413486/ It gives...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Here is one implementation: class Enum(set): def __getattr__(self, name): if name in self: re...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Following the Java like enum implementation proposed by Aaron Maenpaa, I came out with the following. The idea was to ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer The enum package from PyPI provides a robust implementation of enums. An earlier answer mentioned PEP 354; this was re...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Why must enumerations be ints? Unfortunately, I can't think of any good looking construct to produce this without chan...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer def enum( *names ): ''' Makes enum. Usage: E = enum( 'YOUR', 'KEYS', 'HERE' ) print( E.HE...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer I like the Java enum, that's how I do it in Python: def enum(clsdef): class Enum(object): __slots__=tuple...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer So, I agree. Let's not enforce type safety in Python, but I would like to protect myself from silly mistakes. So what ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer I prefer to define enums in Python like so: class Animal: class Dog: pass class Cat: pass x = Animal.Dog It's ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Here is a variant on Alec Thomas's solution: def enum(*args, **kwargs): return type('Enum', (), dict((y, x) for x...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Another, very simple, implementation of an enum in Python, using namedtuple: from collections import namedtuple def ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer This solution is a simple way of getting a class for the enumeration defined as a list (no more annoying integer assig...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer I have had occasion to need of an Enum class, for the purpose of decoding a binary file format. The features I happene...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer I really like Alec Thomas' solution (http://stackoverflow.com/a/1695250): def enum(**enums): '''simple constant "...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer An Enum class can be a one-liner. class Enum(tuple): __getattr__ = tuple.index How to use it (forward and reverse l...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer I use a metaclass to implement an enumeration (in my thought, it is a const). Here is the code: class ConstMeta(type)...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer A variant (with support to get an enum value's name) to Alec Thomas's neat answer: class EnumBase(type): def __in...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer I like to use lists or sets as enumerations. For example: >>> packet_types = ['INIT', 'FINI', 'RECV', 'SEND'] >>> pac...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer The solution that I usually use is this simple function to get an instance of a dynamically created class. def enum(n...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Python 2.7 and find_name() Here is an easy-to-read implementation of the chosen idea with some helper methods, which ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer While the original enum proposal, PEP 354, was rejected years ago, it keeps coming back up. Some kind of enum was inte...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer On 2013-05-10, Guido agreed to accept PEP 435 into the Python 3.4 standard library. This means that Python finally has...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer The new standard in Python is PEP 435, so an Enum class will be available in future versions of Python: >>> from enum...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Here's an approach with some different characteristics I find valuable: allows > and < comparison based on order in ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Didn't see this one in the list of answers, here is the one I whipped up. It allows the use of 'in' keyword and len() ...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer From Python 3.4 there will be official support for enums. You can find documentation and examples here on Python 3.4 d...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Here is a nice Python recipe that I found here: http://code.activestate.com/recipes/577024-yet-another-enum-for-python...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer Keep it simple: class Enum(object): def __init__(self, tupleList): self.tupleList = tupleList d...
stackoverflow-qa
# How can I represent an 'Enum' in Python? ## Question I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python? ## Answer def enum(*sequential, **named): enums = dict(zip(sequential, [object() for _ in range(len(sequential))]), **named)...
stackoverflow-qa
# Resources for lexing, tokenising and parsing in python ## Question Can people point me to resources on lexing, parsing and tokenising with Python? I'm doing a little hacking on an open source project (hotwire) and wanted to do a few changes to the code that lexes, parses and tokenises the commands entered into it. ...
stackoverflow-qa
# Resources for lexing, tokenising and parsing in python ## Question Can people point me to resources on lexing, parsing and tokenising with Python? I'm doing a little hacking on an open source project (hotwire) and wanted to do a few changes to the code that lexes, parses and tokenises the commands entered into it. ...
stackoverflow-qa
# Resources for lexing, tokenising and parsing in python ## Question Can people point me to resources on lexing, parsing and tokenising with Python? I'm doing a little hacking on an open source project (hotwire) and wanted to do a few changes to the code that lexes, parses and tokenises the commands entered into it. ...
stackoverflow-qa
# Resources for lexing, tokenising and parsing in python ## Question Can people point me to resources on lexing, parsing and tokenising with Python? I'm doing a little hacking on an open source project (hotwire) and wanted to do a few changes to the code that lexes, parses and tokenises the commands entered into it. ...
stackoverflow-qa
# Resources for lexing, tokenising and parsing in python ## Question Can people point me to resources on lexing, parsing and tokenising with Python? I'm doing a little hacking on an open source project (hotwire) and wanted to do a few changes to the code that lexes, parses and tokenises the commands entered into it. ...
stackoverflow-qa
# Resources for lexing, tokenising and parsing in python ## Question Can people point me to resources on lexing, parsing and tokenising with Python? I'm doing a little hacking on an open source project (hotwire) and wanted to do a few changes to the code that lexes, parses and tokenises the commands entered into it. ...
stackoverflow-qa
# Resources for lexing, tokenising and parsing in python ## Question Can people point me to resources on lexing, parsing and tokenising with Python? I'm doing a little hacking on an open source project (hotwire) and wanted to do a few changes to the code that lexes, parses and tokenises the commands entered into it. ...
stackoverflow-qa
# How to make Ruby or Python web sites to use multiple cores? ## Question Even though Python and Ruby have one kernel thread per interpreter thread, they have a global interpreter lock (GIL) that is used to protect potentially shared data structures, so this inhibits multi-processor execution. Even though the portions...
stackoverflow-qa
# How to make Ruby or Python web sites to use multiple cores? ## Question Even though Python and Ruby have one kernel thread per interpreter thread, they have a global interpreter lock (GIL) that is used to protect potentially shared data structures, so this inhibits multi-processor execution. Even though the portions...
stackoverflow-qa
# How to make Ruby or Python web sites to use multiple cores? ## Question Even though Python and Ruby have one kernel thread per interpreter thread, they have a global interpreter lock (GIL) that is used to protect potentially shared data structures, so this inhibits multi-processor execution. Even though the portions...
stackoverflow-qa
# How to make Ruby or Python web sites to use multiple cores? ## Question Even though Python and Ruby have one kernel thread per interpreter thread, they have a global interpreter lock (GIL) that is used to protect potentially shared data structures, so this inhibits multi-processor execution. Even though the portions...
stackoverflow-qa
# Filter out HTML tags and resolve entities in python ## Question Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python. ## Answer How about parsing the HTML data and extracting the data with the help of the parser ? I'd try something...
stackoverflow-qa
# Filter out HTML tags and resolve entities in python ## Question Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python. ## Answer While I agree with Lucas that regular expressions are not all that scary, I still think that you should ...
stackoverflow-qa
# Filter out HTML tags and resolve entities in python ## Question Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python. ## Answer You might need something more complicated than a regular expression. Web pages often have angle brackets...
stackoverflow-qa
# Filter out HTML tags and resolve entities in python ## Question Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python. ## Answer Use BeautifulSoup! It's perfect for this, where you have incoming markup of dubious virtue and need to g...
stackoverflow-qa
# Filter out HTML tags and resolve entities in python ## Question Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python. ## Answer Use lxml which is the best xml/html library for python. import lxml.html t = lxml.html.fromstring("..."...
stackoverflow-qa
# Filter out HTML tags and resolve entities in python ## Question Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python. ## Answer if you use django you might also use http://docs.djangoproject.com/en/dev/ref/templates/builtins/#strip...
stackoverflow-qa
# What's the easiest way to read a FoxPro DBF file from Python? ## Question I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf.p...
stackoverflow-qa
# What's the easiest way to read a FoxPro DBF file from Python? ## Question I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf.p...
stackoverflow-qa
# What's the easiest way to read a FoxPro DBF file from Python? ## Question I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf.p...
stackoverflow-qa
# What's the easiest way to read a FoxPro DBF file from Python? ## Question I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf.p...
stackoverflow-qa
# What's the easiest way to read a FoxPro DBF file from Python? ## Question I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf.p...
stackoverflow-qa
# What's the easiest way to read a FoxPro DBF file from Python? ## Question I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf.p...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# What are Class methods in Python for? ## Question I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but ...
stackoverflow-qa
# Retrieving an Oracle timestamp using Python's Win32 ODBC module ## Question Given an Oracle table created using the following: CREATE TABLE Log(WhenAdded TIMESTAMP(6) WITH TIME ZONE); Using the Python ODBC module from its Win32 extensions (from the win32all package), I tried the following: import dbi, odbc conn...
stackoverflow-qa
# Retrieving an Oracle timestamp using Python's Win32 ODBC module ## Question Given an Oracle table created using the following: CREATE TABLE Log(WhenAdded TIMESTAMP(6) WITH TIME ZONE); Using the Python ODBC module from its Win32 extensions (from the win32all package), I tried the following: import dbi, odbc conn...
stackoverflow-qa
# What's the best way to return multiple values from a function in Python? ## Question I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. In C#, I would use an out para...
stackoverflow-qa
# What's the best way to return multiple values from a function in Python? ## Question I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. In C#, I would use an out para...
stackoverflow-qa
# What's the best way to return multiple values from a function in Python? ## Question I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. In C#, I would use an out para...
stackoverflow-qa
# What's the best way to return multiple values from a function in Python? ## Question I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. In C#, I would use an out para...
stackoverflow-qa
# What's the best way to return multiple values from a function in Python? ## Question I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. In C#, I would use an out para...
stackoverflow-qa
# Using Django time/date widgets in custom form ## Question How can I use the nifty JavaScript date and time widgets that the default admin uses with my custom view? I have looked through the Django forms documentation, and it briefly mentions django.contrib.admin.widgets, but I don't know how to use it? Here is my ...
stackoverflow-qa
# Using Django time/date widgets in custom form ## Question How can I use the nifty JavaScript date and time widgets that the default admin uses with my custom view? I have looked through the Django forms documentation, and it briefly mentions django.contrib.admin.widgets, but I don't know how to use it? Here is my ...
stackoverflow-qa
# Using Django time/date widgets in custom form ## Question How can I use the nifty JavaScript date and time widgets that the default admin uses with my custom view? I have looked through the Django forms documentation, and it briefly mentions django.contrib.admin.widgets, but I don't know how to use it? Here is my ...
stackoverflow-qa
# Using Django time/date widgets in custom form ## Question How can I use the nifty JavaScript date and time widgets that the default admin uses with my custom view? I have looked through the Django forms documentation, and it briefly mentions django.contrib.admin.widgets, but I don't know how to use it? Here is my ...
stackoverflow-qa