NewStats: 3,263,043 , 8,178,946 topics. Date: Wednesday, 04 June 2025 at 01:41 PM 443ns6z3e3g |
Common good python programming practices you should know (14464 Views)
iCode2: 10:30am On Jun 06, 2020 |
Should: ![]() ![]() |
Re: Common good python programming practices you should know by Nobody: 10:44am On Jun 06, 2020 |
crunchyDope: Programming is not about learning a difficult or easy syntax, it is about knowing the fundamentals. Either you choose Python, Ruby, PHP, Java, C#, etc, can you do the sleekest thing with them? Today, Python is the most sought-after programming language that let you worry less about the syntactic make-up and focus on the big events with its rich collections of libraries. Why choosing to do what you can do with just 5 lines of Python code with 30 lines of code of some other syntactically difficult languages? There are too many things to learn than wasting your time on syntax. Moreover, I will still never agree that Python is as simple as many people try to believe, not when you have tried some advanced topics that will leave you sweating over your computer. One can only say that Python is simple if what one is doing all along is playing safe. 1 Like |
gbolly1151(m): 2:04pm On Jun 06, 2020 |
donproject:Well said.... >>>python get complex when someone begin to define wrapper with decorators and functional concept where functions in some cases chaining this way
>>>More complex,when writing abstract class using metaclass and >>> most complex when writing in c language to work in python(most advanced) |
Re: Common good python programming practices you should know by Nobody: 3:00pm On Jun 06, 2020 |
gbolly1151: Exactly, I can see you've taken your game further beyond comfort zone. 1 Like |
Predstan: 4:06pm On Jun 06, 2020 |
gbolly1151: I decided to use Binary Search and Sorted List, now looks good a little. |
gbolly1151(m): 6:24pm On Jun 06, 2020 |
Predstan:Do you understand that your equation to calculate complexity will be Sorted list + binary search |
gbolly1151(m): 6:29pm On Jun 06, 2020 |
donproject:One of my goals is to know in and out of python and along this path i can see c language being my next programming language because of ython implementation and being the first language to implement python but dont think i can move to it now. |
gbolly1151(m): 7:57pm On Jun 06, 2020 |
What are factory functions? These are functions that return inner function
This is the basic of decorator in python |
Predstan: 9:14pm On Jun 06, 2020 |
gbolly1151: I used the Binary search to insert an element into the right position in the list. So the 0(.) Is just Logn. Instead of returning true or false, it returns the position of an item after divide and conquer, then I use the insert function to insert in the right position in the list. I also wrote a game called Game of Life where organisms dies or lives with respect to the number of organisms around them that are alive. Its similar code, you may check it here Boss. Thanks https://github.com/Predstan/Algorithm-and-Data-Structure/tree/master/ch5/Game%20Of%20Life%20-%20Improved The first file is the text based implementation of the game, the second is the LifeGrid Class where I used the list and Divide and conquer 1 Like |
gbolly1151(m): 9:56pm On Jun 06, 2020 |
Predstan:Will check it out bro |
Should: 10:18pm On Jun 06, 2020 |
gbolly1151:The below screenshot confused every me, while trying to understand Identity function.. Everything was going smoothly, until those figures appeared below "id(x), id(y)" .. how they got the value on red... 1 Like |
gbolly1151(m): 11:32pm On Jun 06, 2020 |
Should:The value in red are the memory addresses where x and y are stored,these values differs with PC. It is your pc that is responsible for how values are stored in the memory, id() only return the memory address |
Should: 12:32am On Jun 07, 2020 |
gbolly1151:OK, God bless... 1 Like |
gbolly1151(m): 8:58am On Jun 07, 2020 |
Should:Amen |
Predstan: 12:03pm On Jun 09, 2020 |
gbolly1151: I finally used LinkedList for the SparseMatrix and it was just Literarilly better. From Quartic to Quadratic https://github.com/Predstan/Algorithm-and-Data-Structure/blob/master/ch6/SparseMatrix%20Using%20Sorted%20Linkedlist/sparseMatrix.py 1 Like |
gbolly1151(m): 5:57pm On Jun 09, 2020 |
Predstan:But still curious why you dont want to use list Access time O(1) |
Predstan: 6:22pm On Jun 09, 2020 |
gbolly1151: Learning different data structures actually. I wrote one that uses List but still quadratic. Because using nested list, I have to iterate over each list of the both Matrices. One advantage of using the Array or the LinkedList is the memory since List creates double of storage being used. What I read tho. |
gbolly1151(m): 8:49pm On Jun 09, 2020 |
Predstan: Hmm....ok |
gbolly1151(m): 9:15pm On Jun 09, 2020 |
Predstan:Zip two list should reduce it,just thinking |
gbolly1151(m): 12:41pm On Jun 11, 2020 |
1 Like 1 Share |
gbolly1151(m): 7:40pm On Jun 16, 2020 |
In need of a special data type(object)?....you create class, In need of special class?....you create meta class |
CuteNerdyDude(m): 9:43pm On Jun 17, 2020 |
@gbolly1151 please what materials would you recommend for an intermediate python programmer?.
|
iCode2: 10:40pm On Jun 17, 2020 |
spam = ['apples', 'bananas', 'tofu', 'cats'] Write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space, with and inserted before the last item. For example, ing the previous spam list to the function would return 'apples, bananas, tofu, and cats'. But your function should be able to work with any list value ed to it. |
gbolly1151(m): 3:11am On Jun 18, 2020 |
CuteNerdyDude:realpython.com 1 Like |
gbolly1151(m): 3:30am On Jun 18, 2020 |
iCode2:Just seeing this
1 Like |
CuteNerdyDude(m): 8:20am On Jun 18, 2020 |
Thanks man. �
1 Like |
gbolly1151(m): 10:19am On Jun 18, 2020 |
CuteNerdyDude:you are welcome bro |
gbolly1151(m): 10:19am On Jun 18, 2020 |
If you want a variable or method that should be called; 1) from anywhere outside of a class,then declare the variable/method as public e.g in python name='gbolly' 2) within a class only,then declare the variable/method as private e.g in python __name='gbolly' #double underscore 3) only from class and subclasses then declare it protected e.g in python _name='gbolly' #single underscore |
Grandlord: 11:43am On Jun 18, 2020 |
gbolly1151:Bad guy ![]() |
gbolly1151(m): 12:00pm On Jun 18, 2020 |
Grandlord:Lolz...boss. |
iCode2: 5:45pm On Jun 18, 2020 |
gbolly1151:Oh I just checked again now. I misunderstood the question. I was working on returning an item in the list as a string separated by comma with an and before the last item. Something like... Returning the first index as 'a, p, p, l, e, and s'. Will that work? |
emilfischer(m): 7:30pm On Jun 18, 2020 |
Affordable UK used laptop Brand: Hp Series: Elitebook 2570p Processor: intel corei5 Hard drive: 320gb Ram size: 4gb Screen size: 12 inches Graphics: intel HD graphics Webcam: Available Wireless: Available Dvd rom: Available Fingerprint scanner: Available ed memory: SDXC, SDHC Ports: Usb ports, vga Operating system: Win10 Charger: Free Software installations: Free Delivery in Lagos: Pay on delivery Nationwide pay on delivery Price: 70k
|