Posts
 
Reputation
Joined
Last Seen
Ranked #308
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
80% Quality Score
Upvotes Received
51
Posts with Upvotes
45
Upvoting Members
24
Downvotes Received
12
Posts with Downvotes
12
Downvoting Members
7
14 Commented Posts
Member Avatar for happygeek

"...head over to the sales websites..." Marketers. Their goal is to sell at any cost, and not to give you the best product for your needs.

Member Avatar for simhakidsden
9
3K
Member Avatar for gishi

Don't separate the user id from the entry. [code]import csv, contextlib usernfo = {} with contextlib.closing(open()) as ifile: for entry in csv.DictReader(ifile): usernfo[entry['id']] = entry print(usernfo)[/code]

Member Avatar for Gribouillis
0
15K
Member Avatar for vegaseat

One thing that I'm very glad I learned to do as a beginner and still use today - even though I'm probably still a beginner - is to have a basic file with code that is used more often than not in the script. I can copy this file each …

Member Avatar for vegaseat
23
34K
Member Avatar for vegaseat

Make an irc bot to connect to an irc server and channel and respond to users in various ways. Download irclib to get some code to start from. [url]http://irclib.bitlbee.org/[/url] If you can, get a copy of IRC Hacks published by O'Reilly. [url]http://www.jibble.org/irchacks/[/url]

Member Avatar for vegaseat
20
18K
Member Avatar for The Mad Hatter
Member Avatar for lrh9

There is a security technique known as code signing. It basically generates a certificate for your code. This certificate first certifies the author of the code. Second, it has a value generated from the code. This value is unique to that code. If any changes are made to the code, …

Member Avatar for jamercee
0
6K
Member Avatar for slfisher

A picture or multiple pictures are just extremely small slices of a person's life. It doesn't represent the whole of person's life. There will be times when a manic person will be placid, or an agoraphobic person will go out in public. As long as someone is going to an …

Member Avatar for halenmartinez
1
575
Member Avatar for stevelll

Task 1 is probably something that could be accomplished using system utilities if you were willing to research the options. I bet you could write a command line script or something to do it. Task 2 can have many approaches. If the program in question supports the right command line …

Member Avatar for tutux
0
171
Member Avatar for hughesadam_87

Why do you need to check an object's mutability? Sounds like you need to solve a different problem or use a different solution. Technically you could try to make whatever changes you wanted to make and catch any AttributeError exceptions, but it still seems funny. So...?

Member Avatar for hughesadam_87
0
4K
Member Avatar for ProNewb

Builtins are the way to do it, but in your function you reset s to zero each loop because it is inside the loop. It needs to be set to zero before the loop.

Member Avatar for ProNewb
0
174
Member Avatar for Dani

At present the survey requires only a username to participate. Aren't you concerned that someone might vote using other usernames?

Member Avatar for TrustyTony
1
456
Member Avatar for 3e0jUn

It depends on the structure of your file and what you are trying to do. To update (read and write) a file you usually open it with mode r+. From your other posts, I can see you are making a game. Are you trying to develop a save system or …

Member Avatar for snippsat
0
482
Member Avatar for lrh9

I had been wanting to write an IRC bot with asynchronous IO for a while. My bot responds to pings, but can be extended by defining functions and registering them to get called when the bot receives certain commands. My bot uses the RFC 1459 USER command and parameters, but …

Member Avatar for lrh9
0
261
Member Avatar for drichird

You can write a module that can also act as a script by using the idiom: if __name__ == '__main__': pass Importing a module and then executing the main body of that module is indicative of a design problem, but can be accomplished by wrapping the main body in a …

Member Avatar for drichird
0
8K
Member Avatar for abhik1368

The Python standard library features a csv module for CSV file reading and writing. Read the module documentation to learn how to use it. I'd use a dictionary or collections.OrderedDict to associate each unique key with a list of values.

Member Avatar for TrustyTony
0
131
Member Avatar for fatalaccidents

I think that if someone takes the time to get an abstract overview of programming languages, he or she finds that programming languages are relatively simple and those featuring the same [URL="http://en.wikipedia.org/wiki/Programming_paradigm"]programming paradigms[/URL] are quite similar. It's a fascinating subject. When a person studies a specific programming language, he or …

Member Avatar for moroccanplaya
0
361
Member Avatar for inuasha

[url]http://en.wikipedia.org/wiki/Pseudorandom_number_generator[/url] There is even a link to an algorithm with a psuedocode implementation. Personally, I think you should find something else to work on. I think reimplementing established algorithms will provide little educational value.

Member Avatar for snippsat
0
3K
Member Avatar for WolfShield
Member Avatar for WolfShield
0
241
Member Avatar for lrh9

I am doing some hobby coding regarding neural networks, and I was wondering if this is a correct and good use of abstract base classes or not. [code=PYTHON]import abc import collections import math import weakref class AbstractNeuron(metaclass=abc.ABCMeta): def __init__(self, weights, f=math.tanh, bias=1, biasWeight=0): self.weights = weights self.f = f self.bias …

Member Avatar for TrustyTony
0
204
Member Avatar for inuasha

I've never used it, but the subprocess module may be what you need. It seems to feature a function that will start a subprocess and wait for the subprocess exit code. If the exit code is non-zero then the function will raise an exception.

Member Avatar for inuasha
0
214
Member Avatar for Luis Ventura

Sounds like an application for collections.Counter. First do the Python tutorial to learn the Python language. [url]http://docs.python.org/py3k/tutorial/index.html[/url] Then review the library reference to get an overview of Python's built in functionality. [url]http://docs.python.org/py3k/library/index.html[/url] Finally, read the documentation for collections and try to write your program. [url]http://docs.python.org/py3k/library/collections.html[/url] We can't help you if …

Member Avatar for Luis Ventura
0
527
Member Avatar for lrh9

Hand evaluator for Texas Hold'em. If a "hand" has five or more cards, hand.rank will find the best five card hand the hand can form. Two hands can be compared using the comparison operators. The final hand can be gotten from the "hand" with hand.rank.hand. The value used for comparisons …

Member Avatar for lrh9
0
1K
Member Avatar for arson09

Is this for production or is it just an exercise? If it is for production use bisect.insort to insert items into a list in sorted order.

Member Avatar for arson09
0
224
Member Avatar for M09

Seems like the big barrier here is that the poster's primary language must not be English. I tried searching for "moy", but I didn't get any promising results. Perhaps it is an abbreviation or truncation?

Member Avatar for M09
0
538
Member Avatar for Acidz

As a designer and coder we should be as abstract as usefully possible. Abstract software is compact and reusable. You are treating classes as namespaces and making a specific class or function for every thing. You should treat classes as blueprints that abstractly specify the attributes and capabilities of a …

Member Avatar for lrh9
0
269
Member Avatar for lionaneesh

Anyone with sufficient skills at Google could have found that information in the Python documentation. [url]http://www.lmgtfy.com/?q=python+dictionary[/url] [url]http://docs.python.org/tutorial/datastructures.html#dictionaries[/url]

Member Avatar for colstonewall
0
410
Member Avatar for TrustyTony

It's also possible to bin items to a collection like a set or list. This technique can bin items without key collisions. [code=PYTHON]import collections data = ((5.639792, 1.36), (4.844813, 1.89), (4.809105, 2.33), (3.954150, 2.69), (2.924234, 3.42), (1.532669, 4.50), (0.000000, 5.63)) bucket = collections.defaultdict(list) for each in data: bucket[int((each[1]))].append(each[0]) print(bucket) [/code]

Member Avatar for Stackheuw
2
2K
Member Avatar for Cyph0n

It's not unusual for early implementations of code to be excessive or unrefined. The important thing is to refactor as necessary. [url]http://en.wikipedia.org/wiki/Code_refactoring[/url] Your early implementations and final versions will improve over time if you learn more about Python, plan what you want your code to do, decompose data and functions, …

Member Avatar for lrh9
0
243
Member Avatar for lrh9

I'm working on a project where I would like to compare collections of words, but I have additional constraints I need to account for. The collections are like a set in that order doesn't matter for the comparison. However, in my problem equal elements are significant. E.g. the collection of …

Member Avatar for TrustyTony
0
140
Member Avatar for lrh9

I'm interested in a generic event system for Python. I've searched the forum for similar topics, and I've searched the web for existing implementations. I haven't found exactly what I'm looking for. I'm familiar with the Observer pattern. However, my implementation and other implementations lack strong support for concurrency and …

Member Avatar for lrh9
0
114