INNER CODE UNIT · Python

compare_versions

psalias2006/gpu-hot · app.py:73

def compare_versions(current, latest):
    """Compare semantic versions. Returns True if latest > current"""
    try:
        current_parts = [int(x) for x in current.split('.')]
        latest_parts = [int(x) for x in latest.split('.')]
        
        # Pad to same length
        max_len = max(len(current_parts), len(latest_parts))
        current_parts += [0] * (max_len - len(current_parts))
        latest_parts += [0] * (max_len - len(latest_parts))
        
        # Compare each part
        for c, l in zip(current_parts, latest_parts):
            if l > c:
                return True
            elif l < c:
                return False
        

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…